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

Python Module does not work in OpenModelica

asked 2023-05-16 21:21:40 -0500

grid_designer's avatar

updated 2023-05-17 10:45:53 -0500

Hello everyone, I am trying to implement a peak-shaving algorithm for a microgrid using the modelica building library on a Fedora OS. I manged to set the python path and run a very basic model, but I cannot get my module for peak-shaving to work. I am not sure how to read python error codes in openmodelica. I put my python code in the same path as the examples. Not sure why it is not working. I am attaching my .mo, .py, and .txt files a google drive. Thank you for the help. Also here is the error output:

Simulation process failed. Exited with code 255.
/tmp/OpenModelica_sigi_laptop/OMEdit/warehouse_eaxmple_version_0/warehouse_eaxmple_version_0 -port=40127 -logFormat=xmltcp -override=startTime=0,stopTime=3.1536e+07,stepSize=900,tolerance=1e-06,solver=dassl,outputFormat=mat,variableFilter=.* -r=/tmp/OpenModelica_sigi_laptop/OMEdit/warehouse_eaxmple_version_0/warehouse_eaxmple_version_0_res.mat -w -lv=LOG_STATS -inputPath=/tmp/OpenModelica_sigi_laptop/OMEdit/warehouse_eaxmple_version_0 -outputPath=/tmp/OpenModelica_sigi_laptop/OMEdit/warehouse_eaxmple_version_0
The initialization finished successfully without homotopy method.
Failed to load "peak_shaving".
This may occur if you did not set the PYTHONPATH environment variable
or if the Python module contains a syntax error.
The error message is "(null)"

Google Drive Link with files:

Thank you all for the help

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2023-05-18 17:51:59 -0500

I verified that the model Buildings.Utilities.IO.Python_3_8.Examples.KalmanFilter works on our test environment (Ubuntu 22.04) and also in the OpenModelica CI testing:

I suggest you try to get this to run on your system and then change the code to reflect your problem. See also for installation and setup instructions.

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

Training Workshops


Question Tools

1 follower


Asked: 2023-05-16 21:21:40 -0500

Seen: 111 times

Last updated: May 18 '23