Skip to content

Commit

Permalink
- added support for terminate() call in runtime
Browse files Browse the repository at this point in the history
- changed assert massage from warning to info


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@13683 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Willi Braun committed Oct 29, 2012
1 parent 847cbb6 commit e5bb25b
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions SimulationRuntime/c/simulation/solver/solver_main.c
Expand Up @@ -385,9 +385,12 @@ int solver_main(DATA* data, const char* init_initMethod,
checkForAsserts(data);
if (terminationAssert || terminationTerminate) {
terminationAssert = 0;
terminationTerminate = 0;
checkForAsserts(data);
checkTermination(data);
if(!terminationAssert && terminationTerminate){
INFO2(LOG_STDOUT, "Simulation call terminate() at time %f\nMessage : %s", data->localData[0]->timeValue, TermMsg);
simInfo->stopTime = solverInfo.currentTime;
}
}

/* terminate for some cases:
Expand Down Expand Up @@ -556,8 +559,7 @@ rungekutta_step(DATA* data, SOLVER_INFO* solverInfo) {
*/
void checkTermination(DATA *data)
{
if(terminationAssert || terminationTerminate)
{
if(terminationAssert){
data->simulationInfo.simulationSuccess = -1;
printInfo(stdout, TermInfo);
fputc('\n', stdout);
Expand All @@ -568,20 +570,14 @@ void checkTermination(DATA *data)
if(warningLevelAssert)
{
/* terminated from assert, etc. */
WARNING2(LOG_STDOUT, "Simulation call assert() at time %f\nLevel : warning\nMessage : %s", data->localData[0]->timeValue, TermMsg);
INFO2(LOG_STDOUT, "Simulation call assert() at time %f\nLevel : warning\nMessage : %s", data->localData[0]->timeValue, TermMsg);
}
else
{
WARNING2(LOG_STDOUT, "Simulation call assert() at time %f\nLevel : error\nMessage : %s", data->localData[0]->timeValue, TermMsg);
INFO2(LOG_STDOUT, "Simulation call assert() at time %f\nLevel : error\nMessage : %s", data->localData[0]->timeValue, TermMsg);
/* THROW1("timeValue = %f", data->localData[0]->timeValue); */
}
}

if(terminationTerminate)
{
WARNING2(LOG_STDOUT, "Simulation call terminate() at time %f\nMessage : %s", data->localData[0]->timeValue, TermMsg);
/* THROW1("timeValue = %f", data->localData[0]->timeValue); */
}
}

void writeOutputVars(char* names, DATA* data)
Expand Down

0 comments on commit e5bb25b

Please sign in to comment.