Running reference model BouncingBall.fmu causes infinite prints (error: [doStep] SUNDIALS_ERROR: CVode() failed with flag = -3)
Description
Running reference model BouncingBall.fmu causes infinite prints in console:
[CVODE ERROR] CVode
At t = 0.446 and h = 0.001, the error test failed repeatedly or with |h| = hmin.
error: [doStep] SUNDIALS_ERROR: CVode() failed with flag = -3
Steps to reproduce the behavior
- Download https://github.com/modelica/Reference-FMUs/releases/tag/v0.0.29
- Unzip
- Locate Reference-FMUs-0.0.29/2.0/BouncingBall.fmu
- Run the following OMSimulator.dll commands:
oms_setTempDirectory("C:/local/foobar/temp");
oms_newModel("m");
oms_addSystem("m.r", oms_system_sc);
oms_addSubModel("m.r.BB", "./Reference-FMUs-0.0.29/2.0/BouncingBall.fmu");
oms_setResultFile("m", "C:/local/foobar/result/results.csv", 100);
oms_setStopTime("m", 1.0);
oms_setStartTime("m", 0.0);
oms_setFixedStepSize("m.r", 0.001);
oms_instantiate("m");
oms_initialize("m");
oms_simulate("m");
oms_terminate("m");
Notice that as soon as you call "oms_simulate" the console will start filling with errors.
Expected behavior
The simulation should finish as expected. Running OMSimulator.exe from command-line works fine:
OMSimulator.exe --startTime=0.0 --stopTime=1.0 --resultFile="C:/local/foobar/result/results.csv" "./Reference-FMUs-0.0.29/2.0/BouncingBall.fmu"
Version and OS
- Version: v2.1.1.post247-g614c663-mingw-notlm-debug
- OS: Win11, 64bit
@GorbadPS3 you cannot use oms_setFixedStepSize("m.r", 0.001); when simulating a Strongly connected Components which is basically a ME fmu's see the documentation here https://openmodelica.org/doc/OpenModelicaUsersGuide/1.22/omsimulator.html#setfixedstepsize, So change the System type to oms_system_wc, see below
oms_addSystem("m.r", oms_system_wc);
or if you want to simulate as oms_system_sc, you must remove the oms_setFixedStepSize in your lua script,
If you want to set the stepSizes for SC system you should use oms_setVariableStepSize, https://openmodelica.org/doc/OpenModelicaUsersGuide/1.22/omsimulator.html#setvariablestepsize
Hi,
Thanks, that makes sense. What doesn't make sense is OMSimulator going into an infinite loop. The code should be able to notice the issue and return oms_status_error in cases like this.