Skip to content

Commit

Permalink
Copy the required binaries for FMU.
Browse files Browse the repository at this point in the history
Display information about state when fails.
  • Loading branch information
adeas31 authored and OpenModelica-Hudson committed Sep 17, 2015
1 parent f71d5c4 commit 1663998
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Compiler/Template/CodegenFMU.tpl
Expand Up @@ -1002,6 +1002,8 @@ match platform
<%\t%>cp <%omhome%>/bin/libexpat.dll <%fmudirname%>/binaries/<%platform%>/
<%\t%>cp <%omhome%>/bin/pthreadGC2.dll <%fmudirname%>/binaries/<%platform%>/
<%\t%>cp <%omhome%>/bin/libgfortran-3.dll <%fmudirname%>/binaries/<%platform%>/
<%\t%>cp <%omhome%>/bin/libsundials_kinsol.dll <%fmudirname%>/binaries/<%platform%>/
<%\t%>cp <%omhome%>/bin/libsundials_nvecserial.dll <%fmudirname%>/binaries/<%platform%>/
<%\t%>cd <%fmudirname%>&& rm -f ../<%fileNamePrefix%>.fmu&& zip -r ../<%fileNamePrefix%>.fmu *
<%\t%>rm -rf <%fmudirname%>
<%\t%>rm -f <%fileNamePrefix%>.def <%fileNamePrefix%>.o <%fileNamePrefix%>.so <%fileNamePrefix%>_*.o
Expand Down
15 changes: 14 additions & 1 deletion SimulationRuntime/fmi/export/fmi2/fmu2_model_interface.c
Expand Up @@ -61,6 +61,19 @@ fmi2ValueReference vrStatesDerivatives[NUMBER_OF_STATES] = STATESDERIVATIVES;
// ---------------------------------------------------------------------------
// Private helpers used below to validate function arguments
// ---------------------------------------------------------------------------
const char* stateToString(ModelInstance *comp) {
switch (comp->state) {
case modelInstantiated: return "Instantiated";
case modelInitializationMode: return "Initialization Mode";
case modelEventMode: return "Event Mode";
case modelContinuousTimeMode: return "Continuous-Time Mode";
case modelTerminated: return "Terminated";
case modelError: return "Error";
default: break;
}
return "Unknown";
}

static fmi2Boolean invalidNumber(ModelInstance *comp, const char *f, const char *arg, int n, int nExpected) {
if (n != nExpected) {
comp->state = modelError;
Expand All @@ -74,8 +87,8 @@ static fmi2Boolean invalidState(ModelInstance *comp, const char *f, int statesEx
if (!comp)
return fmi2True;
if (!(comp->state & statesExpected)) {
FILTERED_LOG(comp, fmi2Error, LOG_STATUSERROR, "%s: Illegal call sequence. %s is not allowed in %s state.", f, f, stateToString(comp))
comp->state = modelError;
FILTERED_LOG(comp, fmi2Error, LOG_STATUSERROR, "%s: Illegal call sequence.", f)
return fmi2True;
}
return fmi2False;
Expand Down

0 comments on commit 1663998

Please sign in to comment.