Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
niklwors committed Sep 14, 2015
2 parents 65812fa + fd981d3 commit 2c02f61
Show file tree
Hide file tree
Showing 164 changed files with 11,498 additions and 10,081 deletions.
4 changes: 2 additions & 2 deletions openmodelica/cppruntime/fmu/modelExchange/1.0/Makefile
Expand Up @@ -2,10 +2,10 @@ TEST = ../../../../../rtest -v


TESTFILES = \
CoupledClutches_FMU1_CPP.mos \
Crane_FMU1_CPP.mos

FAILINGTESTFILES =
FAILINGTESTFILES = \
CoupledClutches_FMU1_CPP.mos \

DEPENDENCIES = \
*.mo \
Expand Down
59 changes: 59 additions & 0 deletions openmodelica/cppruntime/fmu/modelExchange/2.0/DIC_FMU2_CPP.mos
@@ -0,0 +1,59 @@
// name: DIC_FMU2_CPP
// keywords: double integrator FMI-Export FMI-Import
// status: correct
// teardown_command: rm -rf binaries sources modelDescription.xml DIC.fmu *DIC*.so OMCppDIC*.cpp OMCppDIC*.h OMCppDIC*.o DIC*.json DIC_me_FMU.mo
// Real variables, Real input variable, continuous-time states, state events, event iteration

setCommandLineOptions("+simCodeTarget=Cpp"); getErrorString();
loadString("
model DIC
parameter Real p = 1;
parameter Real y1_start = 1;
parameter Real y2_start = 0;
input Real u(start = 0);
output Real y1, y2;
initial equation
y1 = y1_start;
y2 = y2_start;
equation
der(y1) = p * (u - 2);
der(y2) = y1;
end DIC;
");
translateModelFMU(DIC, version = "2.0"); getErrorString();

loadModel(Modelica); getErrorString();
importFMU("DIC.fmu"); getErrorString();
loadFile("DIC_me_FMU.mo"); getErrorString();
simulate(DIC_me_FMU); getErrorString();

val(u, 0);
val(y1, 0);
val(y2, 0);
val(y1, 1);
val(y2, 1);

// Result:
// true
// ""
// true
// "SimCode: The model DIC has been translated to FMU"
// ""
// true
// ""
// "DIC_me_FMU.mo"
// ""
// true
// ""
// record SimulationResult
// resultFile = "DIC_me_FMU_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'DIC_me_FMU', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
// messages = ""
// end SimulationResult;
// ""
// 0.0
// 1.0
// 0.0
// -1.0
// 0.0
// endResult
5 changes: 3 additions & 2 deletions openmodelica/cppruntime/fmu/modelExchange/2.0/Makefile
Expand Up @@ -2,9 +2,10 @@ TEST = ../../../../../rtest -v


TESTFILES = \
CoupledClutches_FMU2_CPP.mos
DIC_FMU2_CPP.mos

FAILINGTESTFILES =
FAILINGTESTFILES = \
CoupledClutches_FMU2_CPP.mos

DEPENDENCIES = \
*.mo \
Expand Down
2 changes: 2 additions & 0 deletions openmodelica/cppruntime/libraries/msl32/Makefile
Expand Up @@ -9,6 +9,7 @@ Modelica.Electrical.Spice3.Examples.CoupledInductors.mos \
Modelica.Electrical.Analog.Examples.ShowSaturatingInductor.mos \
Modelica.Mechanics.MultiBody.Examples.Elementary.DoublePendulum.mos \
Modelica.Mechanics.MultiBody.Examples.Elementary.RollingWheelSetDriving.mos \
Modelica.Mechanics.MultiBody.Examples.Elementary.SpringWithMass.mos \
Modelica.Mechanics.Rotational.Examples.Backlash.mos \
Modelica.Mechanics.Rotational.Examples.RollingWheel.mos \
Modelica.Mechanics.Translational.Examples.Accelerate.mos \
Expand All @@ -23,6 +24,7 @@ Modelica.Thermal.HeatTransfer.Examples.TwoMasses.mos \
Modelica.Electrical.Digital.Examples.Counter.mos \
Modelica.Utilities.Examples.readRealParameterModel.mos \


# tested features:
# readRealParameterModel: string handling, variable name string

Expand Down
Expand Up @@ -17,21 +17,17 @@ getErrorString();


// Result:
// "\"true
// \"
// OpenModelicaModelTesting.SimulationRuntime.Cpp
// true
// true
// "
// OpenModelicaModelTesting.Kind.VerifiedSimulation
// Modelica.Mechanics.MultiBody.Examples.Elementary.SpringWithMass
// "../../../../simulation/libraries/msl32/ReferenceFiles/Modelica.Mechanics.MultiBody.Examples.Elementary.SpringWithMass.mat"
// 0.0
// 0.01
// 0.0001
// "mat"
// {"body.frame_a.r_0[1]","body.frame_a.r_0[2]","body.frame_a.r_0[3]","body.v_0[1]","body.v_0[2]","body.v_0[3]","body.w_a[1]","body.w_a[2]","body.w_a[3]"}
// Simulation options: startTime = 0.0, stopTime = 5.0, numberOfIntervals = 500, tolerance = 0.000001, method = 'dassl', fileNamePrefix = 'Modelica.Mechanics.MultiBody.Examples.Elementary.SpringWithMass', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''
// Simulation options: startTime = 0.0, stopTime = 5.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'Modelica.Mechanics.MultiBody.Examples.Elementary.SpringWithMass', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''
// Result file: Modelica.Mechanics.MultiBody.Examples.Elementary.SpringWithMass_res.mat
// Files Equal!
// Warning: There are iteration variables with default zero start attribute. Use +d=initialization for more information.
//
// "true
// "
// ""
Expand Down

0 comments on commit 2c02f61

Please sign in to comment.