A tank controlled by a PI controller


Wolfram Language



This is a component based model of the following one-tank system with a PI controller:

The water level, h, in the tank is a function of the flow in and out from the tank, and the tank area:

The input flow is given by the LiquidSource component and is constant the first 150 seconds and then triples. By controlling the output flow of the tank with a PI controller the liquid level is held at a desired reference value.

By simulating the model for 350 seconds we can see that the tank level starts to increase reaching and passing the desired reference level. When the desired level is passed the outflow is opened and after 150 seconds the level has stabilized. However at this moment the input flow is suddenly increased and the water level is therefore increased before the controller manages to stabilize it again. This is illustrated in the figure below:

The FlatTank model is a model of the same system, but implemented without the use of components.

The TankPID model is a model of the same system, but with a PID controller.

For a step by step tutorial see Hierarchical Model—Tank System.

Components (3)


Type: LiquidSource


Type: PIController


Type: Tank