modelica / fmi-standard

Specification of the Functional Mock-up Interface (FMI)
https://fmi-standard.org/
Other
274 stars 85 forks source link

Review of 3.2 (ME API) #1016

Closed chrbertsch closed 4 years ago

chrbertsch commented 4 years ago

https://fmi-standard.org/docs/3.0-dev/#_application_programming_interface: If the super-dense time before a call to

[This function might be used for the following purposes: If the FMU stores results internally on file, then the results after the initialization and/or the event has been processed can be stored. If the FMU contains dynamically changing states, then a new state selection might be performed with this function.]

For example, the state chart indicates that when an FMU for Model Exchange is in state Continuous-Time Mode, a call to fmi3Set{VariableType} for a discrete input is not supported.

This was true for FMI2.0, but in FMI 3.0 this cannot be seen from the state machine. Replace this text with a new one telling that the State machine displayes allowed transitions (and call of transition functions), but the allowed calls to functions in each state are defined in the text below.

- 3.2.3.6: missing point at the end.

clagms commented 4 years ago

Comment " [The functions above have the slight drawback that values must always be copied. ..." : is this the right place for this comment? As this is a general issue for all FMU types: Should be removed or moved to Chaper 2

@chrbertsch , by "this" in "this is a general issue" you mean the copying of values, right? If so, I agree that the comment should be made general to all FMI functions but I disagree that it should be removed, because function SetContinuousStates is specific to ME, and this comment should actually not be non-normative text.

I suggest that a similar comment be made about:

hubertus65 commented 4 years ago

@chrbertsch : this was moved to a spearate ticket https://github.com/modelica/fmi-standard/issues/1059 as it adresses a completely new point.

(Maybe I am a bit out of the loop here. The FMI-ME statechart does not seem to be complete for me for the -admittedly quite complex case - of structural parameters that add or remove states, at least if "initialization" is interpreted in the sense of initializing an ODE/DAE. If a structural parameter is changed in event mode and changes the number of states, there has to be a new initialization state to initialize "new" states, or what the values of the reduced number of states should be. A second remark: It will not be possible to create such FMUs from Modelica tools since Modelica as of today does not support a changing number of states in a model based on an event. My assumption is that this is for controller design, where the number of states in the controller changes dynamically? I also wonder whether it might not be wise to forbid a changing number of states in ME FMUs: it opens a can of worms in terms of hard open questions. How are the start values of "new" states defined and made visible? If the number of states is reduced, do the values of the remaining states remain the same as before the event? How are they mapped? I can imagine that control design tools might want to support this, but I don't see physical modeling tools support this any time soon. I have not seen customer demand for this feature either. )

andreas-junghanns commented 4 years ago

@hubertus65 This was discussed and we decided this is not an issue FMI has to solve. If the FMU can handle changing number of states, it offers states depending on structural parameters, else it does not. If the importer cannot handle such an offer for changing structural parameters changing the number of states, well, it should not change that structural parameter away from its initial value.

We wanted to make sure we do not restrict artificially which can be restricted by the tools very easily to allow future, smarter implementations to potentially use these possibilities.

hubertus65 commented 4 years ago

Ok, I can definitely live with that. To me, it still feels like an incomplete proposal, since the "how" of the initialization (and possibly removal) of states is not specified. If nobody can explain how to do that in a standards-conform way, I find it a bit doubtful to leave it in.

andreas-junghanns commented 4 years ago

@chrbertsch : Can we both run through the remaining points to create a PR together? Please let me know when you are available.