You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I simulate a FMU generated from the Modelica Standard Library I get a bounds error.
How to reproduce
Consider the following minimal example with a CS-ME 2.0 FMU Modelica.Mechanics.Translational.Examples.Damper.fmu generatet from OpenModelica (OMCompiler v1.19.0-dev.505+ga499198eb3):
using FMI
myFMU =fmiLoad("Modelica.Mechanics.Translational.Examples.Damper.fmu")
fmiInstantiate!(myFMU)
success, simData =fmiSimulate(myFMU, 0.0, 1.0)
The error message:
julia> success, simData =fmiSimulate(myFMU, 0.0, 1.0)
ERROR: BoundsError: attempt to access Bool at index [2]
Stacktrace:
[1] indexed_iterate(I::Bool, i::Int64, state::Nothing)
@ Base ./tuple.jl:98
[2] top-level scope
@ REPL[4]:1
OMSimulator can simulate the FMU fine, so I guess it is not an issue with the FMU. But I didn't test a non-OpenModelica tool on it.
but when I remove recordValues from the call the return value will change and only return one bool success. And that is the reason for the error.
Is this a good idea to have the function interface change on a optional argument? I expected it to save all variables when I don't specifically tell fmiSimulate what I want to save, but instead it saved nothing.
Believe it or not: We already had this discussion internally :-D
Should a function always return the same pattern? There are pros and cons, but we decided to don't return "dummy"-values if they are not needed/used. On the other hand many languages don't support this return feature, so for developers from these languages this behaviour is a bit unexpected. We decided to use the language features of Julia in this case. (you can call ?fmi2Simulate, the keyword arguments and return values are explained there)
But I am open for other opinions of course!
BTW: I will move this to discussions.
Repository owner
locked and limited conversation to collaborators
Jan 11, 2022
Description
When I simulate a FMU generated from the Modelica Standard Library I get a bounds error.
How to reproduce
Consider the following minimal example with a CS-ME 2.0 FMU
Modelica.Mechanics.Translational.Examples.Damper.fmu
generatet from OpenModelica (OMCompiler v1.19.0-dev.505+ga499198eb3):The error message:
OMSimulator can simulate the FMU fine, so I guess it is not an issue with the FMU. But I didn't test a non-OpenModelica tool on it.
Additional files
Here is the FMU (remove the .zip file extension) with Linux binaries:
Modelica.Mechanics.Translational.Examples.Damper.fmu.zip
Version 'n stuff
OS: Ubuntu 20.04
Julia:
OpenModelica: OMCompiler v1.18.1 and v1.19.0-dev.505+ga499198eb3
The text was updated successfully, but these errors were encountered: