Linearizing a nonlinear model - simple water tank

Pandiani

Lifetime Supporting Member
Join Date
Apr 2005
Location
Tz
Posts
718
Hello guys,

these days, I was trying to linearize nonlinear model which is used in "PID problem" thread. I never linearized model before that, so I found out way to do it. Unfortunately, I didn't get results I expected. Before I continue to work on linear model in "PID problem" thread, I want to make sure I used linearization procedure correctly. I want to use simple water tank to apply linearization procedure.
You can find my model and whole procedure in the attached file.
Please comment...
 
I think I got something here, please refer to the attached pdf file and simulation (mdl) file.

This also helps me to refresh what I have learned, usually the lieanrization is done near the natural natural equilibrium point. In the tanker case, that is L=0, so It did take me sometime to figure out how to do this when L=1.2.

Anyway, hope this will do some help. Let me know your feedbacks.:p
 
Coolblind, I agree with your analysis. It helped me correct my mistakes.
Here is complete example of linearizing water tank system. I'm sure some of you will find it useful.
 
Sorry I didn't see this thread earlier. I have an article and MATLAB/Simulink files for this that I give to the college students I teach. Here it is.
 
So, you're a colledge professor...
Can you tell us what you think about our models?
 
Rytko, one comment: All your simulations are done with the initial contiditon exactly at h_i=10m, so there is few difference between the transfer function and state space.

How about change h_i a little bit, say to 9.5m. Then we should see something, that is why I believe state-space is more robust than tf at this point.


rytko said:
Sorry I didn't see this thread earlier. I have an article and MATLAB/Simulink files for this that I give to the college students I teach. Here it is.
 
Pandiani, I went through all of these pdf files, I could say we all come to the the transfer function, we just talked about the same thing in different perspectives.

For the transfer function, the key point is how to get over the none zero initial condition, no matter how you could call it, the forced equilibrium will do this.

Let me know what you think about this...

Again, just try change the initial condition like what I say in the above post, you will see the different between the transfer function and state-space.
 
That is a nice explanation using a simple example

rytko said:
Sorry I didn't see this thread earlier. I have an article and MATLAB/Simulink files for this that I give to the college students I teach. Here it is.

I saved the .pdf away. I don't have Matlab so I am stuck there.

Rytko's equation 13 and 14 show how the plant gain and time constant change with the height of the fluid. This information can be used in calculate PI gains on-the-fly using the formulas
http://www.controlguru.com/wp/p78.html

Again, just try change the initial condition like what I say in the above post, you will see the different between the transfer function and state-space.
I don't see why state space and transfer function or even differential equaions will provide different results. It is common to have non-linear differential equations but one can also make the transfer function take into account non-linearities.

Use Ryto's equations 13 and 14 to do this
Gp(s,level)=Kp(level)/(tp(level)*s+1)

It is possible to recalculate the gains before using them on each update.
 
Last edited:
Peter, will try to post some picture tomorrow. Then you can see the transfer function is NOT as good as the state space(In fact huge different if change h0 from 1.2 to 1.1 and use the same transfer function and state space).

One think I can come up now is you can incoperate the initial condition into state space model but not transfer function.

At last, the state space and differential equation(linearized) are essentially the same.
 
Last edited:
coolblind said:
Peter, will try to post some picture tomorrow. Then you can see the transfer function is NOT as good as the state space(In fact huge different if change h0 from 1.2 to 1.1 and use the same transfer function and state space
I think it depends on implementation. It will be interesting to see what you do.

One think I can come up now is you can incoperate the initial condition into state space model but not transfer function.
I know this can be done. My difequ books provides examples. The transfer function just has some extra terms. I have never seen a transfer function with initial conditions in the s domain in a control book. That doesn't mean it can't be done. I just means it isn't that practical unless you want to convert directly from the s domain t the time domain.
 
Here are my simulation result:

1. First with the exactly the initial condition h_0=1.2m in Pandiani's first post.

ExactInitial.jpg



2. Then just change the initial condition to h_0=1.1m, you can see the state space model output can still track the nonlinear system well but Not for the transfer funciton.

ChangedInitial.jpg



Also, my simulation setup in Matlab/Simulink shows in the attached PDF file.
 
Coolblind

The two should be the same. Something is not right. What are constant 1 and constant 3. If they are inflow then why are they different? You should always sanity check your work. I do this using the steady state test. I set the derivatives to 0 and compute the steady state value. For some reason your two models are quite different. I have a feeling you are not comparing apples to apples.

So why is there a difference? The steady state equations should yield the same steady state value. If not why not?

Rytko's document was good because it explained the variables and showed the process step by step. I know that takes some effort but if I a document isn't clear to me I doubt it will be clear to many others. I have got to start using equation numbers like Rytko does.
 
The whole point of using deviation variable models is that they are independent of initial conditions. I've modified my original scripts and models to allow linearization and simulation using the initial height as the operating point. I've made a few other tweaks as well, including export of the plots as both .eps and .jpeg, and changed my initial height to 1 m.

coolblind, I don't think you're taking into account the way I built my models by the way you simulated. I did not use Simulink's tf block. I agree that the Simulink tf block does not allow initial conditions to be taken into account. (I even modified my Simulink nonlinear models to use the initial conditions given in the MATLAB script automatically in this pass). I simulated the tf in MATLAB, and because I'm using deviation variables in my simulation, I simply add the initial conditions of the height to the output height predicted by my simulation. The initial height is thus accounted for when calculating the gain, the time constant, and the output value, no matter what the initial height may be.

Plots are included in the .zip file at the new operating point of 1 m.
 
rytko said:
... I simulated the tf in MATLAB, and because I'm using deviation variables in my simulation, I simply add the initial conditions of the height to the output height predicted by my simulation. The initial height is thus accounted for when calculating the gain, the time constant, and the output value, no matter what the initial height may be.
...
QUOTE]

rytko, I went through your M file and mdl file this time, and I saw you got the step response for the TF module in Matlab just used step() and the nonlinear response in mdl file.

1. You are right about "add the initial conditions of the height to the output height predicted by my simulation.". I did the same thing in my simulink file, after the output of the tf block, I added the h_0 thre.


2. What I want to say is the tf module is too sensitive to the error in the initial condition(h_0 here) which means it is not ROBUST to the disturbance.You can see it by doing this:
  • set the h_0=10, and calculate the time constant Tao and gain K through eq 13 and 15, also the input u= F-F_i, keep them fixed.
  • Now, assume due to the error of your sensor or whatever, the real water level is 9.9m. It means you should change the initial condition for the "Integrator" block from 10 to 9.9 in your "tank.mdl", and change the line 32 of your "lin_tank_export.m" to
    "h = plot(tout,simout,'k',t,y+9.9,'k--');"
  • Run the "lin_tank_export.m", you will see what I am talking about
  • Notice, the 0.1m (10m-9.9m) error is NOT unusually in the real world, and the result from my computer is as following:
TankRobust.jpg
 

Similar Topics

Hello all, I am working on a project where I need to use data that is plotted on a graph that is nonlinear. To help clarify, this is an...
Replies
18
Views
13,829
HI Guys, I am in the process of implementing a nonlinear controller for dissolved oxygen concentration of the activated sludge process, as it is a...
Replies
0
Views
1,975
What happens if you power up a 1783-MS10T with a Compact Flash card from a 1783-MS06T? Does it work, but with the "extra" ports unconfigured? If...
Replies
0
Views
50
Hi , Where i can find Mitsubishi PLC Card end of line & replacement model details. i am looking for Q02CPU replacement model. Please advice. thanks
Replies
2
Views
108
I've blown the Output Transistor on the Output Card of a Compact Logix 1769-L24ER-QBFC1B It says J378. Does anyone know the replacement part...
Replies
3
Views
191
Back
Top Bottom