Skip to content

Commit

Permalink
Fix derivation rule of pre calls
Browse files Browse the repository at this point in the history
  • Loading branch information
lochel authored and OpenModelica-Hudson committed May 17, 2017
1 parent 0042521 commit 7b440a1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Compiler/BackEnd/Differentiate.mo
Expand Up @@ -1373,10 +1373,6 @@ algorithm

String s1, s2, serr, matrixName, name;

case (e as DAE.CALL(path=Absyn.IDENT(name = "pre")), _, _, _, _)
then
(e, inFunctionTree);

case (e as DAE.CALL(path=Absyn.IDENT(name = "previous")), _, _, _, _) equation
tp = Expression.typeof(e);
zero = Expression.makeZeroExpression(Expression.arrayDimension(tp));
Expand Down Expand Up @@ -1480,6 +1476,12 @@ algorithm
DAE.Type tp;
list<DAE.Exp> expl;

case ("pre",_) equation
tp = Expression.typeof(exp);
(exp_1, funcs) = differentiateExp(exp, inDiffwrtCref, inInputData,inDiffType,inFuncs, maxIter, expStack);
exp_2 = Expression.makePureBuiltinCall("pre", {exp_1}, tp);
then (exp_2, inFuncs);

case ("previous",_) equation
tp = Expression.typeof(exp);
exp_1 = Expression.makeZeroExpression(Expression.arrayDimension(tp));
Expand Down

0 comments on commit 7b440a1

Please sign in to comment.