Skip to content

Commit

Permalink
- all FMU-tests of the cpp-runtime use the c-runtime as import enviro…
Browse files Browse the repository at this point in the history
…nment now

- the crane-FMU tests should now work with GCC 4.4 again, so they are added to the test-process
  • Loading branch information
Marcus Walther committed Sep 25, 2015
1 parent cf47666 commit 4164dac
Show file tree
Hide file tree
Showing 12 changed files with 225 additions and 12 deletions.
Expand Up @@ -9,6 +9,7 @@ setCommandLineOptions("+simCodeTarget=Cpp"); getErrorString();
loadFile("CoupledClutches.mo"); getErrorString();
translateModelFMU(CoupledClutches); getErrorString();

setCommandLineOptions("+simCodeTarget=C"); getErrorString();
importFMU("CoupledClutches.fmu"); getErrorString();
loadFile("CoupledClutches_me_FMU.mo"); getErrorString();
simulate(CoupledClutches_me_FMU, numberOfIntervals=150, variableFilter="J1_w1|J2_w1|J3_w1|J4_w1"); getErrorString();
Expand Down
Expand Up @@ -8,6 +8,7 @@ setCommandLineOptions("+simCodeTarget=Cpp"); getErrorString();
loadFile("cranes.mo"); getErrorString();
translateModelFMU(cranes.crane); getErrorString();

setCommandLineOptions("+simCodeTarget=C"); getErrorString();
//importFMU("cranes_crane.fmu", "<default>", 6, false, true); getErrorString();
importFMU("cranes_crane.fmu", "<default>"); getErrorString();
loadFile("cranes_crane_me_FMU.mo"); getErrorString();
Expand All @@ -27,6 +28,8 @@ val(prismatic_v, 1);
// ""
// "SimCode: The model cranes.crane has been translated to FMU"
// ""
// true
// ""
// "cranes_crane_me_FMU.mo"
// ""
// true
Expand Down Expand Up @@ -64,6 +67,6 @@ val(prismatic_v, 1);
// [openmodelica/cppruntime/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1695:3-1695:195:writable] Warning: Parameter world_z_label_cylinders_2__shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="cylinder") as default value.
// [openmodelica/cppruntime/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1696:3-1696:195:writable] Warning: Parameter world_z_label_cylinders_3__shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="cylinder") as default value.
// "
// 0.9493545677180412
// 0.3948240973749629
// 0.9493545676148136
// 0.3948240567413477
// endResult
Expand Up @@ -23,6 +23,7 @@ end DIC;
translateModelFMU(DIC); getErrorString();

loadModel(Modelica); getErrorString();
setCommandLineOptions("+simCodeTarget=C"); getErrorString();
importFMU("DIC.fmu"); getErrorString();
loadFile("DIC_me_FMU.mo"); getErrorString();
simulate(DIC_me_FMU); getErrorString();
Expand All @@ -41,6 +42,8 @@ val(y2, 1);
// ""
// true
// ""
// true
// ""
// "DIC_me_FMU.mo"
// ""
// true
Expand All @@ -55,5 +58,5 @@ val(y2, 1);
// 1.0
// 0.0
// -1.0
// 0.0
// -1.397697929617081e-11
// endResult
7 changes: 4 additions & 3 deletions openmodelica/cppruntime/fmu/modelExchange/1.0/Makefile
Expand Up @@ -2,11 +2,11 @@ TEST = ../../../../../rtest -v


TESTFILES = \
DIC_FMU1_CPP.mos
DIC_FMU1_CPP.mos \
Crane_FMU1_CPP.mos

FAILINGTESTFILES = \
Crane_FMU1_CPP.mos \
CoupledClutches_FMU1_CPP.mos \
CoupledClutches_FMU1_CPP.mos

DEPENDENCIES = \
*.mo \
Expand All @@ -28,6 +28,7 @@ test:
clean :
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp
@rm -rf $(CLEAN)
@rm *_me_FMU.mo

getdeps:
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp
Expand Down
@@ -0,0 +1,50 @@
// name: Modelica.Fluid.Examples.BranchingDynamicPipes_FMI_1_0
// keywords: simulation MSL Examples FMI-Export FMI-Import
// status: correct
//
// Simulation Results
// Modelica Standard Library
//

loadModel(Modelica, {"3.2.1"}); getErrorString();
setCommandLineOptions("+simCodeTarget=Cpp"); getErrorString();
translateModelFMU(Modelica.Fluid.Examples.BranchingDynamicPipes); getErrorString();

setCommandLineOptions("+simCodeTarget=C"); getErrorString();
importFMU("Modelica_Fluid_Examples_BranchingDynamicPipes.fmu"); getErrorString();
loadFile("Modelica_Fluid_Examples_BranchingDynamicPipes_me_FMU.mo"); getErrorString();
simulate(Modelica_Fluid_Examples_BranchingDynamicPipes_me_FMU); getErrorString();

resultFile := "Modelica_Fluid_Examples_BranchingDynamicPipes_me_FMU_res.mat";
referenceFile := getEnvironmentVar("REFERENCEFILES") + "/msl32/Modelica.Fluid.Examples.BranchingDynamicPipes.mat";

//val(pipe1_mediums_1__p, 5);
//val(pipe3_flowModel_m_flows_1_, 5);
//val(pipe4_mediums_5__p, 5);
//val(pipe3_flowModel_m_flows_5_, 5);

// Result:
// true
// ""
// true
// ""
// true
// ""
// "SimCode: The model CoupledClutches has been translated to FMU"
// "Warning: There are iteration variables with default zero start attribute. Use +d=initialization for more information.
// "
// "CoupledClutches_me_FMU.mo"
// ""
// true
// ""
// record SimulationResult
// resultFile = "CoupledClutches_me_FMU_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.5, numberOfIntervals = 150, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'CoupledClutches_me_FMU', options = '', outputFormat = 'mat', variableFilter = 'J1_w1|J2_w1|J3_w1|J4_w1', cflags = '', simflags = ''",
// messages = ""
// end SimulationResult;
// ""
// 3.235409814452836
// 3.382195820527042
// 3.382195822575476
// -5.144123568889825e-06
// endResult
Expand Up @@ -9,6 +9,7 @@ setCommandLineOptions("+simCodeTarget=Cpp"); getErrorString();
loadFile("CoupledClutches.mo"); getErrorString();
translateModelFMU(CoupledClutches, version = "2.0"); getErrorString();

setCommandLineOptions("+simCodeTarget=C"); getErrorString();
importFMU("CoupledClutches.fmu"); getErrorString();
loadFile("CoupledClutches_me_FMU.mo"); getErrorString();
simulate(CoupledClutches_me_FMU, numberOfIntervals=150, variableFilter="J1_w1|J2_w1|J3_w1|J4_w1"); getErrorString();
Expand Down
Expand Up @@ -22,6 +22,7 @@ end DIC;
");
translateModelFMU(DIC, version = "2.0"); getErrorString();

setCommandLineOptions("+simCodeTarget=C"); getErrorString();
loadModel(Modelica); getErrorString();
importFMU("DIC.fmu"); getErrorString();
loadFile("DIC_me_FMU.mo"); getErrorString();
Expand All @@ -41,6 +42,8 @@ val(y2, 1);
// ""
// true
// ""
// true
// ""
// "DIC_me_FMU.mo"
// ""
// true
Expand All @@ -54,6 +57,6 @@ val(y2, 1);
// 0.0
// 1.0
// 0.0
// -1.0
// 0.0
// -0.9999999997999998
// 8.602324061413036e-11
// endResult
1 change: 1 addition & 0 deletions openmodelica/cppruntime/fmu/modelExchange/2.0/Makefile
Expand Up @@ -27,6 +27,7 @@ test:
clean :
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp
@rm -rf $(CLEAN)
@rm *_me_FMU.mo

getdeps:
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp
Expand Down
Expand Up @@ -5,11 +5,13 @@
// Real variables, Real input variable, continuous-time states, state events, event iteration

loadModel(Modelica); getErrorString();
setDebugFlags("hpcom"); getErrorString();
setDebugFlags("hpcom,hardcodedStartValues"); getErrorString();
setCommandLineOptions("+simCodeTarget=Cpp +n=1 +hpcomCode=openmp +hpcomScheduler=level"); getErrorString();
loadFile("CoupledClutches.mo"); getErrorString();
translateModelFMU(CoupledClutches); getErrorString();

clearDebugFlags(); getErrorString();
setCommandLineOptions("+simCodeTarget=C"); getErrorString();
//importFMU("CoupledClutches.fmu", "<default>", 6, true, true); getErrorString();
importFMU("CoupledClutches.fmu"); getErrorString();
loadFile("CoupledClutches_me_FMU.mo"); getErrorString();
Expand Down
@@ -0,0 +1,64 @@
// name: CoupledClutches_HPCOM_FMI_1_0_CPP_HPCOM
// keywords: CoupledClutches FMI-Export FMI-Import
// status: correct
// teardown_command: rm -rf binaries sources modelDescription.xml CoupledClutches.fmu CoupledClutches_me_FMU.mo CoupledClutches.lib* CoupledClutches.so CoupledClutches.dll CoupledClutches_*.c CoupledClutches_*.h CoupledClutches_*.o CoupledClutches_*.json
// Real variables, Real input variable, continuous-time states, state events, event iteration

loadModel(Modelica); getErrorString();
setDebugFlags("hpcom,hardcodedStartValues"); getErrorString();
setCommandLineOptions("+simCodeTarget=Cpp +n=2 +hpcomCode=openmp +hpcomScheduler=list"); getErrorString();
loadFile("CoupledClutches.mo"); getErrorString();
translateModelFMU(CoupledClutches); getErrorString();


setCommandLineOptions("+simCodeTarget=C"); getErrorString();
clearDebugFlags(); getErrorString();
//importFMU("CoupledClutches.fmu", "<default>", 6, true, true); getErrorString();
importFMU("CoupledClutches.fmu"); getErrorString();
loadFile("CoupledClutches_me_FMU.mo"); getErrorString();
simulate(CoupledClutches_me_FMU, numberOfIntervals=150, variableFilter="J1_w1|J2_w1|J3_w1|J4_w1"); getErrorString();

val(J1_w1, 1);
val(J2_w1, 1);
val(J3_w1, 1);
val(J4_w1, 1);

// Result:
// true
// ""
// true
// ""
// true
// ""
// true
// ""
// readCalcTimesFromFile: No valid profiling-file found.
// Warning: The costs have been estimated. Maybe CoupledClutches_eqs_prof-file is missing.
// Using list Scheduler for the DAE system
// Using list Scheduler for the ODE system
// Using list Scheduler for the ZeroFunc system
// HpcOm is still under construction.
// "SimCode: The model CoupledClutches has been translated to FMU"
// "Warning: There are iteration variables with default zero start attribute. Use +d=initialization for more information.
// "
// "CoupledClutches_me_FMU.mo"
// ""
// true
// ""
// readCalcTimesFromFile: No valid profiling-file found.
// Warning: The costs have been estimated. Maybe CoupledClutches_me_FMU_eqs_prof-file is missing.
// Using level Scheduler for the DAE system
// Using level Scheduler for the ODE system
// Using level Scheduler for the ZeroFunc system
// HpcOm is still under construction.
// record SimulationResult
// resultFile = "CoupledClutches_me_FMU_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.5, numberOfIntervals = 150, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'CoupledClutches_me_FMU', options = '', outputFormat = 'mat', variableFilter = 'J1_w1|J2_w1|J3_w1|J4_w1', cflags = '', simflags = ''",
// messages = ""
// end SimulationResult;
// ""
// 3.044323911098361
// 3.242493326997348
// 3.242493328798009
// -1.000195481992705e-10
// endResult
@@ -0,0 +1,82 @@
// name: Crane_HPCOM_FMI_1_0_CPP_HPCOM
// keywords: Crane FMI-Export FMI-Import
// status: correct
// Real variables, Real input variable, continuous-time states, state events, event iteration

loadModel(Modelica); getErrorString();
setDebugFlags("hpcom,hardcodedStartValues"); getErrorString();
setCommandLineOptions("+simCodeTarget=Cpp +n=2 +hpcomCode=openmp +hpcomScheduler=level"); getErrorString();
loadFile("cranes.mo"); getErrorString();
translateModelFMU(cranes.crane); getErrorString();

setCommandLineOptions("+simCodeTarget=C"); getErrorString();
clearDebugFlags(); getErrorString();
//importFMU("cranes_crane.fmu", "<default>", 6); getErrorString();
importFMU("cranes_crane.fmu"); getErrorString();
loadFile("cranes_crane_me_FMU.mo"); getErrorString();
simulate(cranes_crane_me_FMU, numberOfIntervals=150); getErrorString();

val(position_s, 1);
val(prismatic_v, 1);

// Result:
// true
// ""
// true
// ""
// true
// ""
// true
// ""
// readCalcTimesFromFile: No valid profiling-file found.
// Warning: The costs have been estimated. Maybe cranes_crane_eqs_prof-file is missing.
// Using level Scheduler for the DAE system
// Using level Scheduler for the ODE system
// Using level Scheduler for the ZeroFunc system
// HpcOm is still under construction.
// "SimCode: The model cranes.crane has been translated to FMU"
// ""
// true
// ""
// true
// ""
// "cranes_crane_me_FMU.mo"
// ""
// true
// ""
// record SimulationResult
// resultFile = "cranes_crane_me_FMU_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 150, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'cranes_crane_me_FMU', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
// messages = ""
// end SimulationResult;
// "[openmodelica/cppruntime/hpcom/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1670:3-1670:182:writable] Warning: Parameter body_cylinder_shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="cylinder") as default value.
// [openmodelica/cppruntime/hpcom/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1671:3-1671:178:writable] Warning: Parameter body_sphere_shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="sphere") as default value.
// [openmodelica/cppruntime/hpcom/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1672:3-1672:102:writable] Warning: Parameter bodyShape_frameTranslation_shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="cylinder") as default value.
// [openmodelica/cppruntime/hpcom/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1673:3-1673:185:writable] Warning: Parameter bodyShape_shape1_shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="cylinder") as default value.
// [openmodelica/cppruntime/hpcom/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1674:3-1674:183:writable] Warning: Parameter bodyShape_shape2_shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="sphere") as default value.
// [openmodelica/cppruntime/hpcom/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1675:3-1675:85:writable] Warning: Parameter bodyShape_shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="cylinder") as default value.
// [openmodelica/cppruntime/hpcom/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1676:3-1676:191:writable] Warning: Parameter fixedTranslation_shape_shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="cylinder") as default value.
// [openmodelica/cppruntime/hpcom/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1677:3-1677:92:writable] Warning: Parameter fixedTranslation_shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="cylinder") as default value.
// [openmodelica/cppruntime/hpcom/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1678:3-1678:177:writable] Warning: Parameter prismatic_box_shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="box") as default value.
// [openmodelica/cppruntime/hpcom/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1679:3-1679:186:writable] Warning: Parameter revolute_cylinder_shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="cylinder") as default value.
// [openmodelica/cppruntime/hpcom/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1680:3-1680:187:writable] Warning: Parameter world_gravityArrowHead_shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="cone") as default value.
// [openmodelica/cppruntime/hpcom/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1681:3-1681:191:writable] Warning: Parameter world_gravityArrowLine_shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="cylinder") as default value.
// [openmodelica/cppruntime/hpcom/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1682:3-1682:90:writable] Warning: Parameter world_label1 has no value, and is fixed during initialization (fixed=true), using available start value (start="x") as default value.
// [openmodelica/cppruntime/hpcom/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1683:3-1683:88:writable] Warning: Parameter world_label2 has no value, and is fixed during initialization (fixed=true), using available start value (start="y") as default value.
// [openmodelica/cppruntime/hpcom/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1684:3-1684:182:writable] Warning: Parameter world_x_arrowHead_shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="cone") as default value.
// [openmodelica/cppruntime/hpcom/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1685:3-1685:186:writable] Warning: Parameter world_x_arrowLine_shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="cylinder") as default value.
// [openmodelica/cppruntime/hpcom/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1686:3-1686:195:writable] Warning: Parameter world_x_label_cylinders_1__shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="cylinder") as default value.
// [openmodelica/cppruntime/hpcom/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1687:3-1687:195:writable] Warning: Parameter world_x_label_cylinders_2__shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="cylinder") as default value.
// [openmodelica/cppruntime/hpcom/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1688:3-1688:182:writable] Warning: Parameter world_y_arrowHead_shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="cone") as default value.
// [openmodelica/cppruntime/hpcom/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1689:3-1689:186:writable] Warning: Parameter world_y_arrowLine_shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="cylinder") as default value.
// [openmodelica/cppruntime/hpcom/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1690:3-1690:195:writable] Warning: Parameter world_y_label_cylinders_1__shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="cylinder") as default value.
// [openmodelica/cppruntime/hpcom/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1691:3-1691:195:writable] Warning: Parameter world_y_label_cylinders_2__shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="cylinder") as default value.
// [openmodelica/cppruntime/hpcom/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1692:3-1692:182:writable] Warning: Parameter world_z_arrowHead_shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="cone") as default value.
// [openmodelica/cppruntime/hpcom/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1693:3-1693:186:writable] Warning: Parameter world_z_arrowLine_shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="cylinder") as default value.
// [openmodelica/cppruntime/hpcom/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1694:3-1694:195:writable] Warning: Parameter world_z_label_cylinders_1__shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="cylinder") as default value.
// [openmodelica/cppruntime/hpcom/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1695:3-1695:195:writable] Warning: Parameter world_z_label_cylinders_2__shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="cylinder") as default value.
// [openmodelica/cppruntime/hpcom/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1696:3-1696:195:writable] Warning: Parameter world_z_label_cylinders_3__shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="cylinder") as default value.
// "
// 0.9493545676148136
// 0.3948240567413477
// endResult
8 changes: 5 additions & 3 deletions openmodelica/cppruntime/hpcom/fmu/modelExchange/1.0/Makefile
Expand Up @@ -2,10 +2,11 @@ TEST = ../../../../../../rtest -v


TESTFILES = \
CoupledClutches_FMU1_CPP_HPCOM.mos \
Crane_FMU1_CPP_HPCOM.mos

FAILINGTESTFILES =
FAILINGTESTFILES = \
CoupledClutches_FMU1_CPP_HPCOM.mos


DEPENDENCIES = \
*.mo \
Expand All @@ -26,7 +27,8 @@ test:

clean :
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp
@rm -f $(CLEAN)
@rm -rf $(CLEAN)
@rm *_me_FMU.mo

getdeps:
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp
Expand Down

0 comments on commit 4164dac

Please sign in to comment.