Main Content

Tank Fill and Empty with Animation

This example shows how to model the dynamics of liquid in a tank. The model simulates liquid inflow and outflow.

The model implements a control system to maintain the tank level within a desired range. The control system adjusts the inflow and outflow based on the current tank level. You can change the parameters for the initial water level, inflow and outflow rates, and the tank dimensions. The In Valve and Out Valve blocks simulate the liquid flow rate. The Tank Dynamics block models the differential equation that describes the dynamics of the liquid level inside a tank. The In Valve and Out Valve blocks regulate the inflow and outflow rates to maintain the desired liquid level.

The Animation Control block creates and updates a graphical display of the tank using an S-function. The animation shows the tank fill and empty when a flush pulse is applied.

To start the simulation and watch the tank fill and empty, click Start Sim. When the simulation ends, review the plot showing the liquid height and the states of the two valves.

See Also

|

Topics