Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
niklwors committed Oct 15, 2015
2 parents 3c084f6 + f34585c commit e26b2ab
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
9 changes: 5 additions & 4 deletions Compiler/FrontEnd/Expression.mo
Expand Up @@ -1547,22 +1547,23 @@ algorithm
end match;
end expInt;

public function getClockIntvl
public function getClockInterval
"Returns a real interval expression for any clock kind; 0.0 if unknown."
input DAE.ClockKind inClk;
output DAE.Exp outIntvl;
protected
DAE.Exp e;
Integer res;
algorithm
outIntvl := match inClk
case DAE.INFERRED_CLOCK()
then DAE.RCONST(1.0);
case DAE.REAL_CLOCK(e)
then e;
case DAE.INTEGER_CLOCK(e, res)
then DAE.BINARY(e, DAE.DIV(DAE.T_REAL_DEFAULT), DAE.ICONST(res));
else
then DAE.RCONST(0.0);
end match;
end getClockIntvl;
end getClockInterval;

public function expArrayIndex
"Returns the array index that an expression represents as an integer."
Expand Down
2 changes: 1 addition & 1 deletion Compiler/Template/CodegenC.tpl
Expand Up @@ -373,7 +373,7 @@ match baseClock
>>
else
let &preExp = buffer ""
let intvl = daeExp(getClockIntvl(baseClock), contextOther, &preExp, &varDecls, &auxFunction)
let intvl = daeExp(getClockInterval(baseClock), contextOther, &preExp, &varDecls, &auxFunction)
<<
<%preExp%>
data->simulationInfo.clocksData[i].interval = <%intvl%>;
Expand Down
4 changes: 2 additions & 2 deletions Compiler/Template/CodegenCpp.tpl
Expand Up @@ -9858,7 +9858,7 @@ template clockIntervalsInit(SimCode simCode, Text& varDecls, Text& extraFuncs, T
match partition
case CLOCKED_PARTITION(__) then
let &preExp = buffer "" /*BUFD*/
let intvl = daeExp(getClockIntvl(baseClock), contextOther, &preExp, &varDecls, simCode, &extraFuncs, &extraFuncsDecl, extraFuncsNamespace, stateDerVectorName, useFlatArrayNotation)
let intvl = daeExp(getClockInterval(baseClock), contextOther, &preExp, &varDecls, simCode, &extraFuncs, &extraFuncsDecl, extraFuncsNamespace, stateDerVectorName, useFlatArrayNotation)
<<
<%preExp%>
_clockInterval[<%i%>] = <%intvl%>;
Expand Down Expand Up @@ -10553,7 +10553,7 @@ template generateTimeEvent(list<BackendDAE.TimeEvent> timeEvents, SimCode simCod
match partition
case CLOCKED_PARTITION(__) then
let &preExp = buffer "" /*BUFD*/
let intvl = daeExp(getClockIntvl(baseClock), contextOther, &preExp, &varDecls, simCode, &extraFuncs, &extraFuncsDecl, extraFuncsNamespace, stateDerVectorName, useFlatArrayNotation)
let intvl = daeExp(getClockInterval(baseClock), contextOther, &preExp, &varDecls, simCode, &extraFuncs, &extraFuncsDecl, extraFuncsNamespace, stateDerVectorName, useFlatArrayNotation)
<<
<%preExp%>
time_events.push_back(std::make_pair(0.0, <%intvl%>));
Expand Down
4 changes: 2 additions & 2 deletions Compiler/Template/SimCodeTV.mo
Expand Up @@ -3111,10 +3111,10 @@ package Expression
output Boolean outB;
end isMetaArray;

function getClockIntvl
function getClockInterval
input DAE.ClockKind inClk;
output DAE.Exp outIntvl;
end getClockIntvl;
end getClockInterval;
end Expression;

package ExpressionDump
Expand Down

0 comments on commit e26b2ab

Please sign in to comment.