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

Commit

Permalink
[NF] Port inStream changes from #2319.
Browse files Browse the repository at this point in the history
- Port the changes made to inStream in the old frontend to the new,
  in particular setting the Global.isInStream global root to avoid
  the backend failing when trying to access it.

Belonging to [master]:
  - #2329
  - OpenModelica/OpenModelica-testsuite#907
  • Loading branch information
perost authored and OpenModelica-Hudson committed Mar 28, 2018
1 parent a4776a6 commit 9edd1f5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Compiler/NFFrontEnd/NFBuiltinFuncs.mo
Expand Up @@ -214,6 +214,10 @@ constant Function MAX_REAL = Function.FUNCTION(Path.IDENT("max"),
InstNode.EMPTY_NODE(), {REAL_PARAM, REAL_PARAM}, {REAL_PARAM}, {}, {},
Type.REAL(), DAE.FUNCTION_ATTRIBUTES_BUILTIN, Pointer.createImmutable(true));

constant Function POSITIVE_MAX_REAL = Function.FUNCTION(Path.IDENT("$OMC$PositiveMax"),
InstNode.EMPTY_NODE(), {REAL_PARAM, REAL_PARAM}, {REAL_PARAM}, {}, {},
Type.REAL(), DAE.FUNCTION_ATTRIBUTES_BUILTIN, Pointer.createImmutable(true));

constant Function IN_STREAM = Function.FUNCTION(Path.IDENT("inStream"),
InstNode.EMPTY_NODE(), {REAL_PARAM}, {REAL_PARAM}, {}, {},
Type.REAL(), DAE.FUNCTION_ATTRIBUTES_BUILTIN, Pointer.createImmutable(true));
Expand Down
7 changes: 6 additions & 1 deletion Compiler/NFFrontEnd/NFConnectEquations.mo
Expand Up @@ -60,6 +60,7 @@ import NFInstNode.InstNode;
import NFClass.Class;
import Binding = NFBinding;
import NFFunction.Function;
import Global;

constant Expression EQ_ASSERT_STR =
Expression.STRING("Connected constants/parameters must be equal");
Expand All @@ -78,6 +79,8 @@ protected
potFunc potfunc;
Expression flowThreshold;
algorithm
setGlobalRoot(Global.isInStream, NONE());

//potfunc := if Config.orderConnections() then
// generatePotentialEquationsOrdered else generatePotentialEquations;
potfunc := generatePotentialEquations;
Expand Down Expand Up @@ -528,8 +531,10 @@ algorithm
flow_threshold := flowThreshold;
end if;

positiveMaxCall := Expression.CALL(Call.makeBuiltinCall(NFBuiltinFuncs.MAX_REAL,
positiveMaxCall := Expression.CALL(Call.makeBuiltinCall(NFBuiltinFuncs.POSITIVE_MAX_REAL,
{flowExp, flow_threshold}));

setGlobalRoot(Global.isInStream, SOME(true));
end makePositiveMaxCall;

function evaluateOperatorExp
Expand Down

0 comments on commit 9edd1f5

Please sign in to comment.