Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit 1d52b90

Browse files
author
Willi Braun
committed
update the discrete system after a sample event
1 parent 91ff2aa commit 1d52b90

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Compiler/SimCode/SimCodeUtil.mo

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,9 +1500,7 @@ algorithm
15001500
outAllEquations := inEq::inAllEquations;
15011501

15021502
outOdeEquations := if bdynamic and not skipDiscrete then inEq::inOdeEquations else inOdeEquations;
1503-
// FIXME: actually discrete equtaions should be also skipable in the algebraic equations
1504-
// but currently the event handling with sample operator fail if they are skipped
1505-
outAlgebraicEquations := if not bdynamic then inEq::inAlgebraicEquations else inAlgebraicEquations;
1503+
outAlgebraicEquations := if not bdynamic and not skipDiscrete then inEq::inAlgebraicEquations else inAlgebraicEquations;
15061504
outEquationsforZeroCrossings := if bzceqns and not skipDiscrete then inEq::inEquationsforZeroCrossings else inEquationsforZeroCrossings;
15071505
end addEquationsToLists;
15081506

@@ -1563,7 +1561,7 @@ algorithm
15631561
String message;
15641562

15651563
// case used for then inline solver, if "not createAlgebraicEquations = true"
1566-
case _ guard not (createAlgebraicEquations or bdynamic) or skip and not createAlgebraicEquations
1564+
case _ guard ((not bdynamic) or skip) and not createAlgebraicEquations
15671565
then (uniqueEqIndex, odeEquations, algebraicEquations, allEquations, equationsforZeroCrossings,
15681566
tempvars, eqSccMapping, eqBackendSimCodeMapping, backendMapping, sccIndex);
15691567

SimulationRuntime/c/simulation/solver/events.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,8 @@ void handleEvents(DATA* data, threadData_t *threadData, LIST* eventLst, double *
278278
debugStreamPrint(LOG_EVENTS, 0, "next sample-event at t = %g", data->simulationInfo->nextSampleEvent);
279279

280280
solverInfo->sampleEvents++;
281+
/* update the whole system */
282+
updateDiscreteSystem(data, threadData);
281283
}
282284

283285
TRACE_POP

0 commit comments

Comments
 (0)