Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running reference model BouncingBall.fmu causes infinite prints (error: [doStep] SUNDIALS_ERROR: CVode() failed with flag = -3) #1281

Open
GorbadPS3 opened this issue Jan 22, 2024 · 2 comments

Comments

@GorbadPS3
Copy link

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

  1. Download https://github.com/modelica/Reference-FMUs/releases/tag/v0.0.29
  2. Unzip
  3. Locate Reference-FMUs-0.0.29/2.0/BouncingBall.fmu
  4. 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
@arun3688
Copy link
Contributor

@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

@GorbadPS3
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants