Skip to content

Commit 26071c2

Browse files
author
Vitalij Ruge
committed
improved handling of not derivable function calls in ExpressionSolve
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@24867 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 6024074 commit 26071c2

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

Compiler/FrontEnd/Expression.mo

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3573,7 +3573,7 @@ public function makeWeightProduct
35733573
output DAE.Exp y;
35743574
protected
35753575
DAE.Type tp = typeof(w);
3576-
DAE.Exp z = makeConstZero(tp);
3576+
DAE.Exp z = makeConstZero(tp);
35773577
DAE.Exp con = DAE.RELATION(w,DAE.EQUAL(tp),z,-1,NONE());
35783578
algorithm
35793579
y := makeNoEvent(DAE.IFEXP(con,w,expMul(w,x)));
@@ -6103,36 +6103,43 @@ algorithm
61036103
(outExp,cont,outTpl) := matchcontinue(inExp,inTpl)
61046104
local
61056105
Boolean b;
6106+
Integer i;
61066107
ComponentRef cr;
61076108
DAE.Exp e1;
61086109

61096110
case(DAE.IFEXP(e1,_,_),(cr,false))
6111+
guard(not isFunCall(e1,"noEvent"))
61106112
equation
61116113
b = expHasCref(e1,cr);
6112-
then (e1,not b,(cr,b));
6113-
/*
6114-
case(DAE.CALL(path = Absyn.IDENT(name = "smooth"),expLst = {_,e1}),(cr,false))
6114+
then (e1, true,(cr,b));
6115+
6116+
case(DAE.CALL(path = Absyn.IDENT(name = "smooth"),expLst = {DAE.ICONST(i),e1}),(cr,false))
6117+
guard(i>1)
6118+
then (e1,true, (cr,true));
6119+
6120+
case(DAE.CALL(), (cr,false))
6121+
guard(isEventTriggeringFunctionExp(inExp))
61156122
equation
6116-
(b,_) = expHasCrefInIfWork(e1,inTpl);
6117-
then (e1, b,(cr,b));
6118-
*/
6123+
b = expHasCref(inExp, cr);
6124+
then(inExp, true,(cr,b));
6125+
61196126
case(DAE.CALL(path = Absyn.IDENT(name = "semiLinear"),expLst = {e1,_,_}),(cr,false))
61206127
equation
61216128
b = expHasCref(e1,cr);
6122-
then (e1, b,(cr,b));
6129+
then (e1, true,(cr,b));
61236130

61246131
case(DAE.CALL(path = Absyn.IDENT(name = "sign"),expLst = {e1}),(cr,false))
61256132
equation
61266133
b = expHasCref(e1,cr);
6127-
then (e1, b,(cr,b));
6134+
then (e1, not b,(cr,b));
61286135

6129-
case (_,(_,b)) then (inExp,not b,inTpl);
6136+
case (_, (_,true)) then (inExp,false,inTpl);
6137+
else (inExp, true, inTpl);
61306138

61316139
end matchcontinue;
61326140
end expHasCrefInIfWork;
61336141

61346142

6135-
61366143
public function traverseCrefsFromExp "
61376144
Author: Frenkel TUD 2011-05, traverses all ComponentRef from an Expression."
61386145
input DAE.Exp inExp;

0 commit comments

Comments
 (0)