Skip to content

Commit

Permalink
Use Euler for FMUs without states
Browse files Browse the repository at this point in the history
  - CVODE will not be used for FMUs without any states
  • Loading branch information
AnHeuermann authored and adrpo committed Aug 6, 2020
1 parent a6b737f commit dbb0b7a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Expand Up @@ -741,6 +741,7 @@ static int callSolver(DATA* simData, threadData_t *threadData, string init_initM
)
{
solverID = S_EULER;
infoStreamPrint(LOG_SOLVER, 0, "No states present, continuing without ODE solver.");
if (compiledInDAEMode)
{
simData->callback->functionDAE = evaluateDAEResiduals_wrapperEventUpdate;
Expand Down
Expand Up @@ -192,6 +192,13 @@ int FMI2CS_initializeSolverData(ModelInstance* comp)
solverInfo->solverMethod = S_EULER;
}

/* If no states are present, we can use Euler's method since it is doing nothing. */
if (data->modelData->nStates < 1)
{
FILTERED_LOG(comp, fmi2OK, LOG_ALL, "fmi2Instantiate: No states present, continuing without ODE solver.")
solverInfo->solverMethod = S_EULER;
}

switch (solverInfo->solverMethod)
{
case S_EULER:
Expand Down

0 comments on commit dbb0b7a

Please sign in to comment.