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

How to perform optimization in Dymola or Openmodelica ?

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

Astronaut's avatar

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

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
3

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

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 (http://simulationresearch.lbl.gov/mod...) you could also run your Dymola model from Python and then use another Python package for the optimization such as from SciPy.org. 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

Comments

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 -0500 )edit

GenOpt is a Java application, hence you can call it from Python for example using https://www.py4j.org/

Michael Wetter's avatar Michael Wetter  ( 2016-01-19 13:40:32 -0500 )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 -0500 )edit
1

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

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

Thanks Sir It helped a lot.

Astronaut's avatar Astronaut  ( 2016-01-25 05:12:03 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Careers

Question Tools

1 follower

Stats

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

Seen: 2,716 times

Last updated: Jan 08 '16