Question 7.5: A Two-Tank Liquid-Level System Figure 7.12 shows a liquid-le...
A Two-Tank Liquid-Level System
Figure 7.12 shows a liquid-level system, in which two tanks have cross-sectional areas A_{1} and A_{2}, respectively. A pump is connected to the bottom of tank 1 through a valve of linear resistance R_{1}. The liquid flows from tank 1 to tank 2 through a valve of linear resistance R_{2}, and leaves tank 2 through a valve of linear resistance R_{3}. The density \rho of the liquid is constant.
a. Derive the differential equations in terms of the liquid heights h_{1} and h_{2}. Write the equations in second-order matrix form.
b. Assume the pump pressure \Delta p is the input and the liquid heights h_{1} and h_{2} are the outputs. Determine the state-space form of the system.

Learn more on how we answer questions.
a. Applying the law of conservation of mass to tank 1 gives
\frac{\mathrm{d} m}{\mathrm{~d} t}=q_{\mathrm{mi}}-q_{\mathrm{mo}}.
where
\frac{\mathrm{d} m}{\mathrm{~d} t}=\rho A_{1} \frac{\mathrm{d} h_{1}}{\mathrm{~d} t}.
The mass flow rates entering and leaving tank 1 can be written as
q_{\mathrm{mi}}=\frac{\left(p_{\mathrm{a}}+p\right)-\left(p_{\mathrm{a}}+\rho g h_{1}\right)}{R_{1}}=\frac{p-\rho g h_{1}}{R_{1}}
and
q_{\mathrm{mo}}=\frac{\left(p_{\mathrm{a}}+\rho g h_{1}\right)-p_{\mathrm{a}}}{R_{2}}=\frac{\rho g h_{1}}{R_{2}}
Substituting these expressions results in
\rho A_{1} \frac{\mathrm{d} h_{1}}{\mathrm{~d} t}=\frac{p-\rho g h_{1}}{R_{1}}-\frac{\rho g h_{1}}{R_{2}},
which can be rearranged as
\rho A_{1} \frac{\mathrm{d} h_{1}}{\mathrm{~d} t}+\rho g h_{1}\left(\frac{1}{R_{1}}+\frac{1}{R_{2}}\right)=\frac{p}{R_{1}} .
Applying the law of conservation of mass to tank 2 gives
\frac{\mathrm{d} m}{\mathrm{~d} t}=q_{\mathrm{mi}}-q_{\mathrm{mo}},
where
\frac{\mathrm{d} m}{\mathrm{~d} t}=\rho A_{2} \frac{\mathrm{d} h_{2}}{\mathrm{~d} t}.
The mass flow rates entering and leaving tank 2 can be written as
q_{\mathrm{mi}}=\frac{\left(p_{\mathrm{a}}+\rho g h_{1}\right)-p_{\mathrm{a}}}{R_{2}}=\frac{\rho g h_{1}}{R_{2}}
and
q_{\mathrm{mo}}=\frac{\left(p_{\mathrm{a}}+\rho g h_{2}\right)-p_{\mathrm{a}}}{R_{3}}=\frac{\rho g h_{2}}{R_{3}} .
Substituting these expressions results in
\rho A_{2} \frac{\mathrm{d} h_{2}}{\mathrm{~d} t}=\frac{\rho g h_{1}}{R_{2}}-\frac{\rho g h_{2}}{R_{3}}.
which can be rearranged as
\rho A_{2} \frac{\mathrm{d} h_{2}}{\mathrm{~d} t}-\frac{\rho g h_{1}}{R_{2}}+\frac{\rho g h_{2}}{R_{3}}=0.
The system of differential equations in second-order matrix form is found to be
\left[\begin{array}{cc} \rho A_{1} & 0 \\ 0 & \rho A_{2} \end{array}\right]\left\{\begin{array}{c} \frac{\mathrm{d} h_{1}}{\mathrm{~d} t} \\ \frac{\mathrm{d} h_{2}}{\mathrm{~d} t} \end{array}\right\}+\left[\begin{array}{cc} \frac{\rho g}{R_{1}}+\frac{\rho g}{R_{2}} & 0 \\ -\frac{\rho g}{R_{2}} & \frac{\rho g}{R_{3}} \end{array}\right]\left\{\begin{array}{l} h_{1} \\ h_{2} \end{array}\right\}=\left\{\begin{array}{c} \frac{p}{R_{1}} \\ 0 \end{array}\right\} .
b. As specified, the state, the input, and the output are
\mathbf{x}=\left\{\begin{array}{l} x_{1} \\ x_{2} \end{array}\right\}=\left\{\begin{array}{l} h_{1} \\ h_{2} \end{array}\right\}, \quad u=p, \quad \mathbf{y}=\left\{\begin{array}{l} h_{1} \\ h_{2} \end{array}\right\} .
The state-variable equations are
\begin{aligned} & \dot{x}_{1}=\frac{\mathrm{d} h_{1}}{\mathrm{~d} t}=-\frac{g}{A_{1}}\left(\frac{1}{R_{1}}+\frac{1}{R_{2}}\right) h_{1}+\frac{1}{\rho A_{1} R_{1}} p, \\ & \dot{x}_{2}=\frac{\mathrm{d} h_{2}}{\mathrm{~d} t}=\frac{g}{A_{2} R_{2}} h_{1}-\frac{g}{A_{2} R_{3}} h_{2}, \end{aligned}
or in matrix form
\left\{\begin{array}{l} \dot{x}_{1} \\ \dot{x}_{2} \end{array}\right\}=\left[\begin{array}{cc} -\frac{g}{A_{1}}\left(\frac{1}{R_{1}}+\frac{1}{R_{2}}\right) & 0 \\ \frac{g}{A_{2} R_{2}} & -\frac{g}{A_{2} R_{3}} \end{array}\right]\left\{\begin{array}{c} x_{1} \\ x_{2} \end{array}\right\}+\left[\begin{array}{c} \frac{1}{\rho A_{1} R_{1}} \\ 0 \end{array}\right] u .
The output equation is
\left\{\begin{array}{l} y_{1} \\ y_{2} \end{array}\right\}=\left[\begin{array}{ll} 1 & 0 \\ 0 & 1 \end{array}\right]\left\{\begin{array}{l} x_{1} \\ x_{2} \end{array}\right\}+\left[\begin{array}{l} 0 \\ 0 \end{array}\right] u .