Skip to content

Commit

Permalink
Fixed ticket 2659
Browse files Browse the repository at this point in the history
Fixed handling of initial equations that are stored in the shared
objects removedEqs.
  • Loading branch information
lochel authored and OpenModelica-Hudson committed Sep 21, 2015
1 parent 76217d2 commit 805ce17
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Compiler/BackEnd/Initialization.mo
Expand Up @@ -138,6 +138,7 @@ algorithm
vars := BackendVariable.rehashVariables(vars);
fixvars := BackendVariable.rehashVariables(fixvars);
shared := BackendDAEUtil.createEmptyShared(BackendDAE.INITIALSYSTEM(), dae.shared.info, dae.shared.cache, dae.shared.graph);
shared.removedEqs := inDAE.shared.removedEqs;
shared := BackendDAEUtil.setSharedKnVars(shared, fixvars);
shared := BackendDAEUtil.setSharedOptimica(shared, dae.shared.constraints, dae.shared.classAttrs);
shared := BackendDAEUtil.setSharedFunctionTree(shared, dae.shared.functionTree);
Expand Down Expand Up @@ -2326,10 +2327,22 @@ end collectInitialBindings;
public function removeInitializationStuff
input BackendDAE.BackendDAE inDAE;
output BackendDAE.BackendDAE outDAE = inDAE;
protected
list<BackendDAE.Equation> removedEqsList = {};
BackendDAE.Shared shared = inDAE.shared;
algorithm
for eqs in outDAE.eqs loop
_ := BackendDAEUtil.traverseBackendDAEExpsEqnsWithUpdate(eqs.orderedEqs, removeInitializationStuff1, false);
end for;

for eq in BackendEquation.equationList(shared.removedEqs) loop
removedEqsList := match BackendEquation.equationKind(eq)
case BackendDAE.INITIAL_EQUATION() then removedEqsList;
else eq::removedEqsList;
end match;
end for;
shared.removedEqs := BackendEquation.listEquation(listReverse(removedEqsList));
outDAE.shared := shared;
end removeInitializationStuff;

protected function removeInitializationStuff1
Expand Down

0 comments on commit 805ce17

Please sign in to comment.