Skip to content

Commit dd34e69

Browse files
committed
- Changed SimCode.SES_SIMPLE_ASSIGN.cref to a ComponentRef instead of Exp
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@5927 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent a6b7fd4 commit dd34e69

File tree

8 files changed

+240
-10663
lines changed

8 files changed

+240
-10663
lines changed

Compiler/DAELow.mo

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16615,12 +16615,11 @@ algorithm
1661516615
end crefPrefixDer;
1661616616

1661716617
public function makeDerCref
16618-
"Appends $DER to a cref and constructs a DAE.CREF from the resulting cref."
16618+
"Appends $DER to a cref and constructs a DAE.CREF_QUAL from the resulting cref."
1661916619
input DAE.ComponentRef inCref;
16620-
output DAE.Exp outCref;
16620+
output DAE.ComponentRef outCref;
1662116621
algorithm
16622-
outCref := DAE.CREF(DAE.CREF_QUAL("$DER", DAE.ET_REAL(), {}, inCref),
16623-
DAE.ET_REAL());
16622+
outCref := DAE.CREF_QUAL("$DER", DAE.ET_REAL(), {}, inCref);
1662416623
end makeDerCref;
1662516624

1662616625
public function equationSource "Retrieve the source from a DAELow equation"

Compiler/SimCode.mo

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ uniontype SimEqSystem
303303
DAE.Exp exp;
304304
end SES_RESIDUAL;
305305
record SES_SIMPLE_ASSIGN
306-
DAE.Exp cref;
306+
DAE.ComponentRef cref;
307307
DAE.Exp exp;
308308
end SES_SIMPLE_ASSIGN;
309309
record SES_ARRAY_CALL_ASSIGN
@@ -2222,18 +2222,18 @@ algorithm
22222222
varexp = DAE.CREF(cr,DAE.ET_REAL());
22232223
exp_ = solve(e1, e2, varexp);
22242224
then
2225-
SES_SIMPLE_ASSIGN(varexp, exp_);
2225+
SES_SIMPLE_ASSIGN(cr, exp_);
22262226
/* single equation: state */
22272227
case (eqNum,
22282228
DAELow.DAELOW(orderedVars=vars, orderedEqs=eqns),
22292229
ass1, ass2, helpVarInfo)
22302230
equation
22312231
(DAELow.EQUATION(e1, e2,_), v as DAELow.VAR(varName = cr, varKind = DAELow.STATE()))
22322232
= getEquationAndSolvedVar(eqNum, eqns, vars, ass2);
2233-
varexp = DAELow.makeDerCref(cr);
2234-
exp_ = solve(e1, e2, varexp);
2233+
cr = DAELow.makeDerCref(cr);
2234+
exp_ = solve(e1, e2, DAE.CREF(cr,DAE.ET_REAL()));
22352235
then
2236-
SES_SIMPLE_ASSIGN(varexp, exp_);
2236+
SES_SIMPLE_ASSIGN(cr, exp_);
22372237
/* non-state non-linear */
22382238
case (e,
22392239
DAELow.DAELOW(orderedVars=vars,orderedEqs=eqns,arrayEqs=ae),
@@ -2765,7 +2765,7 @@ algorithm
27652765
expr = solve(e1, e2, varexp);
27662766
restEqs = extractDiscEqs(eqns, vs);
27672767
then
2768-
SES_SIMPLE_ASSIGN(varexp, expr) :: restEqs;
2768+
SES_SIMPLE_ASSIGN(cr, expr) :: restEqs;
27692769
end matchcontinue;
27702770
end extractDiscEqs;
27712771

@@ -3041,9 +3041,9 @@ algorithm
30413041
expLst = {DAE.CREF(componentRef = cr)}),
30423042
NONE()))
30433043
equation
3044-
cref_exp = DAELow.makeDerCref(cr);
3044+
cr = DAELow.makeDerCref(cr);
30453045
then
3046-
((cref_exp, NONE()));
3046+
((DAE.CREF(cr,DAE.ET_REAL()), NONE()));
30473047
case (_) then inExp;
30483048
end matchcontinue;
30493049
end replaceDerOpInExpTraverser;
@@ -3939,7 +3939,7 @@ algorithm
39393939
DAE.ComponentRef cr;
39403940
DAE.Exp exp_;
39413941
case (DAELow.SOLVED_EQUATION(cr, exp_, _))
3942-
then SES_SIMPLE_ASSIGN(DAE.CREF(cr, DAE.ET_REAL()), exp_);
3942+
then SES_SIMPLE_ASSIGN(cr, exp_);
39433943
case (DAELow.RESIDUAL_EQUATION(exp_, _))
39443944
then SES_RESIDUAL(exp_);
39453945
end matchcontinue;
@@ -7204,11 +7204,11 @@ algorithm
72047204
(e,divLst) = DAELow.addDivExpErrorMsgtoExp(e,inDlowMode);
72057205
then
72067206
(SES_RESIDUAL(e),divLst);
7207-
case (SES_SIMPLE_ASSIGN(cref = e2, exp = e),inDlowMode)
7207+
case (SES_SIMPLE_ASSIGN(cref = cr, exp = e),inDlowMode)
72087208
equation
72097209
(e,divLst) = DAELow.addDivExpErrorMsgtoExp(e,inDlowMode);
72107210
then
7211-
(SES_SIMPLE_ASSIGN(e2, e),divLst);
7211+
(SES_SIMPLE_ASSIGN(cr, e),divLst);
72127212
case (SES_ARRAY_CALL_ASSIGN(componentRef = cr, exp = e),inDlowMode)
72137213
equation
72147214
(e,divLst) = DAELow.addDivExpErrorMsgtoExp(e,inDlowMode);

Compiler/SimCodeC.mo

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3987,12 +3987,12 @@ algorithm
39873987
SimCode.SES_SIMPLE_ASSIGN(cref = i_cref) :: rest )
39883988
local
39893989
list<SimCode.SimEqSystem> rest;
3990-
DAE.Exp i_cref;
3990+
DAE.ComponentRef i_cref;
39913991
equation
39923992
txt = Tpl.writeTok(txt, Tpl.ST_STRING("if (sim_verbose) { printf(\"Setting variable start value: %s(start=%f)\\n\", \""));
3993-
txt = expCref(txt, i_cref);
3993+
txt = cref(txt, i_cref);
39943994
txt = Tpl.writeTok(txt, Tpl.ST_STRING("\", "));
3995-
txt = expCref(txt, i_cref);
3995+
txt = cref(txt, i_cref);
39963996
txt = Tpl.writeTok(txt, Tpl.ST_STRING("); }"));
39973997
txt = Tpl.nextIter(txt);
39983998
txt = lm_99(txt, rest);
@@ -5053,7 +5053,7 @@ algorithm
50535053
i_context,
50545054
i_varDecls )
50555055
local
5056-
DAE.Exp i_cref;
5056+
DAE.ComponentRef i_cref;
50575057
DAE.Exp i_exp;
50585058
Tpl.Text i_expPart;
50595059
Tpl.Text i_preExp;
@@ -5062,7 +5062,7 @@ algorithm
50625062
(i_expPart, i_preExp, i_varDecls) = daeExp(emptyTxt, i_exp, i_context, i_preExp, i_varDecls);
50635063
txt = Tpl.writeText(txt, i_preExp);
50645064
txt = Tpl.softNewLine(txt);
5065-
txt = expCref(txt, i_cref);
5065+
txt = cref(txt, i_cref);
50665066
txt = Tpl.writeTok(txt, Tpl.ST_STRING(" = "));
50675067
txt = Tpl.writeText(txt, i_expPart);
50685068
txt = Tpl.writeTok(txt, Tpl.ST_STRING(";"));
@@ -5536,14 +5536,14 @@ algorithm
55365536
i_context )
55375537
local
55385538
list<SimCode.SimEqSystem> rest;
5539-
DAE.Exp i_cref;
5539+
DAE.ComponentRef i_cref;
55405540
DAE.Exp i_exp;
55415541
Integer i_i0;
55425542
Tpl.Text i_expPart;
55435543
equation
55445544
i_i0 = Tpl.getIteri_i0(txt);
55455545
(i_expPart, i_preDisc, i_varDecls) = daeExp(emptyTxt, i_exp, i_context, i_preDisc, i_varDecls);
5546-
txt = expCref(txt, i_cref);
5546+
txt = cref(txt, i_cref);
55475547
txt = Tpl.writeTok(txt, Tpl.ST_STRING(" = "));
55485548
txt = Tpl.writeText(txt, i_expPart);
55495549
txt = Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
@@ -5552,7 +5552,7 @@ algorithm
55525552
}, false));
55535553
txt = Tpl.writeStr(txt, intString(i_i0));
55545554
txt = Tpl.writeTok(txt, Tpl.ST_STRING("] = "));
5555-
txt = expCref(txt, i_cref);
5555+
txt = cref(txt, i_cref);
55565556
txt = Tpl.writeTok(txt, Tpl.ST_STRING(";"));
55575557
txt = Tpl.nextIter(txt);
55585558
(txt, i_varDecls, i_preDisc) = lm_134(txt, rest, i_varDecls, i_preDisc, i_context);

0 commit comments

Comments
 (0)