Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question

Co-simulation of 3 or more FMUs

asked 2021-01-22 13:47:47 -0600

JoseRamon's avatar


I´m learning to use PyFMI for co-simulation. So far, I´ve been able to retrieve and plot info of a coupled office fmu (E+) and HVAC fmu (dymola) simulation. However, what if I would like to add another fmu? I have an occupancy/setpoint schedule FMU (from dymola) that can be connected to my HVAC sys.

Using Dymola as a master sim I´m able to do the co-simulation of the 3 fmus but when I establish the I/O connections in PyFMI I received the following error:

Traceback (most recent call last): File "c:/Gitrepos/14_PyFMI CS2.0/", line 17, in <module> coupled_sim = Master(models, connections) File "src\pyfmi\master.pyx", line 425, in pyfmi.master.Master.__init__ File "src\pyfmi\master.pyx", line 638, in pyfmi.master.Master.connection_setup KeyError: <pyfmi.fmi.fmumodelcs2 object="" at="" 0x000002024a0c1ac0="">

Is there any example or advice on using 3 or more FMUS in the PyFMI package? I read the PyFMI paper from Christian but the examples showcased are based only on 2 FMUs.

I´d appreciate any insight, Thanks!


edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2021-01-24 23:57:04 -0600

updated 2021-01-26 02:37:58 -0600

The error seems to originate from your connection setup. I suggest to review it and make sure that the connection list is OK. I have used PyFMI to connect more than three FMUs with no issues (I may have used a different version compared to yours though).

I also suggest to try testing the setup with three very simple FMUs and see if things will work first. If the issue persists, I suggest to post it at

edit flag offensive delete link more


Indeed, I had an error in the script regarding how the fmus were connected. Thanks again for the feedback Thierry

JoseRamon's avatar JoseRamon  ( 2021-01-25 11:22:44 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer


Question Tools

1 follower


Asked: 2021-01-22 13:46:19 -0600

Seen: 182 times

Last updated: Jan 26 '21