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

how to run EnergyPlus FMU through PyFMI

asked 5 years ago

mindcoder's avatar

updated 5 years ago

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)
Preview: (hide)

Comments

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

Thierry Nouidui's avatar Thierry Nouidui  ( 5 years ago )

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's avatar mindcoder  ( 5 years ago )

1 Answer

Sort by » oldest newest most voted
0

answered 5 years ago

updated 5 years ago

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.

Preview: (hide)
link

Your Answer

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

Add Answer

Training Workshops

Careers

Question Tools

1 follower

Stats

Asked: 5 years ago

Seen: 1,046 times

Last updated: Aug 16 '19