Skip to content

Commit

Permalink
Improve if-equation branch selection.
Browse files Browse the repository at this point in the history
- Mark conditions in if-equations as structural if they're non-fixed
  parameter expressions after evaluating connection operators.
  • Loading branch information
perost committed Nov 6, 2020
1 parent 6c61006 commit 8f3ec36
Showing 1 changed file with 35 additions and 4 deletions.
39 changes: 35 additions & 4 deletions OMCompiler/Compiler/NFFrontEnd/NFFlatten.mo
Expand Up @@ -1532,12 +1532,43 @@ function evaluateEquationsConnOp
input array<list<Connector>> setsArray;
input CardinalityTable.Table ctable;
algorithm
equations := list(
Equation.mapExp(eq,
function ConnectEquations.evaluateOperators(sets = sets, setsArray = setsArray, ctable = ctable))
for eq in equations);
equations := list(evaluateEquationConnOp(eq, sets, setsArray, ctable) for eq in equations);
end evaluateEquationsConnOp;

function evaluateEquationConnOp
input output Equation eq;
input ConnectionSets.Sets sets;
input array<list<Connector>> setsArray;
input CardinalityTable.Table ctable;
algorithm
eq := Equation.mapExp(eq,
function ConnectEquations.evaluateOperators(sets = sets, setsArray = setsArray, ctable = ctable));

() := match eq
case Equation.IF()
algorithm
for b in eq.branches loop
() := match b
case Equation.Branch.BRANCH()
algorithm
if b.conditionVar == Variability.PARAMETER and not
Structural.isExpressionNotFixed(b.condition, maxDepth = 100)
then
Structural.markExp(b.condition);
end if;
then
();

else ();
end match;
end for;
then
();

else ();
end match;
end evaluateEquationConnOp;

function resolveArrayConnections
"Generates the connect equations and adds them to the equation list"
input output FlatModel flatModel;
Expand Down

0 comments on commit 8f3ec36

Please sign in to comment.