@@ -12448,6 +12448,8 @@ end clockedPartFunctions;
1244812448
1244912449template createEvaluateAll( list<SimEqSystem> allEquationsPlusWhen, SimCode simCode ,Text& extraFuncs,Text& extraFuncsDecl,Text extraFuncsNamespace, Context context, Text stateDerVectorName /*=__zDot*/, Boolean useFlatArrayNotation, Boolean createMeasureTime)
1245012450::=
12451+ match simCode
12452+ case SIMCODE(modelInfo = MODELINFO(__)) then
1245112453 let className = lastIdentOfPathFromSimCode(simCode , &extraFuncs , &extraFuncsDecl, extraFuncsNamespace)
1245212454
1245312455 let equation_all_func_calls = (List.partition(allEquationsPlusWhen, 100) |> eqs hasindex i0 =>
@@ -12458,8 +12460,7 @@ template createEvaluateAll( list<SimEqSystem> allEquationsPlusWhen, SimCode simC
1245812460 bool <%className%>::evaluateAll(const UPDATETYPE command)
1245912461 {
1246012462 <%if createMeasureTime then generateMeasureTimeStartCode("measuredFunctionStartValues", "evaluateAll", "MEASURETIME_MODELFUNCTIONS") else ""%>
12461-
12462- <%createTimeConditionTreatments(timeEventLength(simCode))%>
12463+ <%createTimeConditionTreatments(timeEventLength(simCode), clockedPartitions)%>
1246312464
1246412465 // Evaluate Equations
1246512466 <%equation_all_func_calls%>
@@ -12471,20 +12472,58 @@ template createEvaluateAll( list<SimEqSystem> allEquationsPlusWhen, SimCode simC
1247112472 >>
1247212473end createEvaluateAll;
1247312474
12474- template createTimeConditionTreatments(String numberOfTimeEvents)
12475+ template createTimeConditionTreatments(String numberOfTimeEvents, list<ClockedPartition> clockPartitions )
1247512476::=
12477+ let booleanSubClocks = (clockPartitions |> baseClock hasindex i0 =>
12478+ booleanSubClockActivation1(absoluteClockIdxForBaseClock(intAdd(i0,1),clockPartitions), baseClock, numberOfTimeEvents)
12479+ ;separator="\n")
1247612480 <<
1247712481 // treatment of clocks in model as time events
1247812482 for (int i = <%numberOfTimeEvents%>; i < _dimTimeEvent; i++) {
1247912483 if (_time_conditions[i]) {
1248012484 evaluateClocked(i - <%numberOfTimeEvents%> + 1);
12485+ <%booleanSubClocks%>
1248112486 _time_conditions[i] = false; // reset clock after one evaluation
1248212487 _clockSubactive[i - <%numberOfTimeEvents%>] = false;
1248312488 }
1248412489 }
1248512490 >>
1248612491end createTimeConditionTreatments;
1248712492
12493+ template booleanSubClockActivation1(Integer absBaseClockIdx, ClockedPartition baseClock, String numberOfTimeEvents)
12494+ ::=
12495+ match baseClock
12496+ case CLOCKED_PARTITION(baseClock = BOOLEAN_CLOCK(__)) then
12497+ let subClocks = (subPartitions |> subClock hasindex i0 =>
12498+ booleanSubClockActivation2(absBaseClockIdx, i0, subClock, numberOfTimeEvents)
12499+ ;separator="\n")
12500+ <<
12501+ //the subclocks <%absBaseClockIdx%>
12502+ <%subClocks%>
12503+ >>
12504+ else
12505+ <<
12506+ //no subclock <%absBaseClockIdx%>
12507+ >>
12508+ end match
12509+ end booleanSubClockActivation1;
12510+
12511+ template booleanSubClockActivation2(Integer absClockIdx, Integer subClockIdx, SubPartition subPartition, String numberOfTimeEvents)
12512+ ::=
12513+ if intNe(subClockIdx,0) then
12514+ let absSubClockIdx = intAdd(absClockIdx,subClockIdx)
12515+ <<
12516+ //activate boolean triggered subclock <%absSubClockIdx%> of the base sub-clock <%absClockIdx%> is triggered
12517+ if (_time_conditions[<%absClockIdx%> -1+<%numberOfTimeEvents%>] && (_simTime >= _clockShift[<%absSubClockIdx%> -1]*_clockInterval[<%absClockIdx%> -1])) {
12518+ _time_conditions[<%absSubClockIdx%> -1+<%numberOfTimeEvents%>] = (_simTime >= _clockShift[<%absSubClockIdx%> -1]*_clockInterval[<%absClockIdx%> -1]);
12519+ }
12520+ >>
12521+ else
12522+ <<
12523+
12524+ >>
12525+ end booleanSubClockActivation2;
12526+
1248812527template createEvaluateConditions( list<SimEqSystem> allEquationsPlusWhen, SimCode simCode ,Text& extraFuncs,Text& extraFuncsDecl,Text extraFuncsNamespace, Context context, Text stateDerVectorName /*=__zDot*/, Boolean useFlatArrayNotation)
1248912528::=
1249012529 let className = lastIdentOfPathFromSimCode(simCode , &extraFuncs , &extraFuncsDecl, extraFuncsNamespace)
0 commit comments