Alternative Python linkage #9188
-
Hi, To use Python Plugin, I am wondering if I can link an alternative python executable instead of the one shipped with EnergyPlus (without compiling from source codes)? For some reason, I have to use EP 9.4 (which contains Python 3.7) and Python 3.8, which makes it tricky to include third-party modules like numpy as per my current understanding. I saw that you are thinking of making python-free distributions, so I guess there might be a way that I failed to find? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I would highly suggest not actually using the Python Plugin system in this case, but rather call EnergyPlus through the Python API. The approach is actually quite similar, the fundamental being that instead of relying on a packaged EnergyPlus Python version, you simply call the EnergyPlus API from your own Python install. This way you can use any Python version you want, and any extra libraries you want. We do have a few examples of this, such as here: https://github.com/NREL/EnergyPlus/blob/develop/tst/EnergyPlus/api/TestRuntime.py#L77. The steps are basically:
The contents of your callback function can do all the things you'd expect to do, including making data exchange API calls with the running simulation to read sensors and write actuators. |
Beta Was this translation helpful? Give feedback.
I would highly suggest not actually using the Python Plugin system in this case, but rather call EnergyPlus through the Python API. The approach is actually quite similar, the fundamental being that instead of relying on a packaged EnergyPlus Python version, you simply call the EnergyPlus API from your own Python install. This way you can use any Python version you want, and any extra libraries you want.
We do have a few examples of this, such as here: https://github.com/NREL/EnergyPlus/blob/develop/tst/EnergyPlus/api/TestRuntime.py#L77. The steps are basically: