2

How to perform optimization in Dymola or Openmodelica ?

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

Astronaut's avatar
85
Astronaut
asked 2016-01-08 18:26:51 -0500
__AmirRoth__'s avatar
4.4k
__AmirRoth__
updated 2016-01-09 13:50:16 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

3

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.

Michael Wetter's avatar
1.7k
Michael Wetter
answered 2016-01-08 19:15:12 -0500
edit flag offensive 0 remove flag delete link

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
add a comment see more comments