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

How to perform optimization in Dymola or Openmodelica ?

asked 2016-01-08 18:26:51 -0600

Astronaut's avatar

updated 2016-01-09 13:50:16 -0600

after simulation of a model, how can we start dynamic optimizing in dymola or openmodelica ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-01-08 19:15:12 -0600

Dymola, OpenModelica and JModelica all have support for optimization, see

There are also various users who used GenOpt with Modelica models that were compiled using Dymola. An example is available in the GenOpt download under example/dymola

Using BuildingsPy ( you could also run your Dymola model from Python and then use another Python package for the optimization such as from There are also a few other Python packages such as PySimulator, that allow you to interface with Modelica models, and JModelica also provides its own Python bindings.

Lastly, if you use Wolfram Research's or Maplesoft's Modelica environment, then you can use the optimization packages from Mathematica or Maple, respectively.

edit flag offensive delete link more


thanks Sir I just chose Genopt and it worked fine now I'm dealing with the idea of : 1- Modeling and Simulation with Dymola 2- Optimizing with Genopt 3- make it work as a loop with PYTHON.

I already done the first two now and started python and loaded the simulation,now I don't know how can I bring Genopt in to Python .

Astronaut's avatar Astronaut  ( 2016-01-19 10:25:50 -0600 )edit

GenOpt is a Java application, hence you can call it from Python for example using

Michael Wetter's avatar Michael Wetter  ( 2016-01-19 13:40:32 -0600 )edit

I have read the links and some other related links Sir the main point is that how can I try this with genopt because since the description in py4j wasn't enough I started to work with JPype but I don't know where to address genopt.jar in that program.

Astronaut's avatar Astronaut  ( 2016-01-21 09:07:22 -0600 )edit

If you have problems with py4j or JPype, you could also use

$> ipython
In [1]: import subprocess
In [2]:["java", "-cp", "genopt.jar", "genopt.GenOpt", "optLinux.ini"])
Michael Wetter's avatar Michael Wetter  ( 2016-01-21 10:47:15 -0600 )edit

Thanks Sir It helped a lot.

Astronaut's avatar Astronaut  ( 2016-01-25 05:12:03 -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

1 follower


Asked: 2016-01-08 18:26:51 -0600

Seen: 2,692 times

Last updated: Jan 08 '16