Skip to content
This repository has been archived by the owner on May 18, 2019. It is now read-only.

Commit

Permalink
[BE]apply simplifyIfEquations on initial equations
Browse files Browse the repository at this point in the history
  • Loading branch information
kabdelhak authored and OpenModelica-Hudson committed Jan 28, 2019
1 parent eb421e8 commit db18f0d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Compiler/BackEnd/BackendDAEOptimize.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2226,19 +2226,27 @@ algorithm
(osyst,oshared) := matchcontinue (isyst, ishared)
local
BackendDAE.Variables vars, globalKnownVars;
BackendDAE.EquationArray eqns;
BackendDAE.EquationArray eqns, initialEqs;
list<BackendDAE.Equation> eqnslst, asserts;
BackendDAE.EqSystem syst;
BackendDAE.Shared shared;
Boolean systChanged;

case ( syst as BackendDAE.EQSYSTEM(orderedEqs=eqns),
shared as BackendDAE.SHARED(globalKnownVars=globalKnownVars) )
shared as BackendDAE.SHARED(globalKnownVars=globalKnownVars, initialEqs=initialEqs) )
algorithm
// traverse the equations
eqnslst := BackendEquation.equationList(eqns);
// traverse equations in reverse order, than branch equations of if equaitions need no reverse
((eqnslst,asserts,true)) := List.fold31(listReverse(eqnslst), simplifyIfEquationsFinder, globalKnownVars, {},{},false);
((eqnslst,asserts,systChanged)) := List.fold31(listReverse(eqnslst), simplifyIfEquationsFinder, globalKnownVars, {},{},false);
syst.orderedEqs := BackendEquation.listEquation(eqnslst);

// traverse the initial equations
eqnslst := BackendEquation.equationList(initialEqs);
// traverse equations in reverse order, than branch equations of if equaitions need no reverse
((eqnslst,asserts,true)) := List.fold31(listReverse(eqnslst), simplifyIfEquationsFinder, globalKnownVars, {},{},systChanged);
shared.initialEqs := BackendEquation.listEquation(eqnslst);

syst := BackendDAEUtil.clearEqSyst(syst);
syst := BackendEquation.requationsAddDAE(asserts, syst);
then (syst, shared);
Expand Down

0 comments on commit db18f0d

Please sign in to comment.