Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
How to create this non-linear equation

Subject: How to create this non-linear equation

From: Ali

Date: 17 Mar, 2010 11:20:29

Message: 1 of 7

Hello

I have a headache problem about designing a tank level controller, its final material balance equation is in a nonlinear form:

A*(dh/dt)=qi-Cv*sqt(h)

A: Tank diameter
dh/dt: derivative of the tank's level
qi: flow inlet to the tank
Cv: parameter of the outlet stream's control valve
sqt(h): square root of the h


The idea is to control the level of the tank by controlling the opening of the final control element on the outlet stream (i.e, controlling dischare pump, or control valve) .. And at the same time, we don't know about the inlet flow rate to the tank, and this is why I put it in a variable form in the equation (qi)


I think I should use >>dee comand "differential equation editor" .. but I don't have experience to do that task


Any body can help me, please :(


Thank you so much

Subject: How to create this non-linear equation

From: Ali

Date: 18 Mar, 2010 04:30:23

Message: 2 of 7

Still I'm waiting your reply, because really I need it for emergency

Thanks a lot

Subject: How to create this non-linear equation

From: Roger Stafford

Date: 18 Mar, 2010 06:46:06

Message: 3 of 7

"Ali " <wadyan@gmail.com> wrote in message <hnqdtt$346$1@fred.mathworks.com>...
> .......
> A*(dh/dt)=qi-Cv*sqt(h)
>
> A: Tank diameter
> dh/dt: derivative of the tank's level
> qi: flow inlet to the tank
> Cv: parameter of the outlet stream's control valve
> sqt(h): square root of the h
>
> The idea is to control the level of the tank by controlling the opening of the final control element on the outlet stream (i.e, controlling dischare pump, or control valve) .. And at the same time, we don't know about the inlet flow rate to the tank, and this is why I put it in a variable form in the equation (qi)
> ........

  If the value of qi is unknown to you or varies unpredictably, then you will have to adjust Cv in some manner depending on the observed levels of h. The way in which this is done needs to be known if you are to solve your differential equation, and the optimum method will surely depend on the manner qi is likely to vary with time. Clearly your goal is to keep Cv adjusted so that qi-CV*sqrt(h0) is kept at a zero value, where h0 is the desired tank level. When that is true, your dh/dt value drops to zero and the level remains constant. However, you have all kinds of worry about stability and convergence rate with your feedback loop in such a procedure.

  In case it is of any value to you, your original differential equation can be solved analytically with t as a function of h provided qi and Cv are held constant, (though apparently that is not really the case.) The solution would be:

 t = -2*A/Cv^2*(qi*log(qi-Cv*sqrt(h))-(qi-Cv*sqrt(h)) + K

where K is an arbitrary constant of integration. (I have assumed that h is rising from below here. The opposite case is similar.) As you see, as h approaches (qi/Cv)^2, t will be approaching infinity because of the logarithm term, qi and Cv being held constant. The asymptotic behavior of h as a function of t for large t would therefore be:

 h = ((qi-exp(-Cv^2/(2*A*qi)*(t-K)))/Cv)^2

Roger Stafford

Subject: How to create this non-linear equation

From: TideMan

Date: 18 Mar, 2010 07:15:07

Message: 4 of 7

On Mar 18, 5:30 pm, "Ali " <wad...@gmail.com> wrote:
> Still I'm waiting your reply, because really I need it for emergency
>
> Thanks a lot

Looks to me like a simple homework assignment in hydraulics.
Are you sure it's sqrt(h) and not sqrt(h^3)?
My old hydraulics lecturer Frank Henderson shows how to solve it
numerically in his book Henderson (1966) Open Channel Flow. He calls
it storage routing and shows how it can be solved using what we would
call a speadsheet (which did not exist as such back in 1966).

Subject: How to create this non-linear equation

From: Walter Roberson

Date: 18 Mar, 2010 08:37:08

Message: 5 of 7

Ali wrote:
> Hello
>
> I have a headache problem about designing a tank level controller, its
> final material balance equation is in a nonlinear form:
>
> A*(dh/dt)=qi-Cv*sqt(h)
>
> A: Tank diameter
> dh/dt: derivative of the tank's level
> qi: flow inlet to the tank
> Cv: parameter of the outlet stream's control valve
> sqt(h): square root of the h
>
>
> The idea is to control the level of the tank by controlling the opening
> of the final control element on the outlet stream (i.e, controlling
> dischare pump, or control valve) .. And at the same time, we don't know
> about the inlet flow rate to the tank, and this is why I put it in a
> variable form in the equation (qi)

I am confused about which variable you are trying to solve for.

Analyzing, I find that qi has a discontinuity and becomes negative if
Cv*sqrt(h) becomes too small. This suggests that for low inflows, since
h would naturally continue to drop, Cv would have to be driven high to
prevent the discontinuity. The point of discontinuity has no closed form
solution, and there can be multiple discontinuities in a small range,
such as for Cv*sqrt(h) in 0.099943..0.099944 . I gather (but am not
certain) that there are an infinite number of such discontinuities in qi
(having to do with the LambertW function having infinite solutions) .
Which suggests that you'd really rather not be solving for qi because
the controller might have to drive Cv discontinuously in order to avoid
hitting the forbidden reasons as h falls.

But what you _would_ like to be solving for... I don't know.

If you are trying to solve for h, then it is

qi^2*(LambertW(1/qi*exp(-1/2*(2*A*qi-C*Cv^2)/A/qi))+1)^2/Cv^2

where C is the constant of integration (remember, the indefinite
integral has an implicit +C where C is an independant constant, since
the derivative of a constant is 0.) This arbitrary constant of
integration is, I understand, often the key to solving the boundary
conditions for differential equations.

Solving for Cv again runs into LambertW situations, and the solutions
you get depend near-linearly upon the constant of integration.

Subject: How to create this non-linear equation

From: Ali

Date: 18 Mar, 2010 08:47:08

Message: 6 of 7

First of all, I have to thank you so much for your great reply & time consumed for me .. & I believe strongly you can help me with the following missed details:

Also, I don't forget TideMan's favour .. Thanks :)

This is not a homework; this is a course on-site project...

The objective of this modeling is to develop a PID controller for controlling the level of our process. We have CRT "Condensate Recovery Tank" which is used in the boiler in series between Gas and Steam Turbines (I mean Compained Cycle Power Plant). The temperature of the DEMIN Water will not effect on the level inside that tank; i.e, there is no apparent level comes from the generated bubbles, because there is no bubbles "it is just a warm water - around 62deg with normal pressure".

The inlet flow to the CRT Tank comes from the ACC Fans which means that the qi is not constant.

The level inside the CRT Tank should be controlled by measuring the level and adjusting the opening of the discharge control valve which is in series with constant speed pump on the exit stream.

Please see the following picture, I have drew it by paint program:
http://img41.imageshack.us/img41/6423/87397795.jpg

Off course, there is an override controller to bypass the inlet flow to the CRT Tank in case the outlet flow from the CRT Tank is more than enough for the Deaerator Unit; but this is not in our object .. Our object is just about how to maintain the level inside the CRT at the set value, and because there is no apparent level caused by bubbles inside the CRT so PI-Controller will achieve our object.


Mr. Roger,

I'm not an expert in the MATLAB .. & I think to find the Transfer Function of the above non-linear equation (to use it in our Feed-Back Control Loop) we need to plot the non-linear graph and then linearizing it by using some functions in the MATLAB.

Then, I don't know if the program has the facilities to find the PI Parameters; otherwise I should use DS or IMC for finding the PI Parameters.

Subject: How to create this non-linear equation

From: Arkadiy Turevskiy

Date: 30 Mar, 2010 22:01:20

Message: 7 of 7

You can create this model in Simulink easily. You can use PID Tuner to automatically design a PID controller for you.
In fact it took me ~10 minutes to do this.
Arkadiy


"Ali " <wadyan@gmail.com> wrote in message <hnspac$p94$1@fred.mathworks.com>...
> First of all, I have to thank you so much for your great reply & time consumed for me .. & I believe strongly you can help me with the following missed details:
>
> Also, I don't forget TideMan's favour .. Thanks :)
>
> This is not a homework; this is a course on-site project...
>
> The objective of this modeling is to develop a PID controller for controlling the level of our process. We have CRT "Condensate Recovery Tank" which is used in the boiler in series between Gas and Steam Turbines (I mean Compained Cycle Power Plant). The temperature of the DEMIN Water will not effect on the level inside that tank; i.e, there is no apparent level comes from the generated bubbles, because there is no bubbles "it is just a warm water - around 62deg with normal pressure".
>
> The inlet flow to the CRT Tank comes from the ACC Fans which means that the qi is not constant.
>
> The level inside the CRT Tank should be controlled by measuring the level and adjusting the opening of the discharge control valve which is in series with constant speed pump on the exit stream.
>
> Please see the following picture, I have drew it by paint program:
> http://img41.imageshack.us/img41/6423/87397795.jpg
>
> Off course, there is an override controller to bypass the inlet flow to the CRT Tank in case the outlet flow from the CRT Tank is more than enough for the Deaerator Unit; but this is not in our object .. Our object is just about how to maintain the level inside the CRT at the set value, and because there is no apparent level caused by bubbles inside the CRT so PI-Controller will achieve our object.
>
>
> Mr. Roger,
>
> I'm not an expert in the MATLAB .. & I think to find the Transfer Function of the above non-linear equation (to use it in our Feed-Back Control Loop) we need to plot the non-linear graph and then linearizing it by using some functions in the MATLAB.
>
> Then, I don't know if the program has the facilities to find the PI Parameters; otherwise I should use DS or IMC for finding the PI Parameters.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us