Suppose that $x(t)$ is the state variable showing the level of water in a tank at time $t$, and water is leaking the tank with rate $\lambda$. Control is denoted by $u(t)$ which is the amount of water added into a tank at time $t$. I am willing to know how is it possible to consider the amount of water added into the tank during time interval $[t-\tau,t]$ and also the amount of water added into the tank in this time interval for a specific value of $u(s)$ which can be denoted as $s_{\tau}(t,u)$.

For example, $s_{\tau}(t,2)$ means the amount of water added into the tank in interval $[t-\tau,t]$ when control is exactly equal to 2 for some times in this interval.


1 Answer 1


If you need to know the change of the amount of water between time $[t-\tau, t]$, you just need to store the previously measured amounts somewhere they can be accessed later (using an array is a popular method here). If you like to test an alternative input, you first need to model the tank. This can be done using Bernoulli's principle (advised to express the input as a flow instead of an amount). As your system has some kind of leakage, the resulting system will be non-linear. This mean you can go in multiple directions:

  1. Use ODE solvers to solve your system for a given $s_\tau(t,u)$, this will compute an accurate estimation including non-linear dynamics.
  2. Linearize and discretize the system, computationally the least intensive method. Since the solution can be computed algebraically (even without integrals), it can be easily used to control the system. yet by linearizing the system, the estimation is only accurate for some range in height.

The first one is the better option if you know the input sequence and just want to simulate it, the latter one is pretty much required if you want to build a model-predictive-controller for it.

EDIT: To answer your question. That integral would suit if the water in the tank is not also leaking. So if the water level is denoted as $x(t)$ and the tank is not leaking, it can be expressed as the following: $$u(t) = S\dot{x}(t)$$ Where $S$ is the surface area of the tank and $u(t)$ is the flow of water entering the tank (controlled). This means that the waterlevel at time $t$ starting from time $t-\tau$ where $\tau \geq t$ is: $$x(t) = \frac{1}{S}\int_{t-\tau}^t u(t) dt + x(t-\tau)$$ Again, this can be only this simply expressed if the tank is not leaking. Using bernoulli's principle, if we include the leakage, the equation changes to: $$\dot{x}(t) = \frac{1}{S}u(t) - \frac{1}{S}\alpha\sqrt{2g x(t)}$$ With valve specific parameter $\alpha$ and the gravitation acceleration $g$. Now you cannot simply solve this by integrating it over time. Sadly, the only way to properly predict the future water level is to incorporate the leakage dynamics.

  • $\begingroup$ Dear @Petrus1904 Thanks. Can I consider the amount of water added in interval $[t-\tau,t]$ as $\int_{max(t-\tau,0)}^{t} u(s) ds$ and then replace it with $y(t)$ where $\dot{y}(t)=u(t)-u(max(t-\tau,0))$? Here, I don't know how to calculate the amount of water added into the tank for a specific value of $u$. $\endgroup$
    – Amin
    Jan 10, 2021 at 18:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .