- ChENGINEER SPACE - http://chengineer.com -

Simulating dynamic tanks in EMSO (Part 2)

Posted By Rodolfo Rodrigues On March 6, 2010 @ 2:08 pm In Didactic application,HOW-TO,Process simulation,Softwares | 3 Comments

This is the second part of our text “Simulating a dynamic tank in EMSO”. The first part shows the basic theory about EMSO modeling language applied to model a dynamic tank. The code to a single tank was implemented and expanded to a set of tanks in series.

Fig. 1. Dynamic tanks in series.

Fig. 1. Dynamic tanks in series.



Last post [1] did the expansion of a single tank to series using codes however, in bigger/more complex systems, it could be hard building. In this sense, it should be more interesting if there is a GUI where a flowsheet (diagram) can be built connecting blocks in a workspace such as in sequential modular simulators (Aspen Plus, HYSYS, etc.)

In EMSO we can attribute an image/icon to a Model adding a new section called ATTRIBUTES. The reserved keywords in and out are required to promote the input and output data from a model those are physically represented by the inlet and outlet flows (streams). However, in order to take the block connections actived the inlet and outlet flows must be compatible and defined by their own Model. For this purpose the “tank_flow” model was created (lines 3-6).

Thus all connections are compatible but the interface design diagram does not admit a single block for simulation. One block needs at least one input block. For this a block called “tank_source_test” (lines 8-15) was created using the “tank_flow” model. So it represents a source block that gets the flowsheet started.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using "types";
 
Model tank_flow
    VARIABLES
    F as flow_vol (Brief="Flow");
end
 
Model tank_source_test
    ATTRIBUTES
    Pallete = true;
    Icon = "source_icon";
 
    VARIABLES
out Outlet as tank_flow (Brief="Inlet stream", PosX=1, PosY=0.65);
end
 
Model simple_tank_test
    ATTRIBUTES
    Pallete = true;
    Icon = "tank_icon";
 
    PARAMETERS
    k as Real (Brief="Valve constant", Default=4, Unit='m^2.5/h');
    A as area (Brief="Tank area", Default=2);
 
    VARIABLES
in  Inlet  as tank_flow (Brief="Input flow", PosX=0, PosY=0.17);
out Outlet as tank_flow	(Brief="Output flow", PosX=1, PosY=0.94);
    h      as length	(Brief="Tank level");
 
    EQUATIONS
    "Material balance"
    diff(A*h) = Inlet.F - Outlet.F;
 
    "Valve equation"
    Outlet.F = k*sqrt(h);
end

EMSO diagram properties [2]Therefore “tank_source_test” (lines 8-15) and “simple_tank_test” (lines 17-37) define the blocks that would be loading on the pallete in Model tab according to their ATTRIBUTES sections. Icon gives the icon as a PNG image (source_icon.png [3], tank_icon.png [4]) so that Pallete set as true means that the related icon is loaded on the EMSO pallete (Model tab). PosX and PosY guide the positions for point connections.
Adding our work folder to EMSO library (Config > Libraries > Add Library) and restarting it, we will be the new blocks loaded on the EMSO pallete of equipments.
Now let us build the flowsheet of 2 tanks as in last post [1]. Firstly create a new file of type “Diagram” so that a “Diagram setup” window will open to editing properties. Go to “Options” tab and set start time, end time, and step time respectively as 0, 2, 0.1 hours. Hereafter it already possible to build the flowsheet using the blocks and connections. After that you will be something like Fig. 2.

EMSO diagram of simple tanks case [5]

Fig. 2. Flowsheet diagram

Double clicks on blocks in the diagram open the editing properties. For this case you must specify the inlet flowrate and the initial level for the 2 tanks.

Tank source properties [6]EMSO properties of simple tanks case [7]

For “tank_source”, the variable Outlet.F is specified as 10 m3/h. For “tank_1″ and “tank_2″, the variables h are initialized both as 1 m.

Checking the consistency of problem and running the plot results for the outlet tank flowrates will be as shown in Fig. 3.

EMSO results of simple tanks case [8]

Fig. 3. Plot results

Related Posts with Thumbnails [9]

3 Comments (Open | Close)

3 Comments To "Simulating dynamic tanks in EMSO (Part 2)"

#1 Pingback By Introdução ao EMSO #2 – Primeiro Programa | Condição Inicial On March 22, 2011 @ 7:42 pm

[...] 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: ProgramasTags:EMSO, tutorialDeixe seu [...]

#2 Pingback By Simulating dynamic tanks in EMSO (Part 3) | ChENGINEER SPACE On February 1, 2012 @ 3:23 pm

[...] 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 diagram of the process from the [...]

#3 Pingback By Simulating dynamic tanks in EMSO « Engineering.BlogNotions – Thoughts from Industry Experts On February 1, 2012 @ 7:54 pm

[...] 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 diagram of the process from the [...]


Article printed from ChENGINEER SPACE: http://chengineer.com

URL to article: http://chengineer.com/index.php/dynamic-tanks-in-emso-2.html

URLs in this post:

[1] post: http://chengineer.com/index.php/dynamic-tanks-in-emso-1.html

[2] Image: http://chengineer.com/wp-content/uploads/diagram-properties.png

[3] source_icon.png: http://chengineer.com/wp-content/uploads/source_icon.png

[4] tank_icon.png: http://chengineer.com/wp-content/uploads/tank_icon.png

[5] Image: http://chengineer.com/wp-content/uploads/diagram-simple-tanks-case.png

[6] Image: http://chengineer.com/wp-content/uploads/tank-source-properties.png

[7] Image: http://chengineer.com/wp-content/uploads/simple-tank-properties.png

[8] Image: http://chengineer.com/wp-content/uploads/results-simple-tanks-case.png

[9] Image: http://www.linkwithin.com/

Copyright © 2008-2011 ChEngineer Space. All rights reserved.