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

Commit

Permalink
update the discrete system after a sample event
Browse files Browse the repository at this point in the history
  • Loading branch information
Willi Braun committed Sep 27, 2018
1 parent 91ff2aa commit 1d52b90
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Compiler/SimCode/SimCodeUtil.mo
Original file line number Diff line number Diff line change
Expand Up @@ -1500,9 +1500,7 @@ algorithm
outAllEquations := inEq::inAllEquations;

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

Expand Down Expand Up @@ -1563,7 +1561,7 @@ algorithm
String message;

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

Expand Down
2 changes: 2 additions & 0 deletions SimulationRuntime/c/simulation/solver/events.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ void handleEvents(DATA* data, threadData_t *threadData, LIST* eventLst, double *
debugStreamPrint(LOG_EVENTS, 0, "next sample-event at t = %g", data->simulationInfo->nextSampleEvent);

solverInfo->sampleEvents++;
/* update the whole system */
updateDiscreteSystem(data, threadData);
}

TRACE_POP
Expand Down

0 comments on commit 1d52b90

Please sign in to comment.