Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Optimization with OpenModelica

Optimization with OpenModelica

Hi all,
I have been trying to run some examples of Optimica in OpenModelica. However, I run into lack of examples, the one posted at https://www.openmodelica.org/doc/OpenMo … ation.html does not work exactly (until I remove the FinalTime constraint) and the optimized model is not very intuitive what is going on.

The only Optimica "specification"  is in the JModelica documentation http://www.jmodelica.org/api-docs/users … /ch09.html . Apart from that, there are only several articles from Modelica Conferences.

Currently, the OpenModelica claims to have "limited" support. Do we have somewhere specification of what is supported? Or any conscise Optimica specification? Any other Optimica examples for OpenModelica?

Thanks a lot in advance!

Best,
Filip

Re: Optimization with OpenModelica

I have been playing around with this for a while and only documentation I have found so far is this: https://openmodelica.org/svn/OpenModeli … on/OCP.pdf

However, currently the OpenModelica is not useful for problems, which employ events. See following code:

Code:


model testTT
  annotation(
    uses(Modelica(version = "3.2.2")));

Real x(start=0);
input Real power(min = -10, max = 10);
Real goal annotation(isLagrange = true);

discrete Real zeroHold(start = 0);
parameter Real data[:, 2] = [0,0;1,0.1;2,0.4;3,0.3;4,0.8;5,1;100, 1];
Integer i(start = 1);
equation
goal = x^2;
der(x) = - x + zeroHold + power;

when time > data[pre(i), 1] then
  zeroHold = data[pre(i), 2];
  i = pre(i)+1;
end when;

end testTT;

it simulates pretty well, but using the optimize command in CLI:

Code:

optimize(testTT, numberOfIntervals=40, tolerance = 1e-9, stopTime = 10)

provides bad results (the i is not incremented, the zeroHold does strange things).

The original testuite example with algorithms ( https://trac.openmodelica.org/OpenModel … sic/TT.mos ) does not compile at all.

Is this a known issue? Is there a plan how to fix / workaround?

Thanks!
F/

There are 0 guests and 0 other users also viewing this topic
You are here: