Skip to content

Commit

Permalink
I have added 3 FMI tests to the cppruntime-folder, to test the FMU 1.…
Browse files Browse the repository at this point in the history
…0 and 2.0 export (model exchange). Furthermore I have removed the old FMU-tests and reactivated the Umfpack-test of the c++ simulation runtime. The new static linking test is not working at the moment and thus part of FAILINGTEST.
  • Loading branch information
Marcus Walther committed Jun 24, 2015
1 parent b3d69fc commit c0723f7
Show file tree
Hide file tree
Showing 24 changed files with 658 additions and 624 deletions.
21 changes: 20 additions & 1 deletion Makefile
Expand Up @@ -20,6 +20,10 @@ flatteningPlanarMechanics.log \
TestMedia.log \
cppruntime.log \
cppruntimeHpcom.log \
cppruntimeFMU1.log \
cppruntimeFMU2.log \
cppruntimeUmfpack.log \
cppruntimeStaticLinking.log \
taskGraph.log \
debugDumps.log \
dumpCruntime.log \
Expand Down Expand Up @@ -368,6 +372,18 @@ cppruntime.log: omc-diff
cppruntimeHpcom.log: omc-diff
$(MAKE) -j1 -C openmodelica/cppruntime/hpcom -f Makefile test > $@
@echo $@ done
cppruntimeFMU1.log: omc-diff
$(MAKE) -j1 -C openmodelica/cppruntime/fmu/modelExchange/1.0 -f Makefile test > $@
@echo $@ done
cppruntimeFMU2.log: omc-diff
$(MAKE) -j1 -C openmodelica/cppruntime/fmu/modelExchange/2.0 -f Makefile test > $@
@echo $@ done
cppruntimeUmfpack.log: omc-diff
$(MAKE) -j1 -C openmodelica/cppruntime/umfpack -f Makefile test > $@
@echo $@ done
cppruntimeStaticLinking.log: omc-diff
$(MAKE) -j1 -C openmodelica/cppruntime/staticLinking -f Makefile test > $@
@echo $@ done
linearization.log: omc-diff
$(MAKE) -C openmodelica/linearization -f Makefile test > $@
@echo $@ done
Expand Down Expand Up @@ -567,6 +583,10 @@ clean_g_2 :
$(MAKE) -C metamodelica/meta -f Makefile clean
$(MAKE) -C openmodelica/cppruntime -f Makefile clean
$(MAKE) -C openmodelica/cppruntime/hpcom -f Makefile clean
$(MAKE) -C openmodelica/cppruntime/fmu/modelExchange/1.0 -f Makefile clean
$(MAKE) -C openmodelica/cppruntime/fmu/modelExchange/2.0 -f Makefile clean
$(MAKE) -C openmodelica/cppruntime/umfpack -f Makefile clean
$(MAKE) -C openmodelica/cppruntime/staticLinking -f Makefile clean
$(MAKE) -C openmodelica/cruntime/optimization/basic -f Makefile clean
$(MAKE) -C openmodelica/cruntime/xmlFiles -f Makefile clean
$(MAKE) -C openmodelica/debugDumps -f Makefile clean
Expand Down Expand Up @@ -643,7 +663,6 @@ git-sanity-check: git-clean
find -name "*.a" >> invalid-files.log
find -name "*.mat" >> invalid-files.log
find -name "*.csv" >> invalid-files.log
(find -type f -executable -exec file -i '{}' ";" | grep -s charset=binary >> invalid-files.log) || true
sort invalid-files.log > invalid-files.sorted
sort .gitvalidfiles > .gitvalidfiles.sorted
comm --check-order -23 invalid-files.sorted .gitvalidfiles.sorted > invalid-files.log
Expand Down
26 changes: 0 additions & 26 deletions openmodelica/cppruntime/BouncingBall.def

This file was deleted.

37 changes: 0 additions & 37 deletions openmodelica/cppruntime/BouncingBallFMI.mos

This file was deleted.

17 changes: 15 additions & 2 deletions openmodelica/cppruntime/Makefile
Expand Up @@ -39,12 +39,17 @@ testTables2.txt \
testTables2D.txt \
hpcom \
umfpack \
fmu \
staticLinking \
ReferenceFiles \
libraries

CLEAN = `ls | grep -w -v -f deps.tmp`
HPCOM_DIR = hpcom/
UMFPACK_DIR = umfpack/
FMI_1_0_DIR = fmu/modelExchange/1.0
FMI_2_0_DIR = fmu/modelExchange/2.0
STATIC_LINKING_DIR = staticLinking

.PHONY : test clean getdeps

Expand All @@ -55,14 +60,22 @@ test:
@echo OPENMODELICAHOME=" $(OPENMODELICAHOME) "
@$(TEST) $(TESTFILES)
@$(MAKE) -C $(HPCOM_DIR)
#@$(MAKE) -C $(UMFPACK_DIR)
@$(MAKE) -C $(UMFPACK_DIR)
@$(MAKE) -C $(FMI_1_0_DIR)
@$(MAKE) -C $(FMI_2_0_DIR)
@$(MAKE) -C $(STATIC_LINKING_DIR)


# Cleans all files that are not listed as dependencies
clean :
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp
@rm -f $(CLEAN)
@$(MAKE) -C $(HPCOM_DIR) clean
#@$(MAKE) -C $(UMFPACK_DIR) clean
@$(MAKE) -C $(UMFPACK_DIR) clean
@$(MAKE) -C $(FMI_1_0_DIR) clean
@$(MAKE) -C $(FMI_2_0_DIR) clean
@$(MAKE) -C $(STATIC_LINKING_DIR) clean


# Run this if you want to list out the files (dependencies).
# do it after cleaning and updating the folder
Expand Down
107 changes: 0 additions & 107 deletions openmodelica/cppruntime/ReferenceFiles/BouncingBall.csv

This file was deleted.

37 changes: 0 additions & 37 deletions openmodelica/cppruntime/WhenStatement1FMI.mos

This file was deleted.

59 changes: 59 additions & 0 deletions openmodelica/cppruntime/fmu/modelExchange/1.0/CoupledClutches.mo
@@ -0,0 +1,59 @@
model CoupledClutches "Drive train with 3 dynamically coupled clutches"
extends Modelica.Icons.Example;
parameter Modelica.SIunits.Frequency freqHz = 0.2 "Frequency of sine function to invoke clutch1";
parameter Modelica.SIunits.Time T2 = 0.4 "Time when clutch2 is invoked";
parameter Modelica.SIunits.Time T3 = 0.9 "Time when clutch3 is invoked";
Modelica.Mechanics.Rotational.Components.Inertia J1(J = 1, phi(fixed = true, start = 0), w(start = 10, fixed = true)) annotation(Placement(transformation(extent = {{-70, -10}, {-50, 10}}, rotation = 0)));
Modelica.Mechanics.Rotational.Sources.Torque torque(useSupport = true) annotation(Placement(transformation(extent = {{-100, -10}, {-80, 10}}, rotation = 0)));
Modelica.Mechanics.Rotational.Components.Clutch clutch1(peak = 1.1, fn_max = 20) annotation(Placement(transformation(extent = {{-40, -10}, {-20, 10}}, rotation = 0)));
Modelica.Blocks.Sources.Sine sin1(amplitude = 10, freqHz = 5) annotation(Placement(transformation(extent = {{-130, -10}, {-110, 10}}, rotation = 0)));
Modelica.Blocks.Sources.Step step1(startTime = T2) annotation(Placement(transformation(origin = {25, 35}, extent = {{-5, -5}, {15, 15}}, rotation = 270)));
Modelica.Mechanics.Rotational.Components.Inertia J2(J = 1, phi(fixed = true, start = 0), w(fixed = true, start = 0)) annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.Rotational.Components.Clutch clutch2(peak = 1.1, fn_max = 20) annotation(Placement(transformation(extent = {{20, -10}, {40, 10}}, rotation = 0)));
Modelica.Mechanics.Rotational.Components.Inertia J3(J = 1, phi(fixed = true, start = 0), w(fixed = true, start = 0)) annotation(Placement(transformation(extent = {{50, -10}, {70, 10}}, rotation = 0)));
Modelica.Mechanics.Rotational.Components.Clutch clutch3(peak = 1.1, fn_max = 20) annotation(Placement(transformation(extent = {{80, -10}, {100, 10}}, rotation = 0)));
Modelica.Mechanics.Rotational.Components.Inertia J4(J = 1, phi(fixed = true, start = 0), w(fixed = true, start = 0)) annotation(Placement(transformation(extent = {{110, -10}, {130, 10}}, rotation = 0)));
Modelica.Blocks.Sources.Sine sin2(amplitude = 1, freqHz = freqHz, phase = 1.57) annotation(Placement(transformation(origin = {-35, 35}, extent = {{-5, -5}, {15, 15}}, rotation = 270)));
input Real step2;
output Real J1_w1, J2_w1, J3_w1, J4_w1;
Modelica.Mechanics.Rotational.Components.Fixed fixed annotation(Placement(transformation(extent = {{-100, -30}, {-80, -10}}, rotation = 0)));
equation
J1_w1 = J1.w;
J2_w1 = J2.w;
J3_w1 = J3.w;
J4_w1 = J4.w;
connect(torque.flange, J1.flange_a) annotation(Line(points = {{-80, 0}, {-70, 0}}, color = {0, 0, 0}));
connect(J1.flange_b, clutch1.flange_a) annotation(Line(points = {{-50, 0}, {-40, 0}}, color = {0, 0, 0}));
connect(clutch1.flange_b, J2.flange_a) annotation(Line(points = {{-20, 0}, {-10, 0}}, color = {0, 0, 0}));
connect(J2.flange_b, clutch2.flange_a) annotation(Line(points = {{10, 0}, {10, 0}, {20, 0}}, color = {0, 0, 0}));
connect(clutch2.flange_b, J3.flange_a) annotation(Line(points = {{40, 0}, {50, 0}}, color = {0, 0, 0}));
connect(J3.flange_b, clutch3.flange_a) annotation(Line(points = {{70, 0}, {80, 0}}, color = {0, 0, 0}));
connect(clutch3.flange_b, J4.flange_a) annotation(Line(points = {{100, 0}, {110, 0}}, color = {0, 0, 0}));
connect(sin1.y, torque.tau) annotation(Line(points = {{-109, 0}, {-102, 0}}, color = {0, 0, 127}));
connect(sin2.y, clutch1.f_normalized) annotation(Line(points = {{-30, 19}, {-30, 19}, {-30, 11}}, color = {0, 0, 127}));
connect(step1.y, clutch2.f_normalized) annotation(Line(points = {{30, 19}, {30, 19}, {30, 10}, {30, 11}}, color = {0, 0, 127}));
connect(step2, clutch3.f_normalized) annotation(Line(points = {{90, 19}, {90, 19}, {90, 11}}, color = {0, 0, 127}));
connect(fixed.flange, torque.support) annotation(Line(points = {{-90, -20}, {-90, -11}, {-90, -10}}, color = {0, 0, 0}));
annotation(Documentation(info = "<html>
<p>This example demonstrates how variable structure
drive trains are handled. The drive train consists
of 4 inertias and 3 clutches, where the clutches
are controlled by input signals. The system has
2^3=8 different configurations and 3^3 = 27
different states (every clutch may be in forward
sliding, backward sliding or locked mode when the
relative angular velocity is zero). By invoking the
clutches at different time instances, the switching
of the configurations can be studied.</p>
<p>Simulate the system for 1.2 seconds with the
following initial values:<br>
J1.w = 10.</p>
<p>Plot the following variables:<br>
angular velocities of inertias (J1.w, J2.w, J3.w,
J4.w), frictional torques of clutches (clutchX.tau),
frictional mode of clutches (clutchX.mode) where
mode = -1/0/+1 means backward sliding,
locked, forward sliding.</p>
</HTML>"), __Dymola_Commands(file = "modelica://Modelica/Resources/Scripts/Dymola/Mechanics/Rotational/CoupledClutches.mos" "Simulate and Plot"), experiment(StopTime = 1.5, Interval = 0.001), Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-140, -100}, {140, 100}})), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}})));
end CoupledClutches;
31 changes: 31 additions & 0 deletions openmodelica/cppruntime/fmu/modelExchange/1.0/CoupledClutches.mos
@@ -0,0 +1,31 @@
// name: CoupledClutches_FMI_1_0_CPP
// 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();
setCommandLineOptions("+simCodeTarget=Cpp"); getErrorString();
loadFile("CoupledClutches.mo"); getErrorString();
translateModelFMU(CoupledClutches); 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
// ""
// "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.
// "
// endResult

0 comments on commit c0723f7

Please sign in to comment.