OpenModelica / OMSimulator

The OpenModelica FMI & SSP-based co-simulation environment.
Other
67 stars 49 forks source link

Use DefaultExperiment tag to set up simulation parameters when simulating a single FMU #1269

Closed casella closed 5 months ago

casella commented 8 months ago

The following command line call:

OMSimulator myModel.fmu

applied to a ME-FMU simulates the FMU with CVODE using the default values for --startTime, --stopTime, and --stepSize.

Steps to reproduce the behavior

Open the model M.mo.txt and generate a ME-FMU. Then, open Tools | OpenModelica Command Line Prompt and run

OMSimulator M.fmu

Despite modelDescription.xml containing the tag <DefaultExperiment startTime="0.0" stopTime="86400.0" tolerance="1e-6"/>, the simulation stops at time = 1 and has a step size of 1 ms.

Expected behavior

If the DefaultExperiment tag provides values for --startTime, --stopTime, stepSize and --tolerance, they should be used as defaults, instead of the built-in ones. Of course, values provided with the --startTime, --stopTime, and --tolerance parameters when calling OMSimulator from the command line should override these defaults.

If stepSize is not provided, a default value of (stopTime-startTime)/500 should be set.

arun3688 commented 8 months ago

@casella the issue is fixed with this commit https://github.com/OpenModelica/OMSimulator/commit/f7c50c96cc21dd851b7b3d906195672fbb79e23a

casella commented 8 months ago

Great, thanks!

casella commented 8 months ago

I'll check it with the next nightly

arun3688 commented 8 months ago

@casella I need to update the submodule to test with the nightly builds i will make a PR for that

casella commented 8 months ago

Looking at the latest master-fmi report, it seems @arun3688's PR OpenModelica/OMsimulator#1273 already had a quite favourable outcome: there were 4000 improvements and 2500 performance improvements, 1500 regressions, and 250 performance regressions 😃.

casella commented 5 months ago

Fixed by #1273