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

simData.success not working properly? #217

Open
mestinso opened this issue Feb 24, 2024 · 3 comments
Open

simData.success not working properly? #217

mestinso opened this issue Feb 24, 2024 · 3 comments
Assignees

Comments

@mestinso
Copy link

mestinso commented Feb 24, 2024

I'm running a simulation using the following command: simData = fmiSimulate(....

This particular FMU is terminating during the simulation and I see the following error printed out visually in the Julia REPL:
[Error][IllegalFunctionCall][TestFMIJulia]: fmi2DoStep: model is terminated

This is all fine and good and is expected in this particular case.

However, my surprise is that when I query simData.success it is returning true. Is this correct or should it be returning false?

If this behavior is expected, is there a better/alternative way to detect if the simulation wasn't successful?

Edit: I did a few more tests and inserted some divide by zero calculations into the simulation. Again, I see errors printed on the screen, but the simData.success is still true. Please advise if this is expected.

@ThummeTo
Copy link
Owner

ThummeTo commented Feb 28, 2024

You are correct. We can totally discuss this.
The success comes from the numerical integrator, this is the behavior for most ODE-libraries I know. success=true means there where no issues from the point of view of the integrator during solving (and this is true, because the FMU often gives "dummy" results or just skips a call if it is not applicable, however the ODE is still solved). If I get this correct, you are using CS now. In this case the numerical integration is done by the FMU and I think I just set the value to true. This is something that should be changed. And I will. I am doing a big update and will provide a solution for this too, so just let this open :-)
Thanks!

@mestinso
Copy link
Author

To confirm, yes I am using CS.

Also, not to rush you, but any rough ETA for the update you mentioned?

As an FYI, what I've been doing as a workaround is to add a simtime = time equation inside of my modelica code. Then, I query the simtime output at the end of the simulation, and if it is lless than the stoptime I treat that as a failure.

@ThummeTo
Copy link
Owner

For CS, I think we should just track the return codes of fmi2XDoStep, if there is a != fmiXStatusOK then we will put success=false I think.

Yep, the library tree is under heavy refactoring for a v1.0.0 release, the current plan is to release one after another (one per week), so I think the final FMI.jl patch will be ready in 4-6 weeks (together with a lot more things solved than just this issue of course).

@ThummeTo ThummeTo self-assigned this Feb 29, 2024
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