Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit 0042521

Browse files
lochelOpenModelica-Hudson
authored andcommitted
Fix derivation of previous calls
1 parent 9492f9e commit 0042521

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Compiler/BackEnd/Differentiate.mo

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,9 +1377,10 @@ algorithm
13771377
then
13781378
(e, inFunctionTree);
13791379

1380-
case (e as DAE.CALL(path=Absyn.IDENT(name = "previous")), _, _, _, _)
1381-
then
1382-
(e, inFunctionTree);
1380+
case (e as DAE.CALL(path=Absyn.IDENT(name = "previous")), _, _, _, _) equation
1381+
tp = Expression.typeof(e);
1382+
zero = Expression.makeZeroExpression(Expression.arrayDimension(tp));
1383+
then (zero, inFunctionTree);
13831384

13841385
case (DAE.CALL(path = path as Absyn.IDENT(name = "der"),expLst = {e},attr=attr), _, _, BackendDAE.DIFFERENTIATION_TIME(), _)
13851386
then
@@ -1479,7 +1480,11 @@ algorithm
14791480
DAE.Type tp;
14801481
list<DAE.Exp> expl;
14811482

1482-
case ("previous",_) then (exp, inFuncs);
1483+
case ("previous",_) equation
1484+
tp = Expression.typeof(exp);
1485+
exp_1 = Expression.makeZeroExpression(Expression.arrayDimension(tp));
1486+
then (exp_1, inFuncs);
1487+
14831488
case ("$getPart",_) then (exp, inFuncs);
14841489
case ("firstTick",_) then (exp, inFuncs);
14851490
case ("interval",_) then (exp, inFuncs);

0 commit comments

Comments
 (0)