2

I found a limitation of the FMU-module method get_states_list(). This method seems to bring a list only of continuous time states and not of discrete time states. I do usually make models that contain both continuous and discrete time sub-models describing process and control system and I am very interested to be able to get a list of ALL states in the system.

One possibility could have been get_fmu_state() but I get the exception text “This FMU does not support get and set FMU-state”.

Another possibility would perhaps be bring out a larger list of all variables using and sort out those variables that contain in the declaration "fixed=true”, but this attribute I am not sure how to bring out, although other attributes can be brought out like min, max, nominal. The method get_model_variables() could perhaps be of help but I only get some address associated to the variable….

What to do?

janpeter
  • 681
  • 8
  • 22
  • What is the definition of a discrete state in the FMI context? – Christian Winther Oct 18 '18 at 14:38
  • The definition of discrete time state is the same as for continuous time, I would say. Thus something like: the minimum information needed to predict how the system evolve over time. If there are input signals these need to be known, of course. For more see: https://en.wikipedia.org/wiki/Dynamical_system. In the Modelica code I set the attribute fixed=true for variables that I have as states, whether continuous or discrete time. In this way they are easy to recognise. – janpeter Oct 19 '18 at 06:23

1 Answers1

2

The get_states_list method is a mapping back to the FMI specification which only includes the continuous time states. So this is by design.

Christian Winther
  • 1,113
  • 1
  • 9
  • 17
  • Hard to believe that FMI specification does not handle this better! The problem I want to solve is as follows. I have a Modelica model that contains both a process in continuous time and regulator in discrete time. If you want to simulate up to a time, change some parameter manually, and then continue simulation, you need to read out the state and save it, reload the model again, enter the final state from previous simulation and use that as initial condition before you run simulation again. Today I have a Python script that for the discrete time states needs to be tailor-made for each model. – janpeter Oct 19 '18 at 06:28
  • To handle time delays (continuous time) correctly in this procedure above, I have not any solution for either. I realise that would depend on the numerical integration routine used. – janpeter Oct 19 '18 at 06:31