Advanced control systems, state-space controllers

In summary, the water level in the tank decreases as time goes on and the water flows out of the tank at a faster rate than it flows in.
  • #1
Maniac_XOX
86
5
Homework Statement
I am trying to linearize a first order equation for water level inside a tank with Taylor series to then find the matrices in state-space equations with which I can model the system in Simulink
Relevant Equations
$$\frac {dH}{dt} = \frac {Fin V}{A} - \frac {Fout \sqrt{H}}{A}$$
------------EDIT----------------------------------------------------------------------------
Check comment #7 for neater and faster explanation of the question statement
---------------------------------------------------------------------------------------------
The symbols represent:
H, water level
t, time
Fin, rate f flow of water inside the tank
Fout, rate of flow of water out of the tank
A, cross-sectional area of the tank

Through the application of deviation variables and taylor's series I have gotten to the linearized equation:
$$ \frac {dH}{dt} = \frac {Fout}{2A} - \frac {Fout}{2A}\frac{H_s^{\frac{1}{2}}}{H^{\frac{1}{2}}}$$

where the s indicates the steady-state value of the original variable, as per definition of deviation variables.
How do I go from there to the state space equations:
##
x'= Ax + Bu ##
##
y= Cx + Du ##

That is the part that I am currently struggling with. I need to find those equation with respective matrices so that i can input the vlaues in a simulink state-space block. Thank you for any help!
 
Last edited:
Physics news on Phys.org
  • #2
1) I think there's a typo in your DE with ##Fin## omitted.
2) Your units confuse me, but I won't go there. We've discussed that in your previous post(s).
3) Identify, the state(s) ##x##, the input(s) ##u##, and the output(s) ##y##.
4) Do the math (linearization) to develop a set of first order DE's.
5) Reformulate those equations into the canonical matrix form of the state space system that you showed.

It looks to me like your system has only one state (H), one input, and one output (correct me if I'm wrong, I'm not sure about ##Fout##). It is unusual for people to use matrix notation for for simple systems like this since it can be modeled with one first order DE. But, honestly, I haven't thought about the actual physics of your water tank at all; I'm just trusting your interpretation.

Maybe step 5) is what you're asking about?
 
  • #3
BTW, the DE ##\frac{dH}{dt} = C_1+ \frac{C_2}{\sqrt{H}}## isn't linear. Also I'm confused about how you got that from ##\frac{dH}{dt} = C_3+ C_4 \sqrt{H}##. [##C_1 - C_4## constants].
But again, I haven't thought too much about this.
 
  • #4
DaveE said:
BTW, the DE ##\frac{dH}{dt} = C_1+ \frac{C_2}{\sqrt{H}}## isn't linear. Also I'm confused about how you got that from ##\frac{dH}{dt} = C_3+ C_4 \sqrt{H}##. [##C_1 - C_4## constants].
But again, I haven't thought too much about this.
after considering it I decided to try linearize the equation with taylor series without using the deviation variables.
I used point H = 0.05 where V = 1
Therefore the linearized equation turns out to be:
$$ y1' = -\frac {0.03\sqrt{5}}{11} x1 + \frac {4}{11} $$

I do have a second DE, of temperature, but so far in the examples I always saw the application using one equation so I wasn't sure how to implement the second DE with the first DE. In reality i have two inputs and two outputs, so I'll give it a shot.

Temperature equation: $$
\frac {dT}{dt} = \frac {(F_{in} Voltage)(T_{in}-T)}{AH} + \frac {Q}{AH*\rho*C_p} $$

The values for the symbols are:
T initially is 10 C
Fin = 0.4 ##m^3##/hr
Fout = 0.03 ##m^{2.5}##/hr
V is the input which varies from 1 to 10
A = 1.1 ##m^2##
H, in m, initially is 0.05
Cp = 4.18 Kj/Kg C
Q = 500 Kj
rho = 1000 Kg/##m^3
After linearising temperature as well I get:
$$y2' = -\frac {8}{1.1}x2 + 74.9$$

when the system is in equilibrium, y1' and y2' are zero, therefore:
x1e = 10.3 and x2e = 59.6
where x1e and x2e are x1 and x2 in equilibrium state.

The two state-space equations are:
$$y' = Ax + Bu =
\begin{bmatrix}
-\frac{8}{1.1} & 0 \\
0 & -\frac {0.03\sqrt{5}}{11}
\end{bmatrix}
\begin{bmatrix}
x1\\
x2
\end{bmatrix}
+
\begin{bmatrix}
74.9\\
\frac{4}{11}
\end{bmatrix}
u
$$

and
$$
x = Cx + Du =
\begin{bmatrix}
10.3 & 0\\
0 & 59.6
\end{bmatrix}
\begin{bmatrix}
x1\\
x2
\end{bmatrix}
+ 0u
$$
Does this sound remotely right?
 
Last edited:
  • #5
It really confuses me when you start switching around your variables, like y' and x. It also confuses me when you don't define things clearly, like what are your inputs and outputs. I have a strong suspicion that this is because you are also confused about this stuff. So, my advice is to slow down, don't skip steps, don't type before you think. Typos and unclear definitions are very demotivating to me. Maybe someone else will go through this step by step with you, but I can't, I don't have time right now and I don't think I should be working harder on your problem than you are.

Also, perhaps we should leave temperature out of this until you've got a handle on the more basic problem?
 
  • #6
DaveE said:
It really confuses me when you start switching around your variables, like y' and x. It also confuses me when you don't define things clearly, like what are your inputs and outputs. I have a strong suspicion that this is because you are also confused about this stuff. So, my advice is to slow down, don't skip steps, don't type before you think. Typos and unclear definitions are very demotivating to me. Maybe someone else will go through this step by step with you, but I can't, I don't have time right now and I don't think I should be working harder on your problem than you are.

Also, perhaps we should leave temperature out of this until you've got a handle on the more basic problem?
I used the y1' and x to simplify the equations but I'll keep them normal now and try to approach this slower.

DIFFERENTIAL EQUATIONS
Temperature: $$
\frac {dT}{dt} = \frac {(F_{in} Voltage)(T_{in}-T)}{AH} + \frac {Q}{AH*\rho*C_p} $$
Water level: $$ \frac {dH}{dt} = \frac {(F_{in} Voltage)}{A} - \frac {(F_{in} \sqrt{H})}{A}$$Inputs:
1) Voltage (Amplifier), V, initial value is 1
2) Heat, Q = 500 Kj

Outputs:
1) Water Level, H, initially is 0.05 metres
2) Temperature, T, starting value is 10 degrees Celsius

Parameters:
1) Fin, flow of water IN the tank = 0.4 ##m^3##/hr
2) Fout, flow of water OUT the tank = 0.03 ##m^{2.5}##/hr
3) A, cross-sectional area of the tank (and therefore water as well) = 1.1 ##m^2##
4) Cp, Water heat capacity = 4.18 Kj/Kg C
5) rho, water density = 1000 Kg/##m^3##

Linearization of the non-linear Water Level differential equation with Taylor-series
Linearizing DE of water level and Substituting values (with input V=1) gives:
$$ H' = -\frac {0.03\sqrt{5}}{11} H + \frac {4}{11}$$
Substituting values in the temperature equation and simplifying gives:
$$T' = -\frac {8}{1.1}T + 74.9$$

Is this alright so far?
How do I get the state-space equations from here?
 
  • #7
Much better.
Don't put the numbers in until the very last step. If V is an input, you need V in your differential equations, etc. It doesn't have a value, in the general sense, that's what makes it an input; it can change. Inputs, outputs and states can change, they are variables. Everything else is a constant.

Also what are your state variables? Those are the quantities that describe the current conditions so you can proceed to solve the future values without the need for any historical information. So for example, if I want to know how much rocket fuel will be used to get to orbit, I don't need to know how you put the fuel in the rocket, I only need to know how much is there at launch.

I have to go now.
[again, I didn't actually check your work in any detail, sorry, to busy]
 
  • #8
DaveE said:
Much better.
Don't put the numbers in until the very last step. If V is an input, you need V in your differential equations, etc. It doesn't have a value, in the general sense, that's what makes it an input; it can change. Inputs, outputs and states can change, they are variables. Everything else is a constant.

Also what are your state variables? Those are the quantities that describe the current conditions so you can proceed to solve the future values without the need for any historical information. So for example, if I want to know how much rocket fuel will be used to get to orbit, I don't need to know how you put the fuel in the rocket, I only need to know how much is there at launch.

I have to go now.
[again, I didn't actually check your work in any detail, sorry, to busy]
Okay, keeping the V in then makes the water level linear equation:
$$ H' = -\frac {0.03\sqrt{5}}{11} H + \frac {4V}{11}$$
For temperature, instead we have an H, T and V in the equation, where the first two are outputs and the last is input, so i can't simplify it as i did above.
$$T' = 0.37 \frac {V}{H}(10-T) + \frac{k}{H}$$ not sure how to go about it from here
Where ##k = \frac {Q}{A \rho Cp}##
also i believe the states to be the temperature of the water and the water level inside the tank.
Thank you for the help so far
 
Last edited:
  • #9
Maniac_XOX said:
Okay, keeping the V in then makes the water level linear equation:
$$ H' = -\frac {0.03\sqrt{5}}{11} H + \frac {4V}{11}$$
For temperature, instead we have an H, T and V in the equation, where the first two are outputs and the last is input, so i can't simplify it as i did above.
$$T' = 0.37 \frac {V}{H}(10-T) + \frac{k}{H}$$ not sure how to go about it from here
Where ##k = \frac {Q}{A \rho Cp}##
also i believe the states to be the temperature of the water and the water level inside the tank.
Thank you for the help so far
$$T' = 0.37 \frac {V}{H}(10-T) + \frac{k}{H}$$
Nope. That's also not linear. Each state derivative needs to be expressed as a linear combination of the state variables so that you can construct the canonical state space formulation you seek.

I think it may be time for you to stop guessing at a solution and study the basics of linear systems. The matrix formulation of the state space isn't magic, it is just a simple concise description of a set of linear DEs.

Any of the many modern controls textbooks (or web sites?) is what you need next. You can address your water tank problem after you've solved some simpler examples.
 
  • #10
DaveE said:
$$T' = 0.37 \frac {V}{H}(10-T) + \frac{k}{H}$$
Nope. That's also not linear. Each state derivative needs to be expressed as a linear combination of the state variables so that you can construct the canonical state space formulation you seek.

I think it may be time for you to stop guessing at a solution and study the basics of linear systems. The matrix formulation of the state space isn't magic, it is just a simple concise description of a set of linear DEs.

Any of the many modern controls textbooks (or web sites?) is what you need next. You can address your water tank problem after you've solved some simpler examples.

I am looking into that now, after simplifying the equation as close as y=mx +c as possible it becomes:
$$ y' = (k1x - k2yx + k3)z^{-1} $$ where x, y and z represent input V, output T and output H respectively.

Am i supposed to linearize with taylor series for a function of 3 dimensions?
My time is a bit limited as i have a close deadline so I'd like to figure it out as soon as possible
 
  • #11
Maniac_XOX said:
Am i supposed to linearize with taylor series for a function of 3 dimensions?
yes
 
  • #12
DaveE said:
yes
I've given it a shot and ended up with the following:
General taylor series for 3 variables:
$$ f(x,y,z) \approx f(x_0,y_0,z_0) + f'_x (x_0,y_0,z_0)(x-x_0) +f'_y (x_0,y_0,z_0)(y-y_0) + f'_z (x_0,y_0,z_0)(z-z_0) ... $$
$$ T' = -K_1T - K_2H + K_3$$
where $$ K_1 = \frac {8}{1.1}, K_2 = 4.3496, K_3 = 75.1196$$

I have used ##x_0=V_0=1 , y_0=T_0=10 \text{ and } z_0=H_0=0.05##, it was a bit tedious but direct, if this looks alright then I think I can now start finding the state equations.

The linear DEs i have now are:
$$ T' = -K_1T - K_2H + K_3$$
$$ H' = -K_4H + K_5V$$

The state-space equations are:
$$x' = Ax + Bu$$
$$y = Cx + Du$$

Since I have two states, two inputs and two outputs, does that mean that I have two pairs of state space equations?
How do I find them?
 
Last edited:

Similar threads

Back
Top