Setting of input variables before and after initialization #2032
Replies: 2 comments 3 replies
-
FMI Design Meeting: |
Beta Was this translation helpful? Give feedback.
-
Just for clarification: In FMI-2.0, is it allowed to set inputs before initialization? If I am not wrong, according to the FMI2 spec, inputs cannot have "initial" attributes, so input variables cannot be set before entering the initialization mode and the "start" value of input variables may be used. In this case, if the importer sets an input variable, the FMU may be tolerant and reset the input values or simply discard the fmi2SetXX call on inputs. |
Beta Was this translation helpful? Give feedback.
-
(The vollowing question reached me via Email from Anna Occhipiniti form PACE)
I’m reaching out because we would like to share some findings/problems we experienced while validating the FMI/FMU import capability in Desmo.
We observed that FMUs, exported from Simulink, are resetting values of input variables, that were explicitly set by importer tools after instantiation and before initialization, to start values determined by the FMU during initialization. In other words, the values supplied by the importer before initialization are wiped out by the FMU during initialization.
This leads to deviating behaviour between different FMU importer tools like Dymola, Open Modelica, FMPy, and Desmo (our tool, based on FMI 2). We mitigated the problem for Desmo by setting input values before and after initialization.
We suspect that the FMI specification (versions 2 and 3) could be refined to clarify the correct handling of input values and the FMU phases, i.e. pre- and post-initialization with advice for both exporting and importing tools.
Remarks
• In the FMI implementers guide, we found the advice to set values as early as permissible, i.e. after instantiation, prior to entering initialization mode. This leads to the assumption, that these values would survive the initialization phase.
• There is a long thread on GitHub started by Karl Wernersson related to the issue.
Beta Was this translation helpful? Give feedback.
All reactions