FMU co-simulation with pyFMI

144 views
Skip to first unread message

Jim Beam9

unread,
Mar 15, 2020, 7:16:25 PM3/15/20
to energyplus-fmu
Hi,

I am currently using EnergyPlusToFMU to produce FMUs which will be simulated using pyFMI. The simulation is controlled by inputs received from an API. This leads to the problem of model state persistence.
I have found that it is possible to serialize and deserialize a models state using get_fmu_state and set_fmu_state. I tried this method but I get the error AttributeError: 'pyfmi.fmi.FMUModelCS1' object has no attribute 'get_fmu_state'.

I understand the error and see that pyfmi.fmi.FMUModelCS2 has get_fmu_state and set_fmu_state methods, my problem is that I cannot find how to instantiate an FMUModelCS2 instance using my fmu file.

Currently I am using pyfmi.fmi.load_fmu() to load my model which seems to always default to FMUModelCS1. 

I would really appreciate some help with this. Thank you in advance.     

Thierry Stephane Nouidui

unread,
Mar 16, 2020, 2:08:33 AM3/16/20
to energyplus-fmu, Jim Beam9
Good morning,

The current version of EnergyPlusToFMU only supports the FMI 1.0 API for Co-Simulation. This API doesn't have the methods you mentioned. Consequently it is not possible to instantiate it as an FMU 2.0.
Work is in progress to support FMI 2.0 for Co-Simulation as well. However, note that even for FMI 2.0, EnergyPlus' FMUs won't be able to expose their states so one can save and restore them in a next call. You can only expose some states through the EMS actuators/ EMS variables for example and have them be inputs of your FMUs.

Hope that helps.

Thanks!

Am Montag, 16. März 2020, 00:16:27 MEZ hat Jim Beam9 <bigbos...@gmail.com> Folgendes geschrieben:


--
You received this message because you are subscribed to the Google Groups "energyplus-fmu" group.
To unsubscribe from this group and stop receiving emails from it, send an email to energyplus-fm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/energyplus-fmu/44c8ee92-b6a6-41f1-b248-b338698dd057%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages