Equations

Consider the following non-linear system:

tank

Variable V models the water volume of a tank. The water volume of the tank changes based on the incoming flow of water Qi and outgoing flow of water Qo. The tank can be modeled using the following CIF specification:

cont V = 5 der Qi - Qo;
alg real Qi = 1;
alg real Qo = sqrt(V);

Initially, the tank is filled with 5 liters of water. The incoming flow is constant at 1 liter per second. The outgoing flow increases as the water volume of the tank increases.

By separating the declarations of the three variables from their equations, the specification becomes more readable:

cont V = 5;
alg real Qi;
alg real Qo;

equation V' = Qi - Qo;
equation Qi = 1;
equation Qo = sqrt(V);

The values of the variables as time passes are shown in the following figure:

tank plot