Skip to content

Commit

Permalink
- fixed FMU testsuite
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@10959 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Willi Braun committed Jan 25, 2012
1 parent b000ddb commit d36c583
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 22 deletions.
4 changes: 2 additions & 2 deletions Compiler/BackEnd/SimCode.mo
Expand Up @@ -1179,11 +1179,11 @@ algorithm
BackendDAE.StrongComponents strongComponents;
String str;

case (simCode,"C")
case (simCode,"c")
equation
Tpl.tplNoret(SimCodeFMU.translateModel, simCode);
then ();
case (simCode,"c")
case (simCode,"C")
equation
Tpl.tplNoret(CodegenFMU.translateModel, simCode);
then ();
Expand Down
11 changes: 6 additions & 5 deletions Compiler/susan_codegen/SimCode/CodegenFMU.tpl
Expand Up @@ -59,7 +59,7 @@ case SIMCODE(modelInfo=modelInfo as MODELINFO(__)) then
let()= textFile(simulationFunctionsHeaderFile(fileNamePrefix, modelInfo.functions, recordDecls), '<%fileNamePrefix%>_functions.h')
let()= textFile(simulationFunctionsFile(fileNamePrefix, modelInfo.functions, literals), '<%fileNamePrefix%>_functions.c')
let()= textFile(recordsFile(fileNamePrefix, recordDecls), '<%fileNamePrefix%>_records.c')
let()= textFile(simulationHeaderFile(simCode,guid), '<%fileNamePrefix%>.h')
let()= textFile(simulationHeaderFile(simCode,guid), '_<%fileNamePrefix%>.h')
let()= textFile(simulationFile(simCode,guid), '<%fileNamePrefix%>.c')
let()= textFile(fmumodel_identifierFile(simCode,guid), '<%fileNamePrefix%>_FMU.c')
let()= textFile(fmuModelDescriptionFile(simCode,guid), 'modelDescription.xml')
Expand Down Expand Up @@ -875,6 +875,7 @@ match platform
<%\t%> cp <%fileNamePrefix%>.dll <%fileNamePrefix%>/binaries/<%platform%>/
<%\t%> cp <%fileNamePrefix%>.lib <%fileNamePrefix%>/binaries/<%platform%>/
<%\t%> cp <%fileNamePrefix%>.c <%fileNamePrefix%>/sources/<%fileNamePrefix%>.c
<%\t%> cp _<%fileNamePrefix%>.h <%fileNamePrefix%>/sources/_<%fileNamePrefix%>.h
<%\t%> cp <%fileNamePrefix%>_FMU.c <%fileNamePrefix%>/sources/<%fileNamePrefix%>_FMU.c
<%\t%> cp <%fileNamePrefix%>_functions.c <%fileNamePrefix%>/sources/<%fileNamePrefix%>_functions.c
<%\t%> cp <%fileNamePrefix%>_functions.h <%fileNamePrefix%>/sources/<%fileNamePrefix%>_functions.h
Expand Down Expand Up @@ -907,6 +908,7 @@ match platform
<%\t%> cp <%fileNamePrefix%>$(DLLEXT) <%fileNamePrefix%>/binaries/<%platform%>/
<%\t%> cp <%fileNamePrefix%>_FMU.libs <%fileNamePrefix%>/binaries/<%platform%>/
<%\t%> cp <%fileNamePrefix%>.c <%fileNamePrefix%>/sources/<%fileNamePrefix%>.c
<%\t%> cp _<%fileNamePrefix%>.h <%fileNamePrefix%>/sources/_<%fileNamePrefix%>.h
<%\t%> cp <%fileNamePrefix%>_FMU.c <%fileNamePrefix%>/sources/<%fileNamePrefix%>_FMU.c
<%\t%> cp <%fileNamePrefix%>_functions.c <%fileNamePrefix%>/sources/<%fileNamePrefix%>_functions.c
<%\t%> cp <%fileNamePrefix%>_functions.h <%fileNamePrefix%>/sources/<%fileNamePrefix%>_functions.h
Expand Down Expand Up @@ -946,10 +948,9 @@ case SIMCODE(modelInfo=MODELINFO(__), makefileParams=MAKEFILE_PARAMS(__), simula
CFLAGS_BASED_ON_INIT_FILE=<%extraCflags%>
PLATLINUX = <%makefileParams.platform%>
PLAT34 = <%makefileParams.platform%>
CFLAGS=$(CFLAGS_BASED_ON_INIT_FILE) -I"<%makefileParams.omhome%>/include/omc2" <%makefileParams.cflags%> <%match sopt case SOME(s as SIMULATION_SETTINGS(__)) then s.cflags /* From the simulate() command */%>
CPPFLAGS=-I"<%makefileParams.omhome%>/include/omc2" -I. <%dirExtra%> <%makefileParams.includes ; separator=" "%>
LDFLAGS=-L"<%makefileParams.omhome%>/lib/omc2" -lSimulationRuntimeC -linteractive <%makefileParams.ldflags%>
SENDDATALIBS=<%makefileParams.senddatalibs%>
CFLAGS=$(CFLAGS_BASED_ON_INIT_FILE) -I"<%makefileParams.omhome%>/include/omc" <%makefileParams.cflags%> <%match sopt case SOME(s as SIMULATION_SETTINGS(__)) then s.cflags /* From the simulate() command */%>
CPPFLAGS=-I"<%makefileParams.omhome%>/include/omc" -I. <%dirExtra%> <%makefileParams.includes ; separator=" "%>
LDFLAGS=-L"<%makefileParams.omhome%>/lib/omc" -lSimulationRuntimeC -linteractive <%makefileParams.ldflags%>
PERL=perl
MAINFILE=<%fileNamePrefix%>_FMU<% if acceptMetaModelicaGrammar() then ".conv"%>.c
MAINOBJ=<%fileNamePrefix%>_FMU<% if acceptMetaModelicaGrammar() then ".conv"%>.o
Expand Down
7 changes: 2 additions & 5 deletions FMI/import/source/fmuWrapper.c
Expand Up @@ -8,11 +8,8 @@


/* Define for Debuging */
/*
#define _PRINT_OUT__
#define _DEBUG_
*/
extern int smi_verbose;
/* #define _PRINT_OUT__ */
/* #define _DEBUG_ */


#define BUFSIZE 4096
Expand Down
8 changes: 4 additions & 4 deletions FMI/import/source/moGenerator.c
Expand Up @@ -42,10 +42,10 @@
/* macro for screen printing */
#define QUOTEME_(x) #x
#define QUOTEME(x) QUOTEME_(x)
/* #define _DEBUG_ 1
* #define PRINT_INFORMATION
* #define _DEBUG_MODELICA 1
*/
/* #define _DEBUG_ 1 */
/*#define PRINT_INFORMATION
#define _DEBUG_MODELICA 1
*/

/* macro for error message print */
#define _IMPORT_ERROR_LOG_
Expand Down
10 changes: 5 additions & 5 deletions SimulationRuntime/fmi/export/fmu_model_interface.c
Expand Up @@ -113,7 +113,7 @@ fmiComponent fmiInstantiateModel(fmiString instanceName, fmiString GUID,
}
comp = (ModelInstance *)functions.allocateMemory(1, sizeof(ModelInstance));
if (comp) {
_X_DATA* fmudata = (_X_DATA *)functions.allocateMemory(1, sizeof(_X_DATA));
DATA* fmudata = (DATA *)functions.allocateMemory(1, sizeof(DATA));
comp->fmuData = fmudata;
if (!comp->fmuData) {
functions.logger(NULL, instanceName, fmiError, "error",
Expand All @@ -135,7 +135,7 @@ fmiComponent fmiInstantiateModel(fmiString instanceName, fmiString GUID,
"fmiInstantiateModel: GUID=%s", GUID);
/* intialize modelData */
initializeDataStruc_X_(comp->fmuData);
initializeXDataStruc(comp->fmuData);
initializeDataStruc(comp->fmuData);

comp->instanceName = instanceName;
comp->GUID = GUID;
Expand Down Expand Up @@ -172,7 +172,7 @@ void fmiFreeModelInstance(fmiComponent c) {
if (comp->loggingOn) comp->functions.logger(c, comp->instanceName, fmiOK, "log",
"fmiFreeModelInstance");

DeinitializeXDataStruc(comp->fmuData);
DeinitializeDataStruc(comp->fmuData);
comp->functions.freeMemory(comp);
}

Expand Down Expand Up @@ -554,7 +554,7 @@ fmiStatus fmiInitialize(fmiComponent c, fmiBoolean toleranceControlled, fmiReal
/*TODO: Simulation stop time is need to calculate in before hand all sample events
We shouldn't generate them all in beforehand */
initSample(comp->fmuData, comp->fmuData->localData[0]->timeValue, 100 /*should be stopTime*/);
initDelay(comp->fmuData->localData[0]->timeValue);
initDelay(comp->fmuData, comp->fmuData->localData[0]->timeValue);

if (initialization(comp->fmuData, "state", "nelder_mead_ex")){
comp->state = modelError;
Expand Down Expand Up @@ -648,7 +648,7 @@ fmiStatus fmiTerminate(fmiComponent c){

/* deinitDelay(comp->fmuData); */
callExternalObjectDestructors(comp->fmuData);
DeinitializeXDataStruc(comp->fmuData);
DeinitializeDataStruc(comp->fmuData);
free(comp->fmuData);

comp->state = modelTerminated;
Expand Down
2 changes: 1 addition & 1 deletion SimulationRuntime/fmi/export/fmu_model_interface.h
Expand Up @@ -62,7 +62,7 @@ typedef struct {
fmiEventInfo eventInfo;
fmiBoolean outputsvalid;
ModelState state;
_X_DATA* fmuData;
DATA* fmuData;
} ModelInstance;

fmiStatus setString(fmiComponent comp, fmiValueReference vr, fmiString value){
Expand Down

0 comments on commit d36c583

Please sign in to comment.