Skip to content

Commit

Permalink
[FMI] Check external FMU simulator
Browse files Browse the repository at this point in the history
  - Simulate bouncing ball model with fmuCheck and validate results.
  - Added test to cross-build-fmu in Jenkinsfile
  • Loading branch information
AnHeuermann committed Jun 17, 2020
1 parent 688d750 commit 32a1985
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion testsuite/special/FmuExportCrossCompile/check-files.mos
@@ -1,4 +1,4 @@
for m in {"FmuExportCrossCompile","RoomHeating_OM_RH","WaterTank_Control","WaterTank_TestSingleWaterTank"} loop
for m in {"FmuExportCrossCompile","RoomHeating_OM_RH","WaterTank_Control","WaterTank_TestSingleWaterTank","BouncingBall"} loop
for os in {"linux32","linux64","win32","win64","darwin64","arm-linux-gnueabi"} loop // "darwin32"
for t in {"me","cs"} loop

Expand Down
Expand Up @@ -16,6 +16,30 @@ if not loadFile("WaterTank.mo") then
exit(1);
end if;
getErrorString();
if not loadString("model BouncingBall
parameter Real e=0.7 \"coefficient of restitution\";
parameter Real g=9.81 \"gravity acceleration\";
Real h(fixed=true, start=1) \"height of ball\";
Real v(fixed=true) \"velocity of ball\";
Boolean flying(fixed=true, start=true) \"true, if ball is flying\";
Boolean impact;
Real v_new(fixed=true);
Integer foo;
equation
impact = h <= 0.0;
foo = if impact then 1 else 2;
der(v) = if flying then -g else 0;
der(h) = v;
when {h <= 0.0 and v <= 0.0,impact} then
v_new = if edge(impact) then -e*pre(v) else 0;
flying = v_new > 0;
reinit(v, v_new);
end when;
end BouncingBall;") then
print(getErrorString());
exit(1);
end if;
getErrorString();
if not loadString("model FmuExportCrossCompile
parameter Real e=0.7;
parameter Real g=9.81;
Expand Down Expand Up @@ -59,7 +83,7 @@ platforms := if false then {
"i686-w64-mingw32"
};

for c in {"FmuExportCrossCompile","RoomHeating_OM.RH","WaterTank.Control","WaterTank.TestSingleWaterTank"} loop
for c in {"FmuExportCrossCompile","RoomHeating_OM.RH","WaterTank.Control","WaterTank.TestSingleWaterTank","BouncingBall"} loop
c2 := stringReplace(c, ".", "_");
print(c2+"
");
Expand Down

0 comments on commit 32a1985

Please sign in to comment.