From: Ali on
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
From: Ali on
Still I'm waiting your reply, because really I need it for emergency

Thanks a lot
From: Roger Stafford on
"Ali " <wadyan(a)gmail.com> wrote in message <hnqdtt$346$1(a)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
From: TideMan on
On Mar 18, 5:30 pm, "Ali " <wad...(a)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).

From: Walter Roberson on
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.