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;
    tank1.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
  • Thierry Chappuis posted: Apr 14 2010 at 3:42 pm

    "Simulating dynamic tanks in EMSO (Parti 1)" http://bit.ly/aeWkNn #emso #chemicalengineering #processsimulator

  • […] This post was mentioned on Twitter by Thierry Chappuis. Thierry Chappuis said: "Simulating dynamic tanks in EMSO (Parti 1)" http://bit.ly/aeWkNn #emso #chemicalengineering #processsimulator […]

  • […] dos dois artigos abaixo que demonstra uma simples simulação de um tanque. vale muito a pena.Simulando Tanque Parte 1Simulando Tanque Parte 2Até o próximo post. Um abraço,Reiner Requião Categorias: […]

  • […] tanks case using the modeling language of EMSO that applies concepts of object-oriented languages (part 1). The second one used (part 2) resources of EMSO GUI to link models to figures and create a block […]

  • […] tanks case using the modeling language of EMSO that applies concepts of object-oriented languages (part 1). The second one used (part 2) resources of EMSO GUI to link models to figures and create a block […]

  • Alejandro Jaramillo Arango posted: Dec 14 2012 at 8:57 pm

    Dear Rodolfo, thanks so much for your blog. For me, it has been very helpful. Nontheless, I have to comment one little thing: At line 32, the connection is tank1.Fout to tank2.Fin.

    Have a nice day. Greetings from Colombia

  • Rodolfo Rodrigues posted: Dec 19 2012 at 3:36 pm

    Thank you very much, Alejandro. I already fixed the article.
    Have a good one!

  • Rama posted: May 13 2013 at 8:37 am

    Dear Rodolso,

    Thanks for the blog on EMSO, it is very useful to the first time users like me.

    I have one doubt, could you please help me with this doubt.

    If i write a flowchart as .mso file, can i be able to generate the diagram for this by exporting it as File>export diagram option.

    However, i see File>export diagram option is in active in my EMSO interface. what should i do to make this option active.

    and also could you please help me on how to link the flow sheet to the palette available in the EMSO.

    Thanks & Regards
    Rama

  • Rodolfo Rodrigues posted: May 17 2013 at 2:14 pm

    Rama,

    Thanks for reading my blog. I really apreciate comments.

    EMSO doesn’t generate diagram from mso files by itself. You have to do this by yourself. Please, read part 2 of this post.

    The option to export diagrams is related to export only as a figure.

    If you wish to create your own flow sheet diagram you should create a new diagram file to build flow sheets by drag and drop icons from the device palette.

    Regards,
    Rodolfo

  • John Capers posted: Jun 24 2013 at 3:24 am

    Dear Rodolfo,

    Can you explain how one can input data from a .txt or a .dat file to EMSO. It is very cumbersome to input huge chunks of data in the .mso file. If EMSO can read from .xlsx/.txt file then inputting data would be lot easier and tidy.

    Thanks

  • Rodolfo Rodrigues posted: Jun 25 2013 at 3:25 pm

    John,

    EMSO only supports input data file for estimation and reconciliation calculations. It also supports input data file as guess value to facilitate solver convergence. Any other kind of application you are encouraged to create an external routine to do that as a EMSO plugin. There are instructions for that in the EMSO manual.

    Regards,
    Rodolfo

  • […] dos dois artigos abaixo que demonstra uma simples simulação de um tanque. vale muito a pena. Simulando Tanque Parte 1 Simulando Tanque Parte […]