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
  • » ranadeakshay
  • » Profile

Posts

Posts

Mar-08-18 15:31:31
The exported csv file does not use the simulation interval to log results when the noise library...

I have set the Interval to 100s as I'd like to have the results logged every 100 seconds. However, when I use the noise library and use a sample period of say 20s, the result file looks weird. There are two entries corresponding to each time instant. The file looks something like -

time    Ts_zon    PI.y
-----------------------------
0    16            0.01
0    16            0.01
0    16            0.01
20    15.5694    0.107582
20    15.5694    0.107582
40    15.3485    0.207582
40    15.3485    0.207582
60    15.2997    0.307582
60    15.2997    0.307582
80    15.394    0.407582
80    15.394    0.407582
...
exportedVariables.csv


I would like to know why this is happening and if it's okay to just discard the repeated values and intermediate values.

Thanks in advance!

Jul-25-17 11:02:56
How to initialize a system when control is involved

I want to simulate a connected-tanks system where the level in tanks is controlled by PI controllers. The system starts off in a steady state which is not the set point. This is leading to initialization problems because at initialization, we want the inputs have arbitrary values not corresponding to the control law. Below is a minimal example of one tank.

Code:



model controlTest
 
 
  parameter Real mu = 0.5;
  parameter Real sp = 0.5;
  parameter Real Kp = 0.01;
  parameter Real Ti = 10;
  parameter Real g = 9.81;
 
  Real x(start = 1.0, fixed = true);
  Real u(start = 2.215);
 
  Real e;
  Real eI(start = 0, fixed = true);
 
  equation
 
  der(x) = u - mu*sqrt(2*g*x);
  e = -(x - sp);
  der(eI) = e;
  u = max(0, Kp*(e + eI/Ti));
 
 

 
  annotation(
    experiment(StartTime = 0, StopTime = 1000, Tolerance = 1e-06, Interval = 0.002));
end controlTest;


I did not specify any explicit initial equations in my model. I would like to see the initial equations used by the compiler to initialize the model.

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