Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Same simulation settings in GUI and Python script #621

Open
AnHeuermann opened this issue Nov 6, 2023 · 1 comment
Open

Same simulation settings in GUI and Python script #621

AnHeuermann opened this issue Nov 6, 2023 · 1 comment

Comments

@AnHeuermann
Copy link

We'd like to test some OpenModelica FMUs with different FMU Importing tools and noticed, that FMPy is very slow (doesn't finish) in simulating a FMU from the Modelica Buildings library when using the GUI.
Trying to reproduce the issue with a Python script failed (it simulated fast), so I guess I only need to change some settings in the GUI of FMPy, but I don't know which one.

How to reproduce

Build the 2.0 ModelExchange FMU with OpenModelica by running the following MOS script

build.mos

loadModel(Modelica, {"4.0.0"}); getErrorString();
loadModel(Buildings, {"10"}); getErrorString();

cd("CO2TransportStep"); getErrorString();
buildModelFMU(Buildings.Airflow.Multizone.Examples.CO2TransportStep); getErrorString();
mkdir CO2TransportStep
omc build.mos

or download Buildings.Airflow.Multizone.Examples.CO2TransportStep.fmu (Linux) and change .zip to .fmu.

Simulating with the GUI:

grafik

Takes forever. I stopped the simulation after several minutes and reaching not even 2 percent.

Simulating via command line:

time fmpy simulate CO2TransportStep/Buildings.Airflow.Multizone.Examples.CO2TransportStep.fmu
fmpy simulate   0.71s user 1.28s system 1061% cpu 0.188 total

Simulation via Python Script:

from fmpy import *
fmu = 'CO2TransportStep/Buildings.Airflow.Multizone.Examples.CO2TransportStep.fmu'
result = simulate_fmu(
  fmu,
  solver = 'CVode')
python3 runFMPy.py  0.55s user 1.38s system 991% cpu 0.195 total

Versions 'n Stuff

  • Python: 3.10.12
  • FMPy: 0.3.19
  • OS: WSL2 with Ubuntu Focal
@t-sommer
Copy link
Contributor

Does the problem still exist? If so, can you please share a Windows version of the FMU?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants