Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Compiler/NFFrontEnd/NFConvertDAE.mo
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ algorithm
unrollForLoop(eq.iterator, body, elements);

case Equation.IF()
then convertIfEquation(eq.branches, eq.info, isInitial = false) :: elements;
then convertIfEquation(eq.branches, eq.info, isInitial = true) :: elements;

case Equation.ASSERT()
algorithm
Expand Down
7 changes: 5 additions & 2 deletions Compiler/NFFrontEnd/NFScalarize.mo
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,11 @@ algorithm
end if;
end for;

// Add the scalarized if equation to the list of equations if we got this far.
equations := Equation.IF(listReverseInPlace(bl), info) :: equations;
// Add the scalarized if equation to the list of equations if we got this far,
// and there are any branches still remaining.
if not listEmpty(bl) then
equations := Equation.IF(listReverseInPlace(bl), info) :: equations;
end if;
end scalarizeIfEquation;

function scalarizeBranch
Expand Down
11 changes: 11 additions & 0 deletions Compiler/NFFrontEnd/NFSimplifyExp.mo
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,17 @@ algorithm
case Operator.GREATEREQ() then Expression.BOOLEAN(r1 >= r2);
end match;

case Expression.RELATION(exp1 = Expression.ENUM_LITERAL(index = i1),
exp2 = Expression.ENUM_LITERAL(index = i2))
then Expression.BOOLEAN(match exp.operator
case Operator.LESS() then i1 < i2;
case Operator.LESSEQ() then i1 <= i2;
case Operator.GREATER() then i1 > i2;
case Operator.GREATEREQ() then i1 >= i2;
case Operator.EQUAL() then i1 == i2;
case Operator.NEQUAL() then i1 <> i2;
end match);

case Expression.IF(condition=Expression.BOOLEAN(value=b1))
then if b1 then exp.trueBranch else exp.falseBranch;

Expand Down