Now we show the tank model using the object oriented component-based approach. The structure of the tank system model using this approach is clearly visible in Figure 1 below.
A tank system with a continuous PI controller and a source for liquid.
The three components of the tank system: the tank, the PI controller and the source of liquid are explicit in Figure 1 and in the declaration of the class TankPI below. Tank instances of tank, source and piContinuous are connected to controllers and liquid sources through their connectors.
The tank has four connectors: qIn for input flow, qOut for output flow, tSensor for providing fluid level measurements, and tActuator for setting the position of the valve at the outlet of the tank.
The central equation regulating the behavior of the tank is the mass balance equation, which in the current simple form assumes constant pressure. The output flow is related to the valve position by a flowGain parameter, and by a limiter that guarantees that the flow does not exceed what corresponds to the open/closed positions of the valve.
A limiter function is needed in the model to reflect minimum and maximum flows through the output valve: