-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Description
Description
There are 2 identical lines written to the CSV output for each timestamp when simulating a cosimulation FMU. If the FMU is built as a model exchange FMU, this does not occur.
Steps to reproduce the behavior
Create the files BouncingBall.mo and build.mos, then run the shell commands, and inspect res.csv.
BouncingBall.mo
model BouncingBall "The 'classic' bouncing ball model"
type Height=Real(unit="m");
type Velocity=Real(unit="m/s");
parameter Real e=0.8 "Coefficient of restitution";
parameter Height h0=1.0 "Initial height";
Height h "Height";
Velocity v(start=0.0, fixed=true) "Velocity";
initial equation
h = h0;
equation
v = der(h);
der(v) = -9.81;
when h<0 then
reinit(v, -e*pre(v));
end when;
end BouncingBall;
build.mos
loadFile("BouncingBall.mo");
buildModelFMU(BouncingBall, version="2.0", fmuType="cs");
Shell commands
omc build.mos
OMSimulator --resultFile=res.csv BouncingBall.fmuOutput (res.csv)
time,h,v,der(h),der(v)
0, 1, 0, 0, -9.81
0.002, 1, -0.01962, -0.01962, -9.81
0.002, 1, -0.01962, -0.01962, -9.81
0.004, 0.99996076, -0.03924, -0.03924, -9.81
0.004, 0.99996076, -0.03924, -0.03924, -9.81
0.006, 0.99988228, -0.05886, -0.05886, -9.81
0.006, 0.99988228, -0.05886, -0.05886, -9.81
0.008, 0.99976456, -0.07848, -0.07848, -9.81
0.008, 0.99976456, -0.07848, -0.07848, -9.81Expected behavior
I expect the output file to not have 2 entries for each timestamp.
Screenshots
N/A
Version and OS
- Version: OMSimulator 2.1.3~9-ge3a3aeb4-linux-notlm-debug
- OMC Version: OpenModelica 1.26.1
- OS: Debian GNU/Linux 13 (trixie)
Extra details
As far as I can tell this is an issue with OMSimulator and not the FMU itself, because fmusim from modelica/Reference-FMUs doesn't exhibit this behavior.
Metadata
Metadata
Assignees
Labels
No labels