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

Problem running an E+ simulation with Python

asked 2020-07-30 12:33:20 -0500

updated 2020-07-30 14:42:46 -0500

I'm trying to run a simulation using Python. This is my code, after trying several times, but I get an error. Can you help me to solve it?:

import sys
sys.path.insert(0, 'C:\EnergyPlusV9-3-0') #sys.path.insert(0, '/path/to/EnergyPlusInstallRoot')
from pyenergyplus import api
from pyenergyplus.api import EnergyPlusAPI
from runtime import Runtime

run_energyplus(['-d', '/path/to/output/directory', '-w', '/path/to/weather.epw', '/path/to/input.idf'])
test = Runtime(api)

    'C:/Users/vicente.castillo/Documents/24_PROYECTO SERGIO/prueba Pyenergyplus/output_prueba',
    'C:/EnergyPlusV9-3-0/ejemplo ENERGY PLUS test_2/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw',
    'C:/EnergyPlusV9-3-0/ejemplo ENERGY PLUS test_2/5ZoneAirCooled.idf'


Traceback (most recent call last):
  File "", line 15, in <module>
    test = Runtime(api)
  File "C:\Users\vicente.castillo\Documents\24_PROYECTO SERGIO\prueba Pyenergyplus\", line 26, in __init__
    self.api.energyplus.restype = c_int
AttributeError: module 'pyenergyplus.api' has no attribute 'energyplus'
edit retag flag offensive close merge delete



Are you using the initial release or the latest bug fix release for EnergyPlus v9.3? There were some issues with the Python modules and APIs that were fixed in the bug fix release.

Aaron Boranian gravatar image Aaron Boranian  ( 2020-07-30 14:44:40 -0500 )edit

First I used the initial release, and now (after your comment) I tried it with the latest bug fix release, and still got the same problem.

VicenteCastilloGuillen gravatar image VicenteCastilloGuillen  ( 2020-07-31 04:42:43 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2020-08-24 16:59:15 -0500

leijerry888 gravatar image

The following works for me:

from pyenergyplus.api import EnergyPlusAPI
api = EnergyPlusAPI()
api.runtime.run_energyplus(["your", "params", "here"])

I did not get why you need to from runtime import Runtime.

edit flag offensive delete link more


This gives me the error TypeError: run_energyplus() missing 1 required positional argument: 'command_line_args', have you come across this?

sajithwjay gravatar image sajithwjay  ( 2020-10-11 17:27:01 -0500 )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: 2020-07-30 12:33:20 -0500

Seen: 169 times

Last updated: Jul 30 '20