fmi-standard icon indicating copy to clipboard operation
fmi-standard copied to clipboard

Change of fmiGetDerivatives/fmiSetContinuousStates/fmiGetContinuousStates for QSS

Open modelica-trac-importer opened this issue 7 years ago • 14 comments

Reported by tsnouidui on 30 Apr 2014 18:21 UTC Hi all,

I am developping a master algorithm for FMUs for model-exchange which use the Quantized State Systems (QSS) integration methods for time integration. For this master algorithm to fully utilize the capability of these integration methods, it will be good if it is possible to retrieve single derivative of FMUs.

My question: Why is it not possible similar to fmiGetReal() to provide fmiGetDerivatives() with the value reference of the derivative which should be retrieved/computed? My guess is that, the current specification is designed for traditional integration methods which work on the whole state vector at every integration step. This assumption is not valid for QSS methods.

The change will also imply the capability to support the setting/getting of individuals continuous states. This will require to provide fmiSetContinuousStates/fmiGetContinuousStates with the value references of the states that need to be set/get?

Thanks!

Thierry


Migrated-From: https://trac.fmi-standard.org/ticket/243

modelica-trac-importer avatar Oct 16 '18 22:10 modelica-trac-importer

Comment by karl.wernersson on 23 May 2014 16:49 UTC Hi

In ModelStructure in the xmlFile all state derivatives are defined and an index is given to the scalar variable for each derivative. From there you would get the valueReference used to call fmi2GetReal to collect a single derivative.

calling fmi2SetReal on a single state is planed to be supported for fmi 2.1

/Karl Wernersson

modelica-trac-importer avatar Oct 16 '18 22:10 modelica-trac-importer

Comment by tsnouidui on 23 May 2014 18:09 UTC Thanks! Thierry

modelica-trac-importer avatar Oct 16 '18 22:10 modelica-trac-importer

Modified by otter on 30 May 2014 07:10 UTC

modelica-trac-importer avatar Oct 16 '18 22:10 modelica-trac-importer

Comment by torstenblochwitz on 10 Feb 2015 12:59 UTC According to table Table 1: Mathematical description of an FMU for Model Exchange it is already allowed to set continuous states via fmi2SetReal.

According to Figure 6: Calling sequence of Model Exchange C functions.

We have to check the rest of the specification for consistency and decide which is the expected behavior.

modelica-trac-importer avatar Oct 16 '18 22:10 modelica-trac-importer

Comment by anonymous on 10 Feb 2015 22:59 UTC Page 79 of the FMI specification 2.0 says:

fmi2Status fmi2SetXXX(..) Set new Values for (independent) parameters, start values and inputs and re-initialize caching of variables that depend on these variables...

I believe that continuous states do not fall under any of these categories.

Thanks! Thierry

modelica-trac-importer avatar Oct 16 '18 22:10 modelica-trac-importer

Modified by tsnouidui on 4 Aug 2015 17:27 UTC

modelica-trac-importer avatar Oct 16 '18 22:10 modelica-trac-importer

Comment by fcasella on 19 Sep 2015 09:54 UTC Myself and Federico Bergero are working on a prototype extension of FMI implemented in the OpenModelica compiler, to support QSS (including higher-order versions of it) and multi-rate algorithms. We attach some early thoughts on the topic to this ticket.

The idea is that we need:

  • function to trigger the partial computation of state derivatives (and of their directional derivatives), see also my paper Efficient Computation of State Derivatives for Multi-Rate Integration of Object-Oriented Models, MATHMOD 2015, for some ideas regarding the implementation
  • functions to compute additional information required by QSS algorithm, e.g., the partial derivative w.r.t. time of the state derivative functions

We'll keep you posted about the progress.

modelica-trac-importer avatar Oct 16 '18 22:10 modelica-trac-importer

Comment by fedebergero on 24 Sep 2015 13:20 UTC Hi Thierry, as Francesco mentioned we are working on how to include QSS methods in OpenModelica and one possible way is through FMI.

We have sketched the attached document and as you mentioned we need way to set some particular state variables and compute some other state derivatives. On the attach there is no prototype function for getting the higher order derivatives yet (needed for QSS2 / 3 / 4).

When it comes to events much more is needed from an FMU, but on this stage we are just focusing on continuous systems.

To resume, we should join forces on this matter!

Fede

modelica-trac-importer avatar Oct 16 '18 22:10 modelica-trac-importer

Comment by tsnouidui on 6 Oct 2015 17:23 UTC Hi Fede,

I read the attachment and we should indeed join force here.

Thierry

modelica-trac-importer avatar Oct 16 '18 22:10 modelica-trac-importer

Comment by torstenblochwitz on 15 Dec 2015 09:02 UTC Discussion at the Meeting at DLR in December 2015 (in context with the discussions about discrete states): In a maintenance release (FMI 2.0.1) we should not change the semantics. We should Keep the Definition of allowed functions calls according to figure 6. So this might be a change request for a minor relese (e.g. 2.1).

modelica-trac-importer avatar Oct 16 '18 22:10 modelica-trac-importer

Comment by cbertsch on 1 Jun 2018 13:06 UTC This does not seem to be covered by any of the working groups currently. If a simple solution can be found, it could be considered for 3.0, otherwise at a later time.

modelica-trac-importer avatar Oct 16 '18 22:10 modelica-trac-importer

Comment by cbertsch on 11 Jun 2018 09:52 UTC FCP Alignment Meeting: not foreseen for FMI 3.0

modelica-trac-importer avatar Oct 16 '18 22:10 modelica-trac-importer

Modified by cbertsch on 18 Jun 2018 10:13 UTC

modelica-trac-importer avatar Oct 16 '18 22:10 modelica-trac-importer

Would this be solved by implementing higher order derivatives as proposed in #372?

t-sommer avatar Apr 03 '21 13:04 t-sommer