In a coupled tanks system, what is the control strategy to simultaneously control the level in multiple tanks. In this case the actuators influence multiple control variables. The system is as shown in this diagram

enter image description here

The variables to be controlled are the liquid levels in each of the tanks. The actuators are the valves on the pipes as well as the inlet flow q0. The problem is that the same actuator e.g. V1 influences both h1 and h2. I tried to 3 different PIDs for each tank. Each controller receives the height in the corresponding tank and sends the control signal to the corresponding outlet. So, PID1 receives input h1 and controls only V1; PID2 receives input h2 and controls only V2...

  • 3
    $\begingroup$ Keep the valves beteeen the tanks open. $\endgroup$
    – Solar Mike
    Commented Apr 18, 2018 at 11:23
  • 1
    $\begingroup$ It would be better to include the image inline in your question instead of requiring someone to click through in order to see it. External links go stale over time and future visitors to this question will not be able to see the system you are asking about. $\endgroup$
    – user16
    Commented Apr 18, 2018 at 11:38
  • $\begingroup$ @SolarMike That will only work if the level in all 3 tanks is to be the same. If you want independent set points for each of the 3 tanks, it's a different matter. $\endgroup$
    – am304
    Commented Apr 18, 2018 at 11:58
  • $\begingroup$ @am304 so given the question my comment was fine... perhaps asking the OP to clarify the situation so we all know... $\endgroup$
    – Solar Mike
    Commented Apr 18, 2018 at 13:18
  • 1
    $\begingroup$ So, simple : connect the supply (and output) such that the tanks are in parallel - makes control easier as each tank becomes individual... You should also add such pertinant information to the original question - people don’t like trawling through comments trying to piece the question together... $\endgroup$
    – Solar Mike
    Commented Apr 18, 2018 at 16:47

2 Answers 2


You are dealing with a multi-input multi-output system (MIMO) system in which case you can't in general apply the same techniques as for single-input single-output (SISO) systems. If you are dealing with a linear time invariant MIMO system, then you could use something called the relative gain array to see how well a SISO control approach would work. However in this case I believe you are dealing with a nonlinear system, but it might be possible to do input-output decoupling, namely by controlling the netto inflow into each tank. For this I assume for now that you can choose the flow rates $q_0$, $q_1$, $q_2$ and $q_3$ and that the dynamics can be written as

$$ \begin{align} \dot{h}_i = \alpha_i (q_{i-1} - q_i) \tag{1} \end{align} $$

so the combines dynamics can be written as

$$ \dot{\vec{h}} = \begin{bmatrix} \alpha_1 & -\alpha_1 & 0 & 0 \\ 0 & \alpha_2 & -\alpha_2 & 0 \\ 0 & 0 & \alpha_3 & -\alpha_3 \end{bmatrix} \vec{q} \tag{2} $$

where $\vec{h} = \begin{bmatrix}h_1 & h_2 & h_3\end{bmatrix}^\top$ and $\vec{q} = \begin{bmatrix}q_0 & q_1 & q_2 & q_3\end{bmatrix}^\top$. Now by defining a virtual input $\vec{v}$ such that $\dot{\vec{h}} = \vec{v}$, then every input and output pair is decoupled. For this we need

$$ \begin{bmatrix} \alpha_1 & -\alpha_1 & 0 & 0 \\ 0 & \alpha_2 & -\alpha_2 & 0 \\ 0 & 0 & \alpha_3 & -\alpha_3 \end{bmatrix} \vec{q} = \vec{v} \tag{3} $$

which can be solved for $\vec{q}$ using a pseudo inverse of the matrix on the left hand side. There are multiple ways this could be done, but the solution which minimizes $\|\vec{q}\|$ yields

$$ \vec{q} = \begin{bmatrix} \frac{3}{4\,\alpha_1} & \frac{1}{2\,\alpha_2} & \frac{1}{4\,\alpha_3} \\ \frac{-1}{4\,\alpha_1} & \frac{1}{2\,\alpha_2} & \frac{1}{4\,\alpha_3} \\ \frac{-1}{4\,\alpha_1} & \frac{-1}{2\,\alpha_2} & \frac{1}{4\,\alpha_3} \\ \frac{-1}{4\,\alpha_1} & \frac{-1}{2\,\alpha_2} & \frac{-3}{4\,\alpha_3} \end{bmatrix} \vec{v}. \tag{4} $$

So now you can use normal SISO control methods, like PID, for each $h_i$-$v_i$ pair which would drive $\vec{h}$ to a desired value.

However there is probably not a linear relation between $q_i$ and $V_i$, but more likely something like $q_i \propto \sqrt{V_i(h_i - h_{i+1})}$ or some other nonlinear state depended function. If you know this relation more accurately you could come up with a nonlinear controller, otherwise you could perform sequential loop closing. For the sequential loop closing you use $V_i$ to control $q_i$ to its desired value defined by $\vec{v}$ from equation $(4)$.

If you have some more challenging reference signal for the heights, then you might have to resort to even more advance techniques, such as model predictive control. For example when the reference heights are such that $h_{r,1} < h_{r,2}$ and $h_{r,2} > h_{r,3}$ but your system starts at $h_1 = h_2 = h_3 < h_{r,2}$, then it will initially not be possible to have a positive inflow into the second tank and to reach the desired heights $h_1$ actually has to be bigger than $h_2$ for a while in order for $h_2$ to reach its goal.


I'm not a control systems person, so forgive my not very systematic approach.

The first thing you should do is to try to adjust the valves manually for a constant q, to reach the levels you want.

I would control q from the average of the height deviations from the wanted height in each tank. If the water level overall is lower than wanted, increase q, and vice versa.

The control variable for the valves should be the height difference between two consecutive tanks: V1 is controled for h1-h2, these height differences you compute from the wanted heights in all tanks. Only valve 3 is controlled for h3 directly.

Also make it so that the first valve is quicker than the second and the second quicker thant the third. This should help you avoid oscillations.

Despite that I promised a non systematic approach, here's a bit of reasoning: For a given q, there's a relationship between height difference and how open or closed the valve is. This is likely why your strateg didn't work.

  • $\begingroup$ This is an interesting idea. I will try it and get back to you $\endgroup$
    – yaska
    Commented Apr 19, 2018 at 9:53
  • $\begingroup$ @Ranade got around to try? How did it go? $\endgroup$
    – mart
    Commented May 14, 2018 at 6:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.