Simulating dynamic tanks in EMSO (Part 1) Email This Post Print This Post

This post starts to our section of HOW-TO texts. My objetive with this specific post is to introduce using some free tools to different applications.

A classic problem in process engineering is the case of a dynamic tank where the output flow is proportional to its level (Fig. 1). This example is part of EMSO tutorial so that more details would be to consult in the EMSO manual.

Fig. 1. Dynamic tank.

Fig. 1. Dynamic tank.

In this approaching, the problem of dynamic tank involves 3 variables and 2 parameters such below:

Variables:

  • Fin: Input flow (m3/h)
  • Fout: Output flow (m3/h)
  • h: Tank level (m)

Parameters:

  • A: Tank area (m2)
  • k: Valve constant (m2.5/h)

This system is modeled as simple material balance given to:

\frac{d(hA)}{dt} = F^{in}-F^{out}

where the proprieties are considered constants so that, the volume that goes into tank minus the volume that goes out tank are equal to accumulated volume.

The output flow is given to valve equation:

F^{out} = k \sqrt{h}

where Fout is proportional to square root of the tank level h and a valve constant k.

EMSO modeling language is based on concepts of object-oriented programing. These kinds of applications get us possible to represent the problem through a code. As a result, when we are reading the code we are also reading a description of the problem. EMSO modeling language presents 3 basic entities: Model, DEVICES, and FlowSheet. An flowsheet of process is represented by the entity FlowSheet which is constituted by a set of components calls DEVICES. The DEVICES are equivalent to the true units of a process. In its turn, the mathematical description of each DEVICES is represented by the entity Model.

The Model of a single tank is given below:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
using "types";
 
Model tank
    PARAMETERS
    k as Real (Brief="Valve constant", Default=4, Unit='m^2.5/h');
    A as area (Brief="Tank area", Default=2);
 
    VARIABLES
in  Fin  as flow_vol(Brief="Input flow");
out Fout as flow_vol(Brief="Output flow");
    h    as length(Brief="Tank level");
 
    EQUATIONS
    "Material balance"
    diff(A*h) = Fin - Fout;
 
    "Valve equation"
    Fout = k*sqrt(h);
end

The line 1 indicates that Model used a external file (“types”) where contains all useful definition of unit of measurements such as area (line 6), flow_vol (lines 9-10), length (line 11), etc. In the line 4, the parameters are declared. In the line 8, the variables are declared. The in and out indicate that are input and output variables respectively.

Since there is a structure that represents a single tank, we can easily model a set of tanks in series (Fig. 2).

Fig. 2. Dynamic tanks in series.

Fig. 2. Dynamic tanks in series.

That set of tanks in series can be represented by FlowSheet below. This structure requires 1 input specification (line 32) and 2 initial conditions (line 35). The time of integration, step, and other specifications to solver are made in the section OPTIONS (line 39).

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
FlowSheet tanks
    VARIABLES
    Fin        as flow_vol;
 
    DEVICES
    tank1      as tank;
    tank2      as tank;
 
    CONNECTIONS
    Fin        to tank1.Fin;
    tank2.Fout to tank2.Fin;
 
    SPECIFY
    Fin = 10*'m^3/h';
 
    INITIAL
    tank1.h = 1*'m';
    tank2.h = 1*'m';
 
    OPTIONS
    TimeStep = 0.1;
    TimeEnd = 2;
    TimeUnit = 'h';
end

The solution of problem can be viewed in the own simulator’s GUI. Plots of variables to an analyze of the system dynamics are showed at Fig. 3-4.

Fig. 3. Tank input and output flows.

Fig. 3. Tank input and output flows.

Fig. 4. Tank levels.

Fig. 4. Tank levels.

Related Posts with Thumbnails