Skip to content

Commit

Permalink
Change type of nextTimerDefined from int to modelica_boolean in handl…
Browse files Browse the repository at this point in the history
…erTimersFMI (#11469)

* Update synchronous.h

change type of  *nextTimerDefined from int to modelica_boolean

* Update synchronous.c

change type of  *nextTimerDefined from int to modelica_boolean

* internalEventUpdate fmi2Boolean not compatible with modelica_boolean

---------

Co-authored-by: AnHeuermann <38031952+AnHeuermann@users.noreply.github.com>
  • Loading branch information
Arinomo and AnHeuermann committed Nov 21, 2023
1 parent 0b64d0d commit 86161f6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions OMCompiler/SimulationRuntime/c/simulation/solver/synchronous.c
Expand Up @@ -332,14 +332,14 @@ fire_timer_t handleTimers(DATA* data, threadData_t *threadData, SOLVER_INFO* sol
* @param data data
* @param threadData thread data, for errro handling
* @param currentTime Current solver timer.
* @param nextTimerDefined 0 (false) if no next timer is defined.
* 1 (true) if a next timer is defined. Then the time is outputted in nextTimerActivationTime.
* @param nextTimerDefined FALSE if no next timer is defined.
* TRUE if a next timer is defined. Then the time is outputted in nextTimerActivationTime.
* @param nextTimerActivationTime If nextTimerDefined is true it will contain the next time a timer will fire.
* @return int Return 0, if there is no fired timers;
* 1, if there is a fired timer;
* 2, if there is a fired timer which trigger event;
*/
int handleTimersFMI(DATA* data, threadData_t *threadData, double currentTime, int *nextTimerDefined, double *nextTimerActivationTime)
int handleTimersFMI(DATA* data, threadData_t *threadData, double currentTime, modelica_boolean *nextTimerDefined, double *nextTimerActivationTime)
{
int base_idx, sub_idx;
double activationTime;
Expand All @@ -349,7 +349,7 @@ int handleTimersFMI(DATA* data, threadData_t *threadData, double currentTime, in
fire_timer_t ret = NO_TIMER_FIRED;
SUBCLOCK_DATA* subClock;

*nextTimerDefined = 0;
*nextTimerDefined = FALSE;

if (data->simulationInfo->intvlTimers == NULL || listLen(data->simulationInfo->intvlTimers) <= 0) {
TRACE_POP
Expand Down Expand Up @@ -398,7 +398,7 @@ int handleTimersFMI(DATA* data, threadData_t *threadData, double currentTime, in
nextTimer = (SYNC_TIMER*)listNodeData(listFirstNode(data->simulationInfo->intvlTimers));
/* Next time a timer will activate: */
*nextTimerActivationTime = nextTimer->activationTime;
*nextTimerDefined = 1;
*nextTimerDefined = TRUE;
}

TRACE_POP
Expand Down
Expand Up @@ -56,7 +56,7 @@ void initSynchronous(DATA* data, threadData_t *threadData, modelica_real startTi
void checkForSynchronous(DATA *data, SOLVER_INFO* solverInfo);
modelica_boolean handleBaseClock(DATA* data, threadData_t *threadData, long idx, double curTime);
fire_timer_t handleTimers(DATA* data, threadData_t *threadData, SOLVER_INFO* solverInfo);
int handleTimersFMI(DATA* data, threadData_t *threadData, double currentTime, int *nextTimerDefined, double *nextTimerActivationTime);
int handleTimersFMI(DATA* data, threadData_t *threadData, double currentTime, modelica_boolean *nextTimerDefined, double *nextTimerActivationTime);

#ifdef __cplusplus
}
Expand Down
Expand Up @@ -264,7 +264,7 @@ fmi2Status internalEventUpdate(fmi2Component c, fmi2EventInfo* eventInfo)
threadData_t *threadData = comp->threadData;
fmi2Real nextSampleEvent;
fmi2Boolean nextSampleEventDefined;
fmi2Boolean nextTimerDefined;
modelica_boolean nextTimerDefined;
fmi2Real nextTimerActivationTime;
int syncRet;

Expand Down

0 comments on commit 86161f6

Please sign in to comment.