File tree Expand file tree Collapse file tree 3 files changed +59
-1
lines changed
OMCompiler/Compiler/NFFrontEnd
testsuite/flattening/modelica/scodeinst Expand file tree Collapse file tree 3 files changed +59
-1
lines changed Original file line number Diff line number Diff line change @@ -1003,7 +1003,11 @@ algorithm
10031003 guard Expression . variability(outExp. condition) <= Variability . PARAMETER
10041004 algorithm
10051005 cond := Ceval . tryEvalExp(outExp. condition);
1006- Structural . markExp(outExp. condition);
1006+
1007+ // Only mark the condition as structural if it could be evaluated.
1008+ if not referenceEq(cond, outExp. condition) then
1009+ Structural . markExp(outExp. condition);
1010+ end if ;
10071011 then
10081012 match cond
10091013 case Expression . BOOLEAN () then splitRecordCref(if cond. value then outExp. trueBranch else outExp. falseBranch);
Original file line number Diff line number Diff line change 1+ // name: CevalBinding9
2+ // status: correct
3+ // cflags: -d=newInst
4+ //
5+ //
6+
7+ pure function ext_fun
8+ input Real u1;
9+ output Real y;
10+ external "C" ;
11+ end ext_fun;
12+
13+ model Pump
14+ parameter Real m_flow_nominal;
15+ parameter Integer nOri = 2 ;
16+ parameter Real V_flow = 2.0 * m_flow_nominal;
17+ final parameter power pow = if V_flow < 0 then power(V_flow= 1 ) else power(V_flow= 2 );
18+ end Pump;
19+
20+ record power
21+ parameter Real V_flow = 0 ;
22+ end power;
23+
24+ model CevalBinding9
25+ Pump pumHeaPum(m_flow_nominal = Q);
26+ parameter Real T = 0 ;
27+ parameter Real Q = ext_fun(T);
28+ end CevalBinding9;
29+
30+ // Result:
31+ // function ext_fun
32+ // input Real u1;
33+ // output Real y;
34+ //
35+ // external "C" y = ext_fun(u1);
36+ // end ext_fun;
37+ //
38+ // function power "Automatically generated record constructor for power"
39+ // input Real V_flow = 0.0;
40+ // output power res;
41+ // end power;
42+ //
43+ // class CevalBinding9
44+ // parameter Real pumHeaPum.m_flow_nominal = Q;
45+ // parameter Integer pumHeaPum.nOri = 2;
46+ // parameter Real pumHeaPum.V_flow = 2.0 * pumHeaPum.m_flow_nominal;
47+ // final parameter Real pumHeaPum.pow.V_flow(fixed = false);
48+ // parameter Real T = 0.0;
49+ // parameter Real Q = ext_fun(T);
50+ // initial equation
51+ // pumHeaPum.pow = if pumHeaPum.V_flow < 0.0 then power(1.0) else power(2.0);
52+ // end CevalBinding9;
53+ // endResult
Original file line number Diff line number Diff line change @@ -126,6 +126,7 @@ CevalBinding5.mo \
126126CevalBinding6.mo \
127127CevalBinding7.mo \
128128CevalBinding8.mo \
129+ CevalBinding9.mo \
129130CevalConstant1.mo \
130131CevalCeil1.mo \
131132CevalCos1.mo \
You can’t perform that action at this time.
0 commit comments