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

how to run EnergyPlus FMU through PyFMI

asked 2019-08-14 12:13:26 -0500

mindcoder gravatar image

updated 2019-08-15 16:12:13 -0500

I wrapped one energyplus reference building into FMU and try to simulate the Energyplus-fmu using Pyfmi. My EnergyPlus has 60 seconds as the timestep size.

It looks like it can not go through. Any insightful comments are thankful.

The error i got: File "test_fmi2.py", line 15, in <module> status = model.do_step(current_t = t, step_size= step_size, new_step=True) AttributeError: 'pyfmi.fmi.FMUModelME2' object has no attribute 'do_step

The code snippet i am using is as below:

from pyfmi import load_fmu

model = load_fmu("MyEnergyplus.fmu")
start_time = 0
final_time = 60.0 * 60 * 24 * 3 #seconds
step_size = 60 # seconds

opts = model.simulate_options()
idf_steps_per_hour = 60
ncp = (final_time - start_time)/(3600./idf_steps_per_hour)
opts['ncp'] = ncp

model.initialize( )

t = 0

status = model.do_step(current_t = t, step_size= step_size, new_step=True)
edit retag flag offensive close merge delete

Comments

How did you wrap the EnergyPlus reference building as an FMU? Which version of PyFMI are you using?

Thierry Nouidui gravatar imageThierry Nouidui ( 2019-08-15 07:52:12 -0500 )edit

Thanks. I didn't use EnergyPlusToFMU to create those FMU, instead i created FMU from FMI. I am using PyFMI version 2.5.3.

mindcoder gravatar imagemindcoder ( 2019-08-15 16:14:52 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-08-16 05:53:49 -0500

Thierry Nouidui gravatar image

updated 2019-08-16 08:42:24 -0500

I think that your FMU was wrapped as a Model Exchange FMU (version 2.0) but you are trying to run it as a Co-Simulation FMU. This is I believe the reason why PyFMI is showing the following error pyfmi.fmi.FMUModelME2' object has no attribute do_step. The do_step () method is only available in Co-Simulation FMU. If you really wanted a Model Exchange FMU, then you should use the Model Exchange functions to drive your FMU.

edit flag offensive delete link more

Your Answer

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

Add Answer

 



Question Tools

Stats

Asked: 2019-08-14 12:13:26 -0500

Seen: 110 times

Last updated: Aug 16