Skip to content

Commit

Permalink
Do not compile embedded server for source FMU
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoelund committed Mar 24, 2016
1 parent b472093 commit ffcb0f7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions SimulationRuntime/c/simulation/simulation_runtime.cpp
Expand Up @@ -884,6 +884,7 @@ int _main_SimulationRuntime(int argc, char**argv, DATA *data, threadData_t *thre
return retVal;
}

#if !defined(OMC_MINIMAL_RUNTIME)
const char* prettyPrintNanoSec(int64_t ns, int *v)
{
if (ns > 100000000000L || ns < -100000000000L) {
Expand All @@ -900,5 +901,6 @@ const char* prettyPrintNanoSec(int64_t ns, int *v)
return "ns";
}
}
#endif

} // extern "C"
3 changes: 2 additions & 1 deletion SimulationRuntime/c/simulation/simulation_runtime.h
Expand Up @@ -82,8 +82,9 @@ extern void communicateMsg(char id, unsigned int size, const char *data);
*/
extern int _main_SimulationRuntime(int argc, char**argv, DATA *data, threadData_t *threadData);


#if !defined(OMC_MINIMAL_RUNTIME)
const char* prettyPrintNanoSec(int64_t ns, int *v);
#endif

#ifdef __cplusplus
}
Expand Down
4 changes: 4 additions & 0 deletions SimulationRuntime/c/simulation/solver/perform_simulation.c
Expand Up @@ -49,8 +49,10 @@
#include <float.h>

#include "simulation/solver/synchronous.h"
#if !defined(OMC_MINIMAL_RUNTIME)
#include "simulation/solver/embedded_server.h"
#include "simulation/solver/real_time_sync.h"
#endif

/*! \fn updateContinuousSystem
*
Expand Down Expand Up @@ -216,6 +218,7 @@ static void fmtEmitStep(DATA* data, threadData_t *threadData, MEASURE_TIME* mt,
if ((omc_flag[FLAG_NOEVENTEMIT] && didEventStep == 0) || !omc_flag[FLAG_NOEVENTEMIT]) {
sim_result.emit(&sim_result, data, threadData);
}
#if !defined(OMC_MINIMAL_RUNTIME)
embedded_server_update(data->embeddedServerState, data->localData[0]->timeValue);
if (data->real_time_sync.enabled) {
double time = data->localData[0]->timeValue;
Expand All @@ -233,6 +236,7 @@ static void fmtEmitStep(DATA* data, threadData_t *threadData, MEASURE_TIME* mt,
}

printAllVarsDebug(data, 0, LOG_DEBUG); /* ??? */
#endif
}

static void fmtClose(MEASURE_TIME* mt)
Expand Down
8 changes: 6 additions & 2 deletions SimulationRuntime/c/simulation/solver/solver_main.c
Expand Up @@ -51,8 +51,10 @@
#include "simulation/solver/epsilon.h"
#include "linearSystem.h"
#include "sym_imp_euler.h"
#if !defined(OMC_MINIMAL_RUNTIME)
#include "simulation/solver/embedded_server.h"
#include "simulation/solver/real_time_sync.h"
#endif

#include "optimization/OptimizerInterface.h"

Expand Down Expand Up @@ -658,10 +660,11 @@ int solver_main(DATA* data, threadData_t *threadData, const char* init_initMetho
}
omc_alloc_interface.collect_a_little();

#if !defined(OMC_MINIMAL_RUNTIME)
dllHandle = embedded_server_load_functions(omc_flagValue[FLAG_EMBEDDED_SERVER]);
omc_real_time_sync_init(threadData, data);
data->embeddedServerState = embedded_server_init(data, data->localData[0]->timeValue, solverInfo.currentStepSize, argv_0, omc_real_time_sync_update);

#endif
if(0 == retVal) {
/* if the model has no time changing variables skip the main loop*/
if(data->modelData->nVariablesReal == 0 &&
Expand Down Expand Up @@ -719,9 +722,10 @@ int solver_main(DATA* data, threadData_t *threadData, const char* init_initMetho
const char *unit = prettyPrintNanoSec(data->real_time_sync.maxLate, &tMaxLate);
infoStreamPrint(LOG_RT, 0, "Maximum real-time latency was (positive=missed dealine, negative is slack): %d %s", tMaxLate, unit);
}
#if !defined(OMC_MINIMAL_RUNTIME)
embedded_server_deinit(data->embeddedServerState);
embedded_server_unload_functions(dllHandle);

#endif
/* free SolverInfo memory */
freeSolverData(data, &solverInfo);

Expand Down

0 comments on commit ffcb0f7

Please sign in to comment.