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

PythonLinkage: Linked to Python Version 3.7.6

asked 2021-03-10 14:18:43 -0600

ep_user gravatar image

updated 2021-03-15 11:47:48 -0600

Hey EnergyPlus developers or users,

I am build/compile energyplus on CentOS, using EnergyPlus9.4.0 source code.

I was able to run example idf files successfully, without pythonEMS invloved.

But for PythonEMS involved idf files, i got error:

`PythonLinkage: Linked to Python Version 3.7.6 `

I was able to build energyplus successfully with python-linkage turn on in cmake. But when i run the example idf with pythonEMS, such as: PythonPluginCustomSchedule.idf The simulation did not kick off as usual. instead it only shows a simply message: PythonLinkage: Linked to Python Version 3.7.6 . Please see attachement for details. image description

Any hint how do i fixe it? Thanks.

edit retag flag offensive close merge delete

Comments

yes, the command format has some issue, and it was fixed using shlex. But a new issue pop up.

Failed to import module PythonPluginCustomSchedule???

But i already add the search path of "PythonPluginCustomSchedule" to the associated idf file.

The eplusout.err file hints: image description

The terminal command error message: image description

Here is what i add to the idf: image description

ep_user gravatar image ep_user  ( 2021-03-18 08:45:22 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-03-16 03:18:03 -0600

Given that what you see when you run your test_pyems.py is the result of energyplus --help, I think your test_pyems.py is calling api.runtime.run_energyplus with incorrect arguments.

An example would be:

import sys
sys.path.insert(0, '/usr/local/EnergyPlus-9-4-0/')
from pyenergyplus.api import EnergyPlusAPI

api = EnergyPlusAPI()
state = api.state_manager.new_state()

# Register any callbacks
def callback_function(state_arguments):
    pass

api.runtime.callback_begin_zone_timestep_after_init_heat_balance(state, callback_function)
api.runtime.run_energyplus(state,
    [
        '-w', '/usr/local/EnergyPlus-9-4-0/WeatherData/USA_CO_Golden-NREL.724666_TMY3.epw',
        '-d', 'out',
        'myfile.idf'
    ]
)

I have an example notebook on Github on jmarrec/OpenStudio_to_EnergyPlusAPI, and you can find a few on the E+ repo in tst/EnergyPlus/api, for example tst/EnergyPlus/api/TestRuntime.py

edit flag offensive delete link more

Comments

I really appreciate your reply. I forgot to show my test_pyems.py. Mines are different.

I am testing the example idf file from EnergyPlus installation folder: "PythonPluginCustomSchedule.idf" and "PythonPluginCustomSchedule.py".

my "test_pyems.py" lines are simply:

` command = ['path/to/energyplus/executable', '-w /path/to/weather/epw', '/path/to/PythonPluginCustomSchedule.idf']

  p = subprocess.Popen(command)  `

Since above ".idf" and ".py" are associated in idf modules. I think they will execute automatically. Do you have an example for this? Thanks.

ep_user gravatar image ep_user  ( 2021-03-17 10:48:47 -0600 )edit

You messed up your command. You need '-w', '/path/to/weather/epw' not '-w /path/to/weather/epw'

Perhaps you should rely on shlex to avoid such problems, for eg:

In [1]: import shlex
In [2]: command = 'energyplus -w in.epw in.idf'
In [3]: shlex.split(command)
Out[3]: ['energyplus', '-w', 'in.epw', 'in.idf']
Julien Marrec gravatar image Julien Marrec  ( 2021-03-18 06:00:14 -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

2 followers

Stats

Asked: 2021-03-10 14:18:43 -0600

Seen: 149 times

Last updated: Mar 16