Cosimulation
Co-simulation between two models requires the use (and often the development!) of middleware to homogenize the data structures (especially for the exchanged variables). The use of a common data standard allows to avoid this problem, so here is a tutorial on EnergyPlus/Python coupling to FMI format realized by EnergyPlusToFMU (Windows installation).
Prerequisite (to install in that order!):
EnergyPlusToFMU requires a specific
configuration
after installation. In order to activate the Python environment within JModelica,
the following command need to be run in the Windows command line terminal (cmd
):
It is recommended to create a
permanent alias
for the Python environment of JModelica. Once the environment is activated, it becomes possible to
onvert a .idf
file to a .FMU
one, with the following instruction (Windows command line terminal):
It is important to clearly define the exchanged variables from the .idf
file before it
conversion to a .FMU
file, according the the procedure explained in the
External Interface Application
.
The .FMU
is now ready to interact with the other models (Python script, JModelica model, other .FMUs…).
We can then use an IDE allowing to easily change Python interpreter (PyCharm is warmly recommended) and use PyFMI, included in JModelica’s Python version, to run a cosimulation:
A first script as an example to adapt: