Skip to content

Commit

Permalink
- fixed #2878.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@23223 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Willi Braun committed Nov 5, 2014
1 parent 485a7a1 commit e41145d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
21 changes: 19 additions & 2 deletions SimulationRuntime/c/simulation/solver/dassl.c
Expand Up @@ -449,7 +449,9 @@ int dassl_step(DATA* data, SOLVER_INFO* solverInfo)
double tout = 0;
int i = 0;
unsigned int ui = 0;
int retVal = 0;
int retVal = 1;
int saveJumpState;
threadData_t *threadData = data->threadData;

DASSL_DATA *dasslData = (DASSL_DATA*) solverInfo->solverData;

Expand All @@ -468,6 +470,14 @@ int dassl_step(DATA* data, SOLVER_INFO* solverInfo)

TRACE_PUSH

saveJumpState = data->threadData->currentErrorStage;
data->threadData->currentErrorStage = ERROR_INTEGRATOR;

/* try */
#if !defined(OMC_EMCC)
MMC_TRY_INTERNAL(simulationJumpBuffer)
#endif

assertStreamPrint(data->threadData, 0 != dasslData->rpar, "could not passed to DDASKR");

/* If an event is triggered and processed restart dassl. */
Expand Down Expand Up @@ -510,7 +520,7 @@ int dassl_step(DATA* data, SOLVER_INFO* solverInfo)
solverInfo->currentTime = tout;

TRACE_POP
return retVal;
return 0;
}

/* If dasslsteps is selected, we just use the outer ring buffer */
Expand Down Expand Up @@ -597,6 +607,13 @@ int dassl_step(DATA* data, SOLVER_INFO* solverInfo)

} while(dasslData->idid == 1 ||
(dasslData->idid == -1 && solverInfo->currentTime <= data->simulationInfo.stopTime));
retVal = 0;

#if !defined(OMC_EMCC)
MMC_CATCH_INTERNAL(simulationJumpBuffer)
#endif
data->threadData->currentErrorStage = saveJumpState;


if (!dasslData->dasslSteps)
{
Expand Down
3 changes: 2 additions & 1 deletion SimulationRuntime/c/simulation/solver/perform_simulation.c
Expand Up @@ -162,7 +162,7 @@ int prefixedName_performSimulation(DATA* data, SOLVER_INFO* solverInfo)
}
solverInfo->currentStepSize = (double)(__currStepNo*(simInfo->stopTime-simInfo->startTime))/(simInfo->numSteps) + simInfo->startTime - solverInfo->currentTime;

// if retry reduce stepsize
/* if retry reduce stepsize */
if(0 != retry)
{
solverInfo->currentStepSize /= 2;
Expand Down Expand Up @@ -348,6 +348,7 @@ int prefixedName_performSimulation(DATA* data, SOLVER_INFO* solverInfo)
restoreOldValues(data);
solverInfo->currentTime = data->localData[0]->timeValue;
overwriteOldSimulationData(data);
updateDiscreteSystem(data);
warningStreamPrint(LOG_STDOUT, 0, "Integrator attempt to handle a problem with a called assert.");
retry = 1;
solverInfo->didEventStep = 1;
Expand Down

0 comments on commit e41145d

Please sign in to comment.