0

I am trying to understand how the method get_fmu_state works on a simple fmu in cosimulation mode example like the bouncing ball using PyFMIs(2.7.3) pre-supplied fmu. I have installed it via miniconda on a ubuntu-docker and try to execute the following commands when I receive an error. I understand this fmu may not support the command but is there any other example that might support it?

In [1]: from pyfmi import load_fmu

In [2]: fmu_model = load_fmu('/home/developer/miniconda3/envs/modelicagym/lib/ \
python3.8/site-packages/pyfmi/examples/files/FMUs/CS2.0/bouncingBall.fmu')

In [3]: fmu_model
Out [3]:<pyfmi.fmi.FMUModelCS2 at 0x55a515a1b180>

In [4]: fmu_model.get_fmu_state()
---------------------------------------------------------------------------
FMUException                              Traceback (most recent call last)
<ipython-input-9-580b849d2146> in <module>
----> 1 fmu_model.get_fmu_state()

src/pyfmi/fmi.pyx in pyfmi.fmi.FMUModelBase2.get_fmu_state()

FMUException: This FMU does not support get and set FMU-state

The rest of the commands like fmu_model.simulate(), fmu_model.initialize(), fmu_model.simualte() work without any issues but the fmu_model.get_fmu_state() does not. Same error occurs if I use fmu in ModelExchage mode.

CS101
  • 444
  • 1
  • 6
  • 21

1 Answers1

0

The support of the "get FMU state" capabilities is dependent on the exporting tool that creates the FMU. If the exporting tooling does not support this capability, then there is nothing that the importing tool (here PyFMI) can do I'm afraid.

If you need this capability you'll need to go back to the exporting tool and make sure that they include this capability.

Christian Winther
  • 1,113
  • 1
  • 9
  • 17
  • I have been using pymodelica library to export the Modelica code to FMUs and there's no documentation available on that topic anywhere – CS101 Aug 23 '20 at 21:19