Skip to content

Commit

Permalink
Add setupExperiment feature, refs eclipse-sumo#6533
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertHilbrich committed Aug 28, 2020
1 parent 8699210 commit 07491a7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
14 changes: 14 additions & 0 deletions src/fmi/fmi2Functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,19 @@ fmi2SetDebugLogging(fmi2Component c, fmi2Boolean loggingOn, size_t nCategories,
comp->logErrors = false;
}

return fmi2OK;
}

fmi2Status
fmi2SetupExperiment(fmi2Component c, fmi2Boolean toleranceDefined, fmi2Real tolerance,
fmi2Real startTime, fmi2Boolean stopTimeDefined, fmi2Real stopTime) {

// ignore arguments: toleranceDefined, tolerance
ModelInstance *comp = (ModelInstance *)c;

// Store the start and stop times of the experiment
comp->startTime = startTime;
comp->stopTime = stopTime;

return fmi2OK;
}
6 changes: 4 additions & 2 deletions src/fmi/fmi2main.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
#include "fmi2main.h"


void logError(ModelInstance *comp, const char *message, ...) {
void
logError(ModelInstance *comp, const char *message, ...) {
if (!comp->logErrors) return;

va_list args;
Expand All @@ -35,7 +36,8 @@ void logError(ModelInstance *comp, const char *message, ...) {
va_end(args);
}

static void logMessage(ModelInstance *comp, int status, const char *category, const char *message, va_list args) {
void
logMessage(ModelInstance *comp, int status, const char *category, const char *message, va_list args) {
va_list args1;
size_t len = 0;
char *buf = "";
Expand Down
3 changes: 3 additions & 0 deletions src/fmi/fmi2main.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ typedef struct {
allocateMemoryType allocateMemory;
freeMemoryType freeMemory;

double startTime;
double stopTime;

bool logEvents;
bool logErrors;
} ModelInstance;
Expand Down

0 comments on commit 07491a7

Please sign in to comment.