Skip to content

Commit

Permalink
- fixed ordering of stateselect and jacobian equations in *_info.xml
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@18141 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Willi Braun committed Nov 14, 2013
1 parent 2a207fb commit b9046ab
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
20 changes: 11 additions & 9 deletions Compiler/BackEnd/SimCodeUtil.mo
Original file line number Diff line number Diff line change
Expand Up @@ -1553,12 +1553,8 @@ algorithm
sampleZC = getSamples(dlow);
zeroCrossings = Util.if_(ifcpp, listAppend(zeroCrossings, sampleZC), zeroCrossings);

// state set stuff
tempvars = {};
(dlow, stateSets, uniqueEqIndex, tempvars, numStateSets) = createStateSets(dlow, {}, uniqueEqIndex, tempvars);

// inline solver stuff
(inlineEquations, uniqueEqIndex, tempvars) = createInlineSolverEqns(inlineDAE, uniqueEqIndex, tempvars);
(inlineEquations, uniqueEqIndex, tempvars) = createInlineSolverEqns(inlineDAE, uniqueEqIndex, {});

// initialization stuff
(residuals, initialEquations, numberOfInitialEquations, numberOfInitialAlgorithms, uniqueEqIndex, tempvars, useSymbolicInitialization) = createInitialResiduals(dlow, initDAE, uniqueEqIndex, tempvars);
Expand All @@ -1573,13 +1569,10 @@ algorithm
functionTree=functionTree,
symjacs=symJacs)) = dlow;

// Add model info
modelInfo = createModelInfo(class_, dlow, functions, {}, numberOfInitialEquations, numberOfInitialAlgorithms, numStateSets, fileDir, ifcpp);

// equation generation for euler, dassl2, rungekutta
(uniqueEqIndex, odeEquations, algebraicEquations, allEquations, tempvars, equationSccMapping) = createEquationsForSystems(systs, shared, uniqueEqIndex, {}, {}, {}, tempvars, 1, {});
highestSimEqIndex = uniqueEqIndex;
modelInfo = addTempVars(tempvars, modelInfo);

((uniqueEqIndex, removedEquations)) = BackendEquation.traverseBackendDAEEqns(removedEqs, traversedlowEqToSimEqSystem, (uniqueEqIndex, {}));

Expand All @@ -1600,6 +1593,14 @@ algorithm
algebraicEquations = listAppend(algebraicEquations, removedEquations::{});
allEquations = listAppend(allEquations, removedEquations);

// state set stuff
(dlow, stateSets, uniqueEqIndex, tempvars, numStateSets) = createStateSets(dlow, {}, uniqueEqIndex, tempvars);

// create model info
modelInfo = createModelInfo(class_, dlow, functions, {}, numberOfInitialEquations, numberOfInitialAlgorithms, numStateSets, fileDir, ifcpp);
modelInfo = addTempVars(tempvars, modelInfo);


// update indexNonLinear in SES_NONLINEAR and count
SymbolicJacs = {};
(initialEquations, numberofLinearSys, numberofNonLinearSys, numberofMixedSys, SymbolicJacsTemp) = countandIndexAlgebraicLoops(initialEquations, 0, 0, 0, {});
Expand Down Expand Up @@ -1628,7 +1629,8 @@ algorithm
odeEquations = List.mapList1_1(odeEquations, setSystemIndexMap, systemIndexMap);
algebraicEquations = List.mapList1_1(algebraicEquations, setSystemIndexMap, systemIndexMap);
numberofEqns = uniqueEqIndex; /* This is a *much* better estimate than the guessed number of equations */


// create model info
modelInfo = addNumEqnsandNumofSystems(modelInfo, numberofEqns, numberofLinearSys, numberofNonLinearSys, numberofMixedSys);

// replace div operator with div operator with check of Division by zero
Expand Down
6 changes: 3 additions & 3 deletions Compiler/Template/SimCodeDump.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ template dumpSimCodeBase(SimCode code, Boolean withOperations)
<%dumpVars(vars.extObjVars,withOperations)%>
<%dumpVars(vars.constVars,withOperations)%>
</variables>
<jacobian-equations>
<%dumpEqs(SimCodeUtil.sortEqSystems(collectAllJacobianEquations(jacobianMatrixes)),withOperations)%>
</jacobian-equations>
<initial-equations size="<%listLength(initialEquations)%>">
<%dumpEqs(SimCodeUtil.sortEqSystems(initialEquations),withOperations)%>
</initial-equations>
Expand All @@ -72,6 +69,9 @@ template dumpSimCodeBase(SimCode code, Boolean withOperations)
<assertions size="<%listLength(algorithmAndEquationAsserts)%>">
<%dumpEqs(SimCodeUtil.sortEqSystems(algorithmAndEquationAsserts),withOperations)%>
</assertions>
<jacobian-equations>
<%dumpEqs(SimCodeUtil.sortEqSystems(collectAllJacobianEquations(jacobianMatrixes)),withOperations)%>
</jacobian-equations>
<literals size="<%listLength(literals)%>">
<% literals |> exp => '<exp><%printExpStrEscaped(exp)%></exp>' ; separator="\n" %>
</literals>
Expand Down

0 comments on commit b9046ab

Please sign in to comment.