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
  • Index
  • » Users
  • » YacinOS
  • » Profile

Posts

Posts

Jun-12-18 20:06:54
Write simulation for different initial values.

Thank you it works just fine. I want to mention that in Windows you have to omit the "./" before the name of executable file in the "system" command. Furthemore the "-r" option not only change result file name, but also the file path. in other words you can change file destination.

Jun-11-18 15:40:41
Write simulation for different initial values.

Hello everyone,
I have a model and I want to perform a batch simulation of the same model for a number of different initial configurations (initial values of variables and parameters). My goal here is to write a script (.mos file) that launch all simulations and than store results of each simulation separately so we can recognize which file belongs to which simulation. So what is the syntax for changing initial values inside the script ?
Thank you.

May-17-18 12:58:21
Simulation freezes at around 8%

Well the result looks pretty much what I needed, thanks.
If I understand your words, the changes made by the "when" statement are preserved, whereas those made by the "if" are not meant to last.

May-16-18 11:27:20
Simulation freezes at around 8%

Hi,
I tried to simulate the model below, which consists of two variables h1 and h2 which represents the liquid level of two tanks serial connected. where we only control the output flow (o1 and o2). The goal is to maintain the liquid level between the Min and Max levels. of1 and of2 are the flow rate of the valves when opened. s is the flow rate from the source to the first tank.
I choosed the simulation step size to be 1s and duration of 1000s (which means 1000 steps).
The simulation freezes at 8% whith the folowing message :

The initialization finished successfully without homotopy method.
Chattering detected around time 80.0000000081..80.000001612 (100 state events in a row with a total time delta less than the step size 1). This can be a performance bottleneck. Use -lv LOG_EVENTS for more information. The zero-crossing was: h1 >= max1.

Pls tell me how to make it works. I desperately need it.
Thank you.

model TankSystem
        parameter Real s=1.0;
    Real h1(start=0.0);
    Real o1;
    parameter Real of1=2.0;
    parameter Real min1=20.0;
    parameter Real max1=80.0;
    Real h2(start=0.0);
    Real o2;
    parameter Real of2=3.0;
    parameter Real min2=20.0;
    parameter Real max2=80.0;
    initial equation
        h1=0.0;
        h2=0.0;
    equation
        if h1 >= max1 then
          o1 = of1;
         elseif h1 <= min1 then
          o1 = 0.0;
        else o1=o1;
        end if;
        der(h1) = s - o1;
        if h2 >= max2 then
          o2 = of2;
        elseif h2 <= min2 then
          o2 = 0.0;
        else o2=o2;
        end if;
        der(h2) = o1 - o2;
end TankSystem;

May-16-18 10:01:42
equation is not big enough to solve for enough variables

Hi spinnau,

I'm aware of the fact that connectors in Modelica implemented with balance between potential and flow variables in mind, but this is not the source of the problem because after all it is just a warning.

Thank you, for your reply.

Mar-13-18 10:29:58
equation is not big enough to solve for enough variables

Hi everyone,

I'm new to the Modelica,
I'm trying to make a simple model for two connected liquid tanks (from tank1 to tank2). In this model, we can only open or close the output valve of a tank, according to the liquid level in the relevant tank. here is the model.

package SimplefiedTwoTanks
block Tank
  parameter Real area(unit="m2");
  parameter Real capacity(unit="m3");
  parameter Real max=80;
  parameter Real min=20;
  Real h(start=0,unit="m");
  FlowConnector rateIn;
  FlowConnector rateOut;
equation
  if h>= max then rateIn.rate=0;
  elseif h<=min then rateIn.rate=1;
  else rateIn.rate=1; end if;
  der(h)=(rateIn.rate - rateOut.rate)/area;
end Tank;

block Source
  FlowConnector rate;
end Source;

connector FlowConnector
  Real rate; //flow rate of the connector
end FlowConnector;

block TwoTanks
  Tank tank1(area=10,capacity=100,h=0); // the first tank (the provider tank)
  Tank tank2(area=10,capacity=100,h=0,rateOut.rate=0.5,rateIn.rate=1); // the second tank (the receipient tank)
  Source source(rate.rate=1); // the liquid source
equation
  connect(source.rate, tank1.rateIn);
  connect(tank1.rateOut, tank2.rateIn);
end TwoTanks;

I received error :
Too many equations, over-determined system. The model has 11 equation(s) and 7 variable(s).
as well as, warning that the first (of two) equation in the tank block is not enough big enough to solve for enough variables.

- What am I doing wrong?.
- What are the changes to do to make it works?.

Thank you.

Hello again Koldo,

Ok, I will give it a shot and see what it can offer to me. thank you by the way.

Best regards.

Hello Koldo,

Thank you for you reply, but what I'm interrested in, is not the results of the simulation (I already dealt with them), but rather the analytical solution of the ODE (which is a function). Like the "dsolve" function in Matlab.

Thank you.
Best regards.

Hello OpenModelica community,

I want to know if there is way to get the solution functions to ODEs in the model, so I can perform some analytical tasks later.
If no, can anyone know if there are tools that can do the job.
I really need those functions.

Thank you in advance.

Apr-27-17 17:22:41
What is the easiest why to extract variables and parameters from a modelica source file.
Category: Programming

Hi Modelica community,

I want to know, what is the easiest way to extract the list of "variables" and "parameters" and their types from a modelica source file (.mo) for later processing.

Thank you.

Thank you, I heard of it before, but the problem is in which file I could find them, because the FMI export process generates lots of files, hence, I can't figure out which file(s).

Hi everyone, 

How can I get the solutions (functions) to a model (system of equations) in order to use them elsewhere outside of OpenModelica.

Thank you.

  • Index
  • » Users
  • » YacinOS
  • » Profile
You are here: