Skip to content

Commit b9046ab

Browse files
author
Willi Braun
committed
- fixed ordering of stateselect and jacobian equations in *_info.xml
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@18141 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 2a207fb commit b9046ab

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

Compiler/BackEnd/SimCodeUtil.mo

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,12 +1553,8 @@ algorithm
15531553
sampleZC = getSamples(dlow);
15541554
zeroCrossings = Util.if_(ifcpp, listAppend(zeroCrossings, sampleZC), zeroCrossings);
15551555

1556-
// state set stuff
1557-
tempvars = {};
1558-
(dlow, stateSets, uniqueEqIndex, tempvars, numStateSets) = createStateSets(dlow, {}, uniqueEqIndex, tempvars);
1559-
15601556
// inline solver stuff
1561-
(inlineEquations, uniqueEqIndex, tempvars) = createInlineSolverEqns(inlineDAE, uniqueEqIndex, tempvars);
1557+
(inlineEquations, uniqueEqIndex, tempvars) = createInlineSolverEqns(inlineDAE, uniqueEqIndex, {});
15621558

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

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

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

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

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

1596+
// state set stuff
1597+
(dlow, stateSets, uniqueEqIndex, tempvars, numStateSets) = createStateSets(dlow, {}, uniqueEqIndex, tempvars);
1598+
1599+
// create model info
1600+
modelInfo = createModelInfo(class_, dlow, functions, {}, numberOfInitialEquations, numberOfInitialAlgorithms, numStateSets, fileDir, ifcpp);
1601+
modelInfo = addTempVars(tempvars, modelInfo);
1602+
1603+
16031604
// update indexNonLinear in SES_NONLINEAR and count
16041605
SymbolicJacs = {};
16051606
(initialEquations, numberofLinearSys, numberofNonLinearSys, numberofMixedSys, SymbolicJacsTemp) = countandIndexAlgebraicLoops(initialEquations, 0, 0, 0, {});
@@ -1628,7 +1629,8 @@ algorithm
16281629
odeEquations = List.mapList1_1(odeEquations, setSystemIndexMap, systemIndexMap);
16291630
algebraicEquations = List.mapList1_1(algebraicEquations, setSystemIndexMap, systemIndexMap);
16301631
numberofEqns = uniqueEqIndex; /* This is a *much* better estimate than the guessed number of equations */
1631-
1632+
1633+
// create model info
16321634
modelInfo = addNumEqnsandNumofSystems(modelInfo, numberofEqns, numberofLinearSys, numberofNonLinearSys, numberofMixedSys);
16331635

16341636
// replace div operator with div operator with check of Division by zero

Compiler/Template/SimCodeDump.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ template dumpSimCodeBase(SimCode code, Boolean withOperations)
5151
<%dumpVars(vars.extObjVars,withOperations)%>
5252
<%dumpVars(vars.constVars,withOperations)%>
5353
</variables>
54-
<jacobian-equations>
55-
<%dumpEqs(SimCodeUtil.sortEqSystems(collectAllJacobianEquations(jacobianMatrixes)),withOperations)%>
56-
</jacobian-equations>
5754
<initial-equations size="<%listLength(initialEquations)%>">
5855
<%dumpEqs(SimCodeUtil.sortEqSystems(initialEquations),withOperations)%>
5956
</initial-equations>
@@ -72,6 +69,9 @@ template dumpSimCodeBase(SimCode code, Boolean withOperations)
7269
<assertions size="<%listLength(algorithmAndEquationAsserts)%>">
7370
<%dumpEqs(SimCodeUtil.sortEqSystems(algorithmAndEquationAsserts),withOperations)%>
7471
</assertions>
72+
<jacobian-equations>
73+
<%dumpEqs(SimCodeUtil.sortEqSystems(collectAllJacobianEquations(jacobianMatrixes)),withOperations)%>
74+
</jacobian-equations>
7575
<literals size="<%listLength(literals)%>">
7676
<% literals |> exp => '<exp><%printExpStrEscaped(exp)%></exp>' ; separator="\n" %>
7777
</literals>

0 commit comments

Comments
 (0)