Skip to content

Commit

Permalink
- Added simplify rules for change(constant) and edge(constant)
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@8997 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed May 13, 2011
1 parent b93a1ba commit a3ddf9c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Compiler/FrontEnd/ExpressionSimplify.mo
Expand Up @@ -155,7 +155,7 @@ algorithm
equation
true = Util.listFold(Util.listMap(expl,Expression.isConst),boolAnd,true);
e2 = simplifyBuiltinConstantCalls(DAE.CALL(fn,expl,tpl,builtin,tp,inlineType));
then
then
((e2,true));

// simplify some builtin calls, like cross, etc
Expand Down Expand Up @@ -714,16 +714,21 @@ algorithm
// der(constant) ==> 0
case (DAE.CALL(path=Absyn.IDENT("der"),expLst ={e}))
equation
true = Expression.isConst(e);
e1 = simplifyBuiltinConstantDer(e);
then e1;

// pre(constant) ==> constant
case (DAE.CALL(path=Absyn.IDENT("pre"),expLst ={e}))
equation
true = Expression.isConst(e);
then e;

// edge(constant) ==> false
case (DAE.CALL(path=Absyn.IDENT("edge"),expLst ={e}))
then DAE.BCONST(false);

// edge(constant) ==> false
case (DAE.CALL(path=Absyn.IDENT("change"),expLst ={e}))
then DAE.BCONST(false);

// sqrt function
case(DAE.CALL(path=Absyn.IDENT("sqrt"),expLst={e}))
equation
Expand Down

0 comments on commit a3ddf9c

Please sign in to comment.