#4051 closed enhancement (fixed)
Add documentation for FMI 2.0 for CS
Reported by: | Francesco Casella | Owned by: | Adeel Asghar |
---|---|---|---|
Priority: | critical | Milestone: | |
Component: | FMI | Version: | |
Keywords: | Cc: | gianluca.bardaro@… |
Description
I am trying to understand how exactly do FMIs for CS generated from OMC work. Unfortunately, the man page
https://openmodelica.org/doc/OpenModelicaUsersGuide/latest/fmi.html
doesn't tell much.
From the FMI specification, the function fmi2DoStep()
only provides the current communication time and the length of the communication interval. It does not provide any hint to the solver so as to which algorithm is used and how many steps it should take. I assume this should then be determined at the time of FMI code generation, and possibly influenced by some API arguments and/or compiler flags.
Regarding API arguments, I looked up https://build.openmodelica.org/Documentation/OpenModelica.Scripting.translateModelFMU.html and it seems there is no way to specify anything regarding the integration algorithm of FMIs for CS.
Regarding compiler flags, I googled the topic up and the only info I could find was in #3540, which says that currently only Euler is supported as simulation algorithm.
With this lack of info, one can try to understand how FMIs for CS generated by OMC work only by trial-and-error, which is an unnecessary waste of time.
I would then strongly suggest to enhance the FMI documentation page https://openmodelica.org/doc/OpenModelicaUsersGuide/latest/fmi.html, by adding a section on FMIs for CS that addresses these questions explicitly:
- what are the implemented algorithms and how you select one?
- how can you choose the step-size between communication steps in the case of fixed time step algorithms?
- are internal events handled? If so, how?
Thanks!
Change History (12)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
Can you take care of getting this info in the man page? I could also do it if you point me out where the source code is.
comment:3 by , 8 years ago
The FMI page is generated from this via Sphinx:
https://github.com/OpenModelica/OpenModelica-doc/blob/master/UsersGuide/source/fmi.rst
I will try to add the info in there myself.
comment:4 by , 8 years ago
I understand CS FMU only takes a single Euler step with step-size equal to the communication interval, so if I wanted a shorter time step, say 1 ms, than the communication step, say 10 ms, I would have to call fmi2DoStep 10 times before looking at the results. Is this correct? Please also include this info there
comment:5 by , 8 years ago
Yes. This is the case. The code is here:
https://github.com/OpenModelica/OMCompiler/blob/master/SimulationRuntime/fmi/export/fmi2/fmu2_model_interface.c#L1005
in the fmi2DoStep function.
For sure somebody that knows more about solvers and FMI can do way better than what I did.
comment:6 by , 8 years ago
comment:8 by , 8 years ago
It looks like some content is missing just below the last two rows of the link:
When importing the model into OMEdit, roughly the following commands will be executed:
The imported FMU can then be simulated like any normal model:
comment:9 by , 8 years ago
It seems to be missing from the gitub view, because github does not fully support what the Sphynx script will do on the file (i.e., the OMC stuff). Should work inside OMC, pls check with the nightly build once it has been merged in.
comment:10 by , 8 years ago
Yes, those parts are automatically added by running omc and collecting the output.
The *final* stuff looks like this one:
https://openmodelica.org/doc/OpenModelicaUsersGuide/latest/fmi.html
comment:11 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed in 257c15/OpenModelica-doc.
Currently CS FMU generation only supports one inline forward Euler solver with root finding.
Yes, all the solvers currently supported by OpenModelica should be possible to use but somebody needs to implement that.