Skip to content

Commit

Permalink
make clockIndex optional instead of 0
Browse files Browse the repository at this point in the history
  • Loading branch information
rfranke committed Oct 16, 2015
1 parent 4002cbd commit f1a8433
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Compiler/SimCode/SimCodeUtil.mo
Expand Up @@ -661,7 +661,7 @@ public function getClockIndex "author: rfranke
Returns the index of the clock of a variable or zero non-clocked variables"
input SimCodeVar.SimVar simVar;
input SimCode.SimCode simCode;
output Integer clockIndex;
output Option<Integer> clockIndex;
protected
DAE.ComponentRef cref;
HashTable.HashTable clkHT;
Expand All @@ -670,8 +670,8 @@ algorithm
clockIndex := match simCode
case SimCode.SIMCODE(crefToClockIndexHT=clkHT) then
if BaseHashTable.hasKey(cref, clkHT)
then BaseHashTable.get(cref, clkHT)
else 0;
then SOME(BaseHashTable.get(cref, clkHT))
else NONE();
end match;
end getClockIndex;

Expand Down
2 changes: 1 addition & 1 deletion Compiler/Template/CodegenFMUCommon.tpl
Expand Up @@ -448,7 +448,7 @@ match simVar
<<
name="<%System.stringReplace(crefStrNoUnderscore(name),"$", "_D_")%>"
valueReference="<%valueReference%>"
<%if boolNot(stringEq(clockIndex, "0")) then 'clockIndex="'+clockIndex+'"' %>
<%if boolNot(stringEq(clockIndex, "")) then 'clockIndex="'+clockIndex+'"' %>
<%if boolNot(stringEq(previous, "")) then 'previous="'+previous+'"' %>
<%description%>
variability="<%variability%>"
Expand Down
2 changes: 1 addition & 1 deletion Compiler/Template/SimCodeTV.mo
Expand Up @@ -842,7 +842,7 @@ package SimCodeUtil
function getClockIndex
input SimCodeVar.SimVar simVar;
input SimCode.SimCode simCode;
output Integer clockIndex;
output Option<Integer> clockIndex;
end getClockIndex;

function computeDependencies
Expand Down

0 comments on commit f1a8433

Please sign in to comment.