Simulink: The two-tank problem
Q. In the two tank problem, we have a square pulse input flow, qi= (u(t-1)-u(t4))*Q where Q=0.012 m^3/s is the magnitude of the input flow in m3/sec and
u(t-a) is a step function at t=a. In this problem, we have A1(area of cross section
of tank 1) = 10 m^2 and A2 (area of cross section of tank 2) = 10 m^2. The two
tanks are initially filled with water up to 10 m and 5 m heights respectively.
(Take R1=10^5 and R2=10^5) where R1 and R2 are the resistances associated
with the pipes connecting tank 1 and 2 and the other serving as a opening for
tank2.
Solution: First of all, we will produce the input pulse with the help of two step
inputs s1 and s2. S1 having step at 1 and having magnitude 0.012, and s2 having
a step at 4 and magnitude as -0.012. These two signals are then combined with
the Sum Block available in the Math operations tab of Simulink library to
produce the resultant input.
Now let’s write the governing equations of the combined system.
Now as we can see, both the systems are interdependent on each other
and both have one state variable, which means there would in total 2
integrator blocks in our simulation diagram. Building the simulation
diagram with the help of previous notes of Simulink, we have the block
diagram as follows:
Fig. Final Simulation Diagram
Now, we save our Simulink file and open a MATLAB file in the same
folder from which we can give values to our variables inside the Simulink
file and call the Simulink file with the uploaded values.
Simulation results:
Configuration
parameters settings:
Start Time: 0
Stop Time: 10
Max Step Size: 0.05
Fig. H1 versus time graph
Fig. H2 versus time graph