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

Initializing issues in a control problem

Initializing issues in a control problem

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;


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