Skip to content

Commit

Permalink
Add replace rules for clock expressions
Browse files Browse the repository at this point in the history
ticket 3549
  • Loading branch information
lochel committed Nov 9, 2015
1 parent d465e48 commit ea54626
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Compiler/BackEnd/BackendVarTransform.mo
Expand Up @@ -1065,6 +1065,9 @@ algorithm
DAE.CallAttributes attr;
DAE.Ident ident;
HashTable2.HashTable derConst;
String solverMethod;
Integer resolution;
Real startInterval;

// Note: Most of these functions check if a subexpression did a replacement.
// If it did not, we do not create a new copy of the expression (to save some memory).
Expand Down Expand Up @@ -1157,6 +1160,30 @@ algorithm
(expl_1,true) = replaceExpList(expl, repl, cond, {}, false);
then
(DAE.CALL(path,expl_1,attr),true);
// INTEGER_CLOCK
case (DAE.CLKCONST(DAE.INTEGER_CLOCK(intervalCounter=e, resolution=resolution)), repl, cond)
equation
e = replaceExp(e, repl, cond);
then
(DAE.CLKCONST(DAE.INTEGER_CLOCK(e, resolution)), true);
// REAL_CLOCK
case (DAE.CLKCONST(DAE.REAL_CLOCK(interval=e)), repl, cond)
equation
e = replaceExp(e, repl, cond);
then
(DAE.CLKCONST(DAE.REAL_CLOCK(e)), true);
// BOOLEAN_CLOCK
case (DAE.CLKCONST(DAE.BOOLEAN_CLOCK(condition=e, startInterval=startInterval)), repl, cond)
equation
e = replaceExp(e, repl, cond);
then
(DAE.CLKCONST(DAE.BOOLEAN_CLOCK(e, startInterval)), true);
// SOLVER_CLOCK
case (DAE.CLKCONST(DAE.SOLVER_CLOCK(c=e, solverMethod=solverMethod)), repl, cond)
equation
e = replaceExp(e, repl, cond);
then
(DAE.CLKCONST(DAE.SOLVER_CLOCK(e, solverMethod)), true);
case ((e as DAE.PARTEVALFUNCTION(path,expl,tp,t)),repl,cond)
equation
true = replaceExpCond(cond, e);
Expand Down

0 comments on commit ea54626

Please sign in to comment.