Skip to content

Commit 41f85a5

Browse files
committed
Reactivated reverted clock adaptions
1 parent 5a18bd5 commit 41f85a5

File tree

18 files changed

+216
-88
lines changed

18 files changed

+216
-88
lines changed

Compiler/BackEnd/SynchronousFeatures.mo

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,9 @@ protected function createBoolClockWhenClauses
145145
output list<BackendDAE.Equation> outRemovedEqs = inRemovedEqs;
146146
protected
147147
BackendDAE.BasePartition basePartition;
148+
Integer subPartIdx; // this is the index of the base clock subpartitions in the flattened list of all subpartitions
148149
algorithm
150+
subPartIdx := 1;
149151
for i in 1:arrayLength(inShared.partitionsInfo.basePartitions) loop
150152
basePartition := inShared.partitionsInfo.basePartitions[i];
151153
outRemovedEqs := match basePartition.clock
@@ -155,12 +157,13 @@ algorithm
155157
BackendDAE.Equation eq;
156158
case DAE.BOOLEAN_CLOCK(c, _)
157159
equation
158-
e = DAE.CALL(Absyn.IDENT("$_clkfire"), {DAE.ICONST(i)}, DAE.callAttrBuiltinOther);
160+
e = DAE.CALL(Absyn.IDENT("$_clkfire"), {DAE.ICONST(subPartIdx)}, DAE.callAttrBuiltinOther);
159161
whenEq = BackendDAE.WHEN_STMTS(c, {BackendDAE.NORETCALL(e, DAE.emptyElementSource)}, NONE());
160162
eq = BackendDAE.WHEN_EQUATION(0, whenEq, DAE.emptyElementSource, BackendDAE.EQ_ATTR_DEFAULT_DYNAMIC);
161163
then eq::outRemovedEqs;
162164
else outRemovedEqs;
163165
end match;
166+
subPartIdx := subPartIdx + basePartition.nSubClocks; // the condition triggers the first clock in the list of subpartitions, i.e. the base clock
164167
end for;
165168
end createBoolClockWhenClauses;
166169

Compiler/SimCode/SimCode.mo

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ end ClockedPartition;
144144

145145
public uniontype SubPartition
146146
record SUBPARTITION
147+
Integer idx; //a unique index among all subpartitions
147148
list<tuple<SimCodeVar.SimVar, Boolean /*previous*/>> vars;
149+
list<SimEqSystem> previousAssignments; //equations to assign the $CLKPRE_* variables
148150
list<SimEqSystem> equations;
149151
list<SimEqSystem> removedEquations;
150152
BackendDAE.SubClock subClock;

Compiler/SimCode/SimCodeUtil.mo

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ algorithm
673673

674674
prevClockedVars := {};
675675
isPrevVar := arrayCreate(BackendVariable.varsSize(syst.orderedVars), false);
676-
676+
preEquations := {};
677677
for cr in subPartition.prevVars loop
678678
(_, varIxs) := BackendVariable.getVar(cr, syst.orderedVars);
679679
for i in varIxs loop
@@ -690,14 +690,14 @@ algorithm
690690
simVar.name := ComponentReference.crefPrefixPrevious(cr);
691691
clockedVars := simVar::clockedVars;
692692
simEq := SimCode.SES_SIMPLE_ASSIGN(ouniqueEqIndex, simVar.name, DAE.CREF(cr, simVar.type_), DAE.emptyElementSource);
693-
equations := simEq::equations;
693+
preEquations := simEq::preEquations;
694694
ouniqueEqIndex := ouniqueEqIndex + 1;
695695
end if;
696696
end for;
697697
GC.free(isPrevVar);
698698

699699
//otempvars := listAppend(clockedVars, otempvars);
700-
simSubPartition := SimCode.SUBPARTITION(prevClockedVars, equations, removedEquations, subPartition.clock, subPartition.holdEvents);
700+
simSubPartition := SimCode.SUBPARTITION(subPartIdx,prevClockedVars, preEquations, equations, removedEquations, subPartition.clock, subPartition.holdEvents);
701701

702702
assert(isNone(simSubPartitions[subPartIdx]), "SimCodeUtil.translateClockedEquations failed");
703703
arrayUpdate(simSubPartitions, subPartIdx, SOME(simSubPartition));
@@ -7843,13 +7843,13 @@ algorithm
78437843
simVars := List.map(subPart.vars,Util.tuple21);
78447844
arePrevious := List.map(subPart.vars,Util.tuple22);
78457845
simVarStrings := List.threadMap(List.map(simVars,simVarString), List.map(arePrevious,previousString),stringAppend);
7846-
str := "SubPartition Vars:\n"+UNDERLINE+"\n";
7846+
str := "SubPartition "+intString(subPart.idx)+"\nVars:\n"+UNDERLINE+"\n";
7847+
str := str + "SubClock:\n"+ BackendDump.subClockString(subPart.subClock);
78477848
str := str + stringDelimitList(simVarStrings,"\n")+"\n";
78487849
str := str + "partition equations:\n"+UNDERLINE+"\n";
78497850
str := str + stringDelimitList(List.map(subPart.equations,simEqSystemString),"\n");
78507851
str := str + "removedEquations equations:\n"+UNDERLINE+"\n";
78517852
str := str + stringDelimitList(List.map(subPart.removedEquations,simEqSystemString),"\n");
7852-
str := str + "SubClock:\n"+ BackendDump.subClockString(subPart.subClock);
78537853
str := str + "Hold Events: "+boolString(subPart.holdEvents);
78547854
end subPartitionString;
78557855

@@ -12903,5 +12903,12 @@ algorithm
1290312903
end match;
1290412904
end getInputIndex;
1290512905

12906+
public function getSubPartitionIdx
12907+
input SimCode.SubPartition sub;
12908+
output Integer idx;
12909+
algorithm
12910+
idx := sub.idx;
12911+
end getSubPartitionIdx;
12912+
1290612913
annotation(__OpenModelica_Interface="backend");
1290712914
end SimCodeUtil;

Compiler/Template/CodegenC.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,8 @@ template functionSystemsSynchronous(list<SubPartition> subPartitions, String mod
372372
::=
373373
let systs = subPartitions |> subPartition hasindex i =>
374374
match subPartition
375-
case SUBPARTITION(__) then
376-
functionEquationsSynchronous(i, vars, listAppend(equations, removedEquations), modelNamePrefix)
375+
case SUBPARTITION(equations=equations, previousAssignments=preveequations) then
376+
functionEquationsSynchronous(i, vars, listAppend(listAppend(previousAssignments,equations), removedEquations), modelNamePrefix)
377377
; separator = "\n"
378378
let cases = subPartitions |> subPartition hasindex i =>
379379
let name = 'functionEquationsSynchronous_system<%i%>'

Compiler/Template/CodegenCpp.tpl

Lines changed: 106 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3704,7 +3704,7 @@ match simCode
37043704
_dimZeroFunc = <%zeroCrossLength(simCode)%>;
37053705
_dimClock = <%listLength(getSubPartitions(clockedPartitions))%>;
37063706
// simplified treatment of clocks in model as time events
3707-
_dimTimeEvent = <%timeEventLength(simCode)%> + _dimClock;
3707+
_dimTimeEvent = <%timeEventLength(simCode)%> ;
37083708
//Number of residues
37093709
_event_handling= shared_ptr<EventHandling>(new EventHandling());
37103710
initializeAlgloopSolverVariables(); //if we do not initialize it here, we get a segfault in the destructor if initialization of Solver or OMFactory has failed
@@ -6829,7 +6829,7 @@ case SIMCODE(__) then
68296829
<<
68306830
<%equationFunctions(allEquations, simCode , &extraFuncs , &extraFuncsDecl, extraFuncsNamespace,contextSimulationDiscrete,stateDerVectorName,useFlatArrayNotation,boolNot(stringEq(getConfigString(PROFILING_LEVEL),"none")))%>
68316831

6832-
<%clockedFunctions(getSubPartitions(clockedPartitions), simCode, &extraFuncs, &extraFuncsDecl, extraFuncsNamespace, contextSimulationDiscrete, stateDerVectorName, useFlatArrayNotation, boolNot(stringEq(getConfigString(PROFILING_LEVEL), "none")))%>
6832+
<%clockedFunctions(clockedPartitions, simCode, &extraFuncs, &extraFuncsDecl, extraFuncsNamespace, contextSimulationDiscrete, stateDerVectorName, useFlatArrayNotation, boolNot(stringEq(getConfigString(PROFILING_LEVEL), "none")))%>
68336833

68346834
<%createEvaluateAll(allEquations, simCode , &extraFuncs , &extraFuncsDecl, extraFuncsNamespace,contextOther, stateDerVectorName, useFlatArrayNotation, boolNot(stringEq(getConfigString(PROFILING_LEVEL),"none")))%>
68356835

@@ -7260,11 +7260,11 @@ template generateClockedFuncDecls(list<SubPartition> subPartitions, Text method)
72607260
let decls = (subPartitions |> subPartition hasindex i fromindex 1 =>
72617261
match subPartition case SUBPARTITION(__) then
72627262
<<
7263-
/// Clocked partition <%i%>
7264-
void evaluateClocked<%i%>(const UPDATETYPE command);
7263+
/// Clocked partition <%getSubPartitionIdx(subPartition)%>
7264+
void evaluateClocked<%getSubPartitionIdx(subPartition)%>(const UPDATETYPE command);
7265+
void evaluateClockedAssignPrevious<%getSubPartitionIdx(subPartition)%>(const UPDATETYPE command);
72657266

7266-
7267-
<%generateEquationMemberFuncDecls(listAppend(equations, removedEquations), method)%>
7267+
<%generateEquationMemberFuncDecls(listAppend(listAppend(previousAssignments,equations), removedEquations), method)%>
72687268
>>
72697269
; separator="\n")
72707270
'<%decls%>'
@@ -9815,8 +9815,13 @@ case SIMCODE(modelInfo = MODELINFO(__), modelStructure = fmims) then
98159815
<%preExp%>
98169816
_clockInterval[<%i%>] = <%interval%> * <%fnom%>.0 / <%fres%>.0;
98179817
_clockShift[<%i%>] = <%snom%>.0 / <%sres%>.0;
9818-
_clockTime[<%i%>] = _simTime + _clockShift[<%i%>] * _clockInterval[<%i%>];
9819-
_clockStart[<%i%>] = true;
9818+
_clockTime[<%i%>] = _simTime + _clockShift[<%i%>] * _clockInterval[<%i%>];
9819+
if( _clockShift[<%i%>]>0)
9820+
_clockCondition[<%i%>] = false;
9821+
else
9822+
_clockCondition[<%i%>] =true;
9823+
_clockStart[<%i%>] = true;
9824+
98209825
<%i%> ++;
98219826
>>
98229827
; separator="\n")
@@ -10510,9 +10515,11 @@ template generateTimeEvent(list<BackendDAE.TimeEvent> timeEvents, SimCode simCod
1051010515
>>
1051110516
else ''
1051210517
;separator="\n\n")%>
10513-
// simplified treatment of clocks in model as time events
10518+
/* temporary deactivated: using state events for clocks
10519+
// simplified treatment of clocks in model as time events
1051410520
for (int i = 0; i < _dimClock; i++)
1051510521
time_events.push_back(std::make_pair(_clockShift[i] * _clockInterval[i], _clockInterval[i]));
10522+
*/
1051610523
}
1051710524
>>
1051810525
end generateTimeEvent;
@@ -12449,13 +12456,32 @@ template handleSystemEvents(list<ZeroCrossing> zeroCrossings, SimCode simCode ,T
1244912456
<<
1245012457
bool <%lastIdentOfPath(modelInfo.name)%>Mixed::handleSystemEvents(bool* events)
1245112458
{
12452-
_callType = IContinuous::DISCRETE;
12453-
1245412459
bool restart = true;
1245512460
bool state_vars_reinitialized = false;
1245612461
bool clock_event_detected = false;
1245712462

1245812463
int iter = 0;
12464+
//check for clock events
12465+
for(int i =0;i< _dimClock;i++)
12466+
{
12467+
if(events[_dimZeroFunc+i] )
12468+
{
12469+
clock_event_detected = true;
12470+
break;
12471+
}
12472+
}
12473+
//if there is a single clock event, update all clock conditions
12474+
if (clock_event_detected){
12475+
for(int i =0;i< _dimClock;i++){
12476+
if(_simTime +1e-9 > _clockTime[i]){
12477+
_clockCondition[i]=true;
12478+
}
12479+
}
12480+
evaluateAll();
12481+
}
12482+
12483+
if (clock_event_detected) return false;// no event iteration after clock tick handling
12484+
_callType = IContinuous::DISCRETE;
1245912485
while(restart && !(iter++ > 100))
1246012486
{
1246112487
bool st_vars_reinit = false;
@@ -12502,7 +12528,14 @@ template giveZeroFunc1(list<ZeroCrossing> zeroCrossings,SimCode simCode ,Text& e
1250212528
<%varDecls%>
1250312529
<%prexp%>
1250412530
<%zeroCrossingsCode%>
12531+
for(int i =0;i<_dimClock;i++)
12532+
{
1250512533

12534+
if((_simTime>0.0) && (_simTime < _clockTime[i]))
12535+
f[i+_dimZeroFunc]= (_simTime - _clockTime[i])- 1e-9;
12536+
else
12537+
f[i+_dimZeroFunc]=1.0;
12538+
}
1250612539

1250712540
}
1250812541
>>
@@ -12709,26 +12742,39 @@ template equationFunctions(list<SimEqSystem> allEquationsPlusWhen, SimCode simCo
1270912742
>>
1271012743
end equationFunctions;
1271112744

12712-
template clockedFunctions(list<SubPartition> subPartitions, SimCode simCode, Text& extraFuncs, Text& extraFuncsDecl, Text extraFuncsNamespace, Context context, Text stateDerVectorName /*=__zDot*/, Boolean useFlatArrayNotation, Boolean enableMeasureTime)
12745+
template clockedFunctions(list<ClockedPartition> clockedPartitions, SimCode simCode, Text& extraFuncs, Text& extraFuncsDecl, Text extraFuncsNamespace, Context context, Text stateDerVectorName /*=__zDot*/, Boolean useFlatArrayNotation, Boolean enableMeasureTime)
1271312746
"Evaluate clocked synchronous equations"
1271412747
::=
1271512748
let className = lastIdentOfPathFromSimCode(simCode, &extraFuncs, &extraFuncsDecl, extraFuncsNamespace)
1271612749

12717-
12750+
/*
1271812751
let parts = subPartitions |> subPartition hasindex i fromindex 1 =>
1271912752
match subPartition
1272012753
case SUBPARTITION(__) then
12721-
clockedPartFunctions(i, vars, listAppend(equations, removedEquations), simCode, &extraFuncs, &extraFuncsDecl, extraFuncsNamespace, contextSimulationDiscrete, stateDerVectorName, useFlatArrayNotation, enableMeasureTime)
12754+
clockedPartFunctions(i, vars, listAppend(equations, removedEquations), subPartition,simCode, &extraFuncs, &extraFuncsDecl, extraFuncsNamespace, contextSimulationDiscrete, stateDerVectorName, useFlatArrayNotation, enableMeasureTime)
1272212755
; separator = "\n"
12756+
*/
12757+
let parts =
12758+
(clockedPartitions |> partition hasindex i fromindex 1 =>
12759+
match partition
12760+
case CLOCKED_PARTITION(baseClock=clock) then
1272312761

12762+
let subClocks = (subPartitions |> subPartition hasindex j fromindex 1 =>
12763+
match subPartition
12764+
case SUBPARTITION(idx=idx, subClock=SUBCLOCK(factor=RATIONAL(nom=fnom, denom=fres), shift=RATIONAL(nom=snom, denom=sres))) then
12765+
clockedPartFunctions(idx, previousAssignments, listAppend(equations, removedEquations), clock,subClock,simCode, &extraFuncs, &extraFuncsDecl, extraFuncsNamespace, contextSimulationDiscrete, stateDerVectorName, useFlatArrayNotation, enableMeasureTime)
12766+
; separator="\n")
12767+
<<
12768+
<%subClocks%>
12769+
>>
12770+
; separator="\n")
1272412771

1272512772

1272612773

12727-
12728-
let cases = subPartitions |> subPartition hasindex i fromindex 1 =>
12774+
let cases = getSubPartitions(clockedPartitions) |> subPartition hasindex i fromindex 1 =>
1272912775
<<
12730-
case <%i%>:
12731-
evaluateClocked<%i%>(IContinuous::UNDEF_UPDATE);
12776+
case <%getSubPartitionIdx(subPartition)%>:
12777+
evaluateClocked<%getSubPartitionIdx(subPartition)%>(IContinuous::UNDEF_UPDATE);
1273212778
break;
1273312779
>>; separator = "\n"
1273412780
<<
@@ -12748,13 +12794,31 @@ template clockedFunctions(list<SubPartition> subPartitions, SimCode simCode, Te
1274812794
>>
1274912795
end clockedFunctions;
1275012796

12751-
template clockedPartFunctions(Integer i, list<tuple<SimCodeVar.SimVar, Boolean>> vars, list<SimEqSystem> equations,SimCode simCode, Text& extraFuncs, Text& extraFuncsDecl, Text extraFuncsNamespace, Context context, Text stateDerVectorName /*=__zDot*/, Boolean useFlatArrayNotation, Boolean enableMeasureTime)
12797+
template clockedPartFunctions(Integer i, list<SimEqSystem> previousAssignments, list<SimEqSystem> equations,DAE.ClockKind baseClock,BackendDAE.SubClock subClock,SimCode simCode, Text& extraFuncs, Text& extraFuncsDecl, Text extraFuncsNamespace, Context context, Text stateDerVectorName /*=__zDot*/, Boolean useFlatArrayNotation, Boolean enableMeasureTime)
1275212798
"Evaluate functions that belong to a clocked partition"
1275312799
::=
1275412800
let className = lastIdentOfPathFromSimCode(simCode, &extraFuncs, &extraFuncsDecl, extraFuncsNamespace)
12755-
let funcs = equations |> eq =>
12801+
let &preExp = buffer "" /*BUFD*/
12802+
let &varDecls = buffer "" /*BUFD*/
12803+
let intvl = daeExp(getClockInterval(baseClock), contextOther, &preExp, &varDecls, simCode, &extraFuncs, &extraFuncsDecl,extraFuncsNamespace, stateDerVectorName, useFlatArrayNotation)
12804+
let idx = intAdd(i, -1)
12805+
let clockvals = match subClock
12806+
case SUBCLOCK(factor=RATIONAL(nom=fnom, denom=fres), shift=RATIONAL(nom=snom, denom=sres))
12807+
then
12808+
<<
12809+
_clockInterval[<%idx%>] = <%intvl%> * <%fnom%>.0 / <%fres%>.0;
12810+
_clockTime[<%idx%>] = _simTime +_clockInterval[<%idx%>] ;
12811+
>>
12812+
12813+
let funcs = listAppend(previousAssignments,equations) |> eq =>
1275612814
equation_function_create_single_func(eq, context/*BUFC*/, simCode, &extraFuncs, &extraFuncsDecl, extraFuncsNamespace, "evaluate", "", stateDerVectorName, useFlatArrayNotation, enableMeasureTime, false, false, 'const int clockIndex = <%i%>;<%\n%>')
1275712815
; separator="\n"
12816+
12817+
let funcNamePrev = 'evaluateClockedAssignPrevious<%i%>'
12818+
let funcCallsPrev = (List.partition(previousAssignments, 100) |> eqs hasindex i0 =>
12819+
createEvaluateWithSplit(i0, context, eqs, funcNamePrev, className, simCode, &extraFuncs, &extraFuncsDecl, extraFuncsNamespace)
12820+
; separator="\n")
12821+
1275812822
let funcName = 'evaluateClocked<%i%>'
1275912823
let funcCalls = (List.partition(equations, 100) |> eqs hasindex i0 =>
1276012824
createEvaluateWithSplit(i0, context, eqs, funcName, className, simCode, &extraFuncs, &extraFuncsDecl, extraFuncsNamespace)
@@ -12765,14 +12829,20 @@ template clockedPartFunctions(Integer i, list<tuple<SimCodeVar.SimVar, Boolean>>
1276512829

1276612830
void <%className%>::<%funcName%>(const UPDATETYPE command)
1276712831
{
12768-
if (_simTime > _clockTime[<%idx%>]) {
12832+
12833+
<%varDecls%>
12834+
<%preExp%>
12835+
if (_simTime > _clockTime[<%idx%>]) {
1276912836
_clockStart[<%idx%>] = false;
1277012837
}
12771-
<%funcCalls%>
12772-
if (_simTime > _clockTime[<%idx%>]) {
12773-
_clockInterval[<%idx%>] = _simTime - _clockTime[<%idx%>];
12774-
_clockTime[<%idx%>] = _simTime;
12775-
}
12838+
//evaluate clock partition equations
12839+
<%funcCalls%>
12840+
12841+
//compute new clock tick
12842+
<%clockvals%>
12843+
12844+
//assign the previous-vars since the step is completed
12845+
<%funcCallsPrev%>
1277612846
}
1277712847
>>
1277812848
end clockedPartFunctions;
@@ -12805,13 +12875,21 @@ end createEvaluateAll;
1280512875
template createTimeConditionTreatments(String numberOfTimeEvents)
1280612876
::=
1280712877
<<
12808-
12878+
/*temporary deactivated: treatment of clocks in model as state events
1280912879
// treatment of clocks in model as time events
1281012880
for (int i = <%numberOfTimeEvents%>; i < _dimTimeEvent; i++) {
1281112881
if (_time_conditions[i]) {
1281212882
evaluateClocked(i - <%numberOfTimeEvents%> + 1);
1281312883
_time_conditions[i] = false; // reset clock after one evaluation
12814-
12884+
}
12885+
}
12886+
*/
12887+
for (int i = 0; i < _dimClock; i++)
12888+
{
12889+
if( _clockCondition[i])
12890+
{
12891+
evaluateClocked(i+1);
12892+
_clockCondition[i] = false;// reset clock after one evaluation
1281512893
}
1281612894
}
1281712895
>>

Compiler/Template/CodegenCppCommon.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1705,7 +1705,7 @@ template daeExpCall(Exp call, Context context, Text &preExp /*BUFP*/, Text &varD
17051705
'_clockInterval[clockIndex - 1]'
17061706

17071707
case CALL(path=IDENT(name="$_clkfire"), expLst={arg as ICONST(__)}) then
1708-
'_time_conditions[<%arg.integer%> - 1 + <%timeEventLength(simCode)%>] = (_simTime > _clockTime[<%arg.integer%> - 1])'
1708+
'_clockCondition[<%arg.integer%> - 1 + <%timeEventLength(simCode)%>] = (_simTime > _clockTime[<%arg.integer%> - 1])'
17091709

17101710
case CALL(path=IDENT(name="$getPart"), expLst={e1}) then
17111711
daeExp(e1, context, &preExp, &varDecls, simCode, &extraFuncs, &extraFuncsDecl, extraFuncsNamespace, stateDerVectorName, useFlatArrayNotation)

Compiler/Template/CodegenCppHpcom.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ template updateHpcom(list<SimEqSystem> allEquationsPlusWhen, SimCode simCode, Te
754754

755755
<%createEvaluateConditions(allEquations, simCode, &extraFuncs, &extraFuncsDecl, extraFuncsNamespace, contextOther, stateDerVectorName, useFlatArrayNotation)%>
756756

757-
<%clockedFunctions(getSubPartitions(clockedPartitions), simCode, &extraFuncs, &extraFuncsDecl, extraFuncsNamespace, contextSimulationDiscrete, stateDerVectorName, useFlatArrayNotation, boolNot(stringEq(getConfigString(PROFILING_LEVEL), "none")))%>
757+
<%clockedFunctions(clockedPartitions, simCode, &extraFuncs, &extraFuncsDecl, extraFuncsNamespace, contextSimulationDiscrete, stateDerVectorName, useFlatArrayNotation, boolNot(stringEq(getConfigString(PROFILING_LEVEL), "none")))%>
758758

759759
<%parCode%>
760760

Compiler/Template/SimCodeTV.mo

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,9 @@ package SimCode
337337

338338
uniontype SubPartition
339339
record SUBPARTITION
340+
Integer idx; //a unique index among all subpartitions
340341
list<tuple<SimCodeVar.SimVar, Boolean>> vars;
342+
list<SimEqSystem> previousAssignments;
341343
list<SimEqSystem> equations;
342344
list<SimEqSystem> removedEquations;
343345
BackendDAE.SubClock subClock;
@@ -884,6 +886,11 @@ package SimCodeUtil
884886
output list<SimCode.SubPartition> outSubPartitions;
885887
end getSubPartitions;
886888

889+
function getSubPartitionIdx
890+
input SimCode.SubPartition sub;
891+
output Integer idx;
892+
end getSubPartitionIdx;
893+
887894
function getClockIndex
888895
input SimCodeVar.SimVar simVar;
889896
input SimCode.SimCode simCode;

0 commit comments

Comments
 (0)