-
Notifications
You must be signed in to change notification settings - Fork 85
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
Allowing updating state variables after initialization, for Hybrid Co-Simulation #94
Comments
Comment by anonymous on 4 Oct 2012 07:31 UTC |
Comment by otter on 3 Dec 2012 01:45 UTC |
Comment by tsnouidui on 6 Oct 2015 20:18 UTC If that is the case, I wonder how an import tool could a) determine which variables are state variables, and Does this information need to be mandatory similar to Model Exchange? Also on page 58 of the specification, it is written that for Co-Simulation, element "Derivatives" is ignored if capability flag providesDirectionalDerivative has a value "false". Why is the definition of this element bounded to a capability flag? Thanks! Thierry |
Comment by cbertsch on 1 Jun 2018 12:21 UTC |
Comment by andreas.junghanns on 1 Jun 2018 12:26 UTC |
Since this is an enhancement I don't see this as an 2.0.1 issue, |
I do not see what should be clarified for 2.0.1 |
fix in hybrid co-sim |
Is this a feature request for basic co-simulation (BCS) or hybrid co-simulation (HCS)? @APillekeit , @jbernalr and other HCS team members: |
In FMI-3.0, nothing has been changed concerning the update of internal states of an FMU for XCS. |
But do you think we should allow such a change right after init for CS and if yes, for which types? |
In FMI 3.0 in HCS, setting of discrete states in event mode is possible https://fmi-standard.org/docs/3.0-dev/#fmi3NewDiscreteStates. As mentioned above, in xCS FMU, continuous states are not exposed and cannot be set. So I propose to close this of move it from "FMI 3.0" "future". However, in https://fmi-standard.org/docs/3.0-dev/#fmi3GetFMUState we mention for the funtion fmi3GetFMUState and fmi3SetFMUState the use case of nonlinear Kalman filters, just in the motivation above. However, to my understanding, with fmi3SetFMUState, the internal structure of the FMUState is a secret of the FMU, right? How could this then be used to set the continuous states of the FMU? @KarlWernersson , @masoud-najafi , @MartinOtter and others: could you please comment? |
I agree that it is very interesting to access (set and get) continuous and/or discrete states in xCS. Consider, for example, getting the linear representation of the CS model. But currently there is no way to distinguish states from other local variables in xCS, unless we allow using in the XML similar to ME. |
Well, if model structure/derivatives is used the states are exposed. If some tool vendors think it would be hard to support this, introduce a flag, "canSetContinousTimeStates" and you are done. So this would only require minimal changes to the standard. |
@MartinOtter , @AndreasPfeiffer @KarlWernersson and others: Wouldn't this feature be needed to support nonlinear state observers with BCS FMUs? Currently we state in https://fmi-standard.org/docs/3.0-dev/#get-set-fmu-state for Examples for using this feature: But I do not see how to do this, as the internal structure of what you get with |
@chrbertsch In this we utilized the modelStructure of the FMU, and allowed setReal explicitly on states. |
In Section 3.1 of the above mentioned article (https://www.ep.liu.se/ecp/096/005/ecp14096005.pdf) we describe what is additionally to the FMI standard 2.0 needed for applying a FMU for Co-Simulation to nonlinear Kalman filters:
If FMUs exported by Dymola support most of the features, then this is different to explictly support it in the FMI standard and I do not see, that is is sufficient to just introduce one flag into the current version of the FMI standard. |
I am wondering, whether the event mode of HCS would not be the right place to support the functionality of getting outputs and derivatives directly after setting them.
Is it allowed to call the fmi3SetFloat64 and fmi3GetFloat64 functions in event mode of HCS?
perhaps the name @AndreasPfeiffer , @KarlWernersson, @TorstenBlochwitz, @MartinOtter @masoud-najafi @CSchulzeTLK and others: could you please comment? |
FMI Design Meeting @KarlWernersson, @otronarp ?, @chrbertsch will work on a proposal. @pmai will support regarding the aspect of a layered standard |
* Create claytex_article.md * Update claytex_article.md * Update claytex_article.md * Update claytex_article.md * Update claytex_article.md
Hello, After read the post im a bit confused yet, and im not clear about the next question:
thank u very much. |
This ticket is about Co-Simulation FMUs
what do you mean with access? You can "get" any exposed varaible with fmi3getXXX. But this ticket is aboubt setting state variables. |
Hello @chrbertsch, I know this is not the right place to ask for, and apologizes for it. but I can’t find any help out here. I’m exporting FMU model with Amesim with high values exposed, what means I can see every variable inside the model, including the states from integrators, the thing is all those variables are declared as local, so I can’t modify any of them, I have tried to use fmi2setreal but this give me an error about “valueReference doesn’t exist”, but that’s not true, because I can see that variable in the xml, and that’s why I’m asking if local values can be changed some way working under model exchange. here is the stack overflow post: https://stackoverflow.com/questions/66633258/fmi-amesim-can-be-modified-local-variables-under-modelexchange Thanks for ur help. |
@aisak7: Please contact you AMESim support and/or use a platform like stackoverflow to ask such usage or tool related questions |
Hello @AndreasPfeiffer and @chrbertsch, I've read your article relative to the implementation of EKF in the FMU. |
Potential reason: If the quaternions are defined with Modelica, then this is an overdetermined set of states and Dymola uses dynamic state selection to reduce from 4 to 3 states during simulation (I guess this is done inside the FMU). It is not possible to update such states from a user side. |
Thx @MartinOtter. I see that in the output of the simulation (under the section state select) and I've only three elements. I am able to modify such states. Thank you a lot for the comment. |
@KarlWernersson @AndreasPfeiffer I'm not sure if this is the right place to ask. I am trying to implement a UKF using a co-simulation FMU exported from Dymola, and imported in Python using the FMPy package. I have thoroughly read the paper you mentioned and have tried implementing it accordingly, but I have run into some problems. After initialization, it is possible to set continuous states using setReal. And after setting the states, it is also possible to use getReal and get the variable outputs, so far so good. The problem arises when you have a variable input (varies with time) inside the FMU. The FMU needs to have its internal time moved forward, so after the last sigma-point is calculated, the state of the FMU must not be reversed. But when it is not reversed (by using setFMUstate()), it is no longer possible to use setReal and update the continuous states. I would really appreciate the help! |
Hi @brazilbruno |
Reported by peter.nilsson on 24 Sep 2012 13:07 UTC
For FMI 2.0 Beta-4, after initialization only inputs and tunable parameters may be set via fmiSetXXX. For co-simulation there are reasons to allow also updates of states and discrete state variables after initialization.
One example of an use-case is to change both parameters and states as part of a tuning operation; another example is if the model is part of a predictive controller where the states are estimated from measurements.
Migrated-From: https://trac.fmi-standard.org/ticket/94
The text was updated successfully, but these errors were encountered: