Skip to content

Commit

Permalink
- revise some dumps (LOG_EVENTS, LOG_ZEROCROSSINGS)
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@16262 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
lochel committed Jun 9, 2013
1 parent 58ac55d commit e40a19a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 22 deletions.
23 changes: 12 additions & 11 deletions SimulationRuntime/c/simulation/solver/events.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,17 +151,18 @@ int checkForStateEvent(DATA* data, LIST *eventList)
}

/*! \fn checkEvents
*
* \param [ref] [data]
* \param [ref] [eventList]
* \param [in] [eventTime]
* \param [ref] [solverInfo]
*
* This function check if a time event or a state event should
* processed. If sample and state event have the same event-time
* then time events are prioritize, since they handle also
* state event. It returns 1 if state event is before time event
* then it de-activate the time events.
*
* \param [ref] [data]
* \param [ref] [eventList]
* \param [in] [eventTime]
* \param [ref] [solverInfo]
* \return 0: no event; 1: time event; 2: state event
*/
int checkEvents(DATA* data, LIST* eventLst, double *eventTime, SOLVER_INFO* solverInfo)
{
Expand All @@ -172,7 +173,7 @@ int checkEvents(DATA* data, LIST* eventLst, double *eventTime, SOLVER_INFO* solv
if(data->simulationInfo.sampleActivated == 1)
return 1;
if(listLen(eventLst)>0)
return 1;
return 2;

return 0;
}
Expand Down Expand Up @@ -456,13 +457,13 @@ double bisection(DATA* data, double* a, double* b, double* states_a, double* sta
}

/*! \fn checkZeroCrossings
*
* Function checks for an event list on events
*
* \param [ref] [data]
* \param [ref] [eventListTmp]
* \param [in] [eventList]
* \return boolean value
*
* Function checks for an event list on events
*/
int checkZeroCrossings(DATA *data, LIST *tmpEventList, LIST *eventList)
{
Expand Down Expand Up @@ -493,16 +494,16 @@ int checkZeroCrossings(DATA *data, LIST *tmpEventList, LIST *eventList)
}

/*! \fn saveZeroCrossingsAfterEvent
*
* \param [ref] [data]
*
* Function saves all zero-crossing values as pre(zero-crossing)
*
* \param [ref] [data]
*/
void saveZeroCrossingsAfterEvent(DATA *data)
{
long i=0;

INFO(LOG_ZEROCROSSINGS, "save all zerocrossings after an event");
INFO(LOG_ZEROCROSSINGS, "save all zerocrossings after an event"); /* ??? */

function_ZeroCrossings(data, data->simulationInfo.zeroCrossings, &(data->localData[0]->timeValue));
for(i=0; i<data->modelData.nZeroCrossings; i++)
Expand Down
4 changes: 2 additions & 2 deletions SimulationRuntime/c/simulation/solver/model_help.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ void saveZeroCrossings(DATA* data)
{
long i = 0;

INFO(LOG_ZEROCROSSINGS, "save all zerocrossings");
DEBUG(LOG_ZEROCROSSINGS, "save all zerocrossings"); /* ??? */

for(i=0;i<data->modelData.nZeroCrossings;i++)
data->simulationInfo.zeroCrossingsPre[i] = data->simulationInfo.zeroCrossings[i];
Expand Down Expand Up @@ -923,7 +923,7 @@ static double tolZC = 1e-10;
void setZCtol(double relativeTol)
{
tolZC = 1e-4*relativeTol;
INFO1(LOG_EVENTS, "Set tolerance for zero-crossing hysteresis to: %e", tolZC);
INFO1(LOG_EVENTS_V, "Set tolerance for zero-crossing hysteresis to: %e", tolZC);
}

extern inline
Expand Down
7 changes: 4 additions & 3 deletions SimulationRuntime/c/simulation/solver/perform_simulation.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ int performSimulation(DATA* data, SOLVER_INFO* solverInfo)

int retValIntegrator = 0;
int retValue = 0;
int i, ui;
int i, ui, eventType;

FILE *fmt = NULL;
unsigned int stepNo = 0;
Expand Down Expand Up @@ -159,9 +159,10 @@ int performSimulation(DATA* data, SOLVER_INFO* solverInfo)
if(measure_time_flag)
rt_tick(SIM_TIMER_EVENT);

if(checkEvents(data, solverInfo->eventLst, &(solverInfo->currentTime), solverInfo))
eventType = checkEvents(data, solverInfo->eventLst, &(solverInfo->currentTime), solverInfo);
if(eventType > 0)
{
INFO1(LOG_EVENTS, "event handling at time %g", solverInfo->currentTime);
INFO2(LOG_EVENTS, "%s event at time %g", eventType == 1 ? "time" : "state", solverInfo->currentTime);
INDENT(LOG_EVENTS);
handleEvents(data, solverInfo->eventLst, &(solverInfo->currentTime), solverInfo);
RELEASE(LOG_EVENTS);
Expand Down
12 changes: 6 additions & 6 deletions SimulationRuntime/c/util/omc_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ typedef struct _FILE_INFO
} FILE_INFO;

extern void printInfo(FILE *stream, FILE_INFO info);
extern void (*omc_assert)(FILE_INFO,const char*,...);
extern void (*omc_assert_warning)(FILE_INFO,const char*,...);
extern void (*omc_terminate)(FILE_INFO,const char*,...);
extern void (*omc_assert)(FILE_INFO,const char*, ...);
extern void (*omc_assert_warning)(FILE_INFO,const char*, ...);
extern void (*omc_terminate)(FILE_INFO,const char*, ...);
extern void (*omc_throw)();
void initDumpSystem();
void omc_assert_function(FILE_INFO info, const char *msg,...);
void omc_assert_warning_function(FILE_INFO info, const char *msg,...);
void omc_terminate_function(FILE_INFO info, const char *msg,...);
void omc_assert_function(FILE_INFO info, const char *msg, ...);
void omc_assert_warning_function(FILE_INFO info, const char *msg, ...);
void omc_terminate_function(FILE_INFO info, const char *msg, ...);
void omc_throw_function();

/* global JumpBuffer */
Expand Down

0 comments on commit e40a19a

Please sign in to comment.