1 | #*--------------------------------------------------------------------- |
---|
2 | * EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC. |
---|
3 | * |
---|
4 | * This LIBRARY is free software; you can distribute it and/or modify |
---|
5 | * it under the therms of the ALSOC FREE LICENSE as available at |
---|
6 | * http://www.enq.ufrgs.br/alsoc. |
---|
7 | * |
---|
8 | * EMSO Copyright (C) 2004 - 2007 ALSOC, original code |
---|
9 | * from http://www.rps.eng.br Copyright (C) 2002-2004. |
---|
10 | * All rights reserved. |
---|
11 | * |
---|
12 | * EMSO is distributed under the therms of the ALSOC LICENSE as |
---|
13 | * available at http://www.enq.ufrgs.br/alsoc. |
---|
14 | * |
---|
15 | *---------------------------------------------------------------------- |
---|
16 | * Model for tank volume calculation |
---|
17 | *---------------------------------------------------------------------- |
---|
18 | * |
---|
19 | * Routine to calculate tank volume and level tank volume from |
---|
20 | * different geometries and orientations. |
---|
21 | * |
---|
22 | * Geometry: |
---|
23 | * * Flat (no head) (default) |
---|
24 | * * Spherical |
---|
25 | * |
---|
26 | * Orientation: |
---|
27 | * * Vertical (default) |
---|
28 | * * Horizontal |
---|
29 | * |
---|
30 | *---------------------------------------------------------------------- |
---|
31 | * Author: Rodolfo Rodrigues |
---|
32 | * $Id$ |
---|
33 | *--------------------------------------------------------------------*# |
---|
34 | |
---|
35 | using "types"; |
---|
36 | |
---|
37 | |
---|
38 | Model vol_tank |
---|
39 | ATTRIBUTES |
---|
40 | Pallete = false; |
---|
41 | Brief = "Routine to calculate tank volume"; |
---|
42 | Info = "Based in 2 geometry and 2 configurations/orientations"; |
---|
43 | |
---|
44 | PARAMETERS |
---|
45 | pi as positive (Brief="Pi value", Default=3.141593); |
---|
46 | Geometry as Switcher (Brief="Tank head type", Valid=["flat","spherical"], Default="flat"); |
---|
47 | Orientation as Switcher(Brief="Tank orientation", Valid=["vertical","horizontal"], Default="vertical"); |
---|
48 | |
---|
49 | VARIABLES |
---|
50 | V as volume (Brief="Level tank volume", DisplayUnit='cm^3'); |
---|
51 | Vt as volume (Brief="Tank volume", DisplayUnit='cm^3'); |
---|
52 | L as length (Brief="Tank length", DisplayUnit='cm'); |
---|
53 | Level as length (Brief="Tank level", DisplayUnit='cm'); |
---|
54 | D as length (Brief="Tank diameter", DisplayUnit='cm'); |
---|
55 | Across as area (Brief="Tank cross section area", DisplayUnit='cm^2'); |
---|
56 | |
---|
57 | EQUATIONS |
---|
58 | "Content volume" |
---|
59 | V = Across*Level; |
---|
60 | |
---|
61 | switch Orientation |
---|
62 | case "vertical": |
---|
63 | switch Geometry |
---|
64 | case "flat": |
---|
65 | "Tank volume" |
---|
66 | Vt = pi*(D^2)*L/4; |
---|
67 | "Level tank volume" |
---|
68 | V = pi*(D^2)*Level/4; |
---|
69 | |
---|
70 | case "spherical": |
---|
71 | "Tank volume" |
---|
72 | Vt = pi*D^3/6; |
---|
73 | "Level tank volume" |
---|
74 | V = pi/3*Level^2*(3*D/2 - Level); |
---|
75 | end |
---|
76 | case "horizontal": |
---|
77 | switch Geometry |
---|
78 | case "flat": |
---|
79 | "Tank volume" |
---|
80 | Vt = pi*(D^2)*L/4; |
---|
81 | "Level tank volume" |
---|
82 | V = ((D^2)*acos((D - 2*Level)/D)/4/"rad" - |
---|
83 | (D - 2*Level)*sqrt(D*Level - Level^2)/2)*L; |
---|
84 | |
---|
85 | case "spherical": |
---|
86 | "Tank volume" |
---|
87 | Vt = pi*D^3/6; |
---|
88 | "Level tank volume" |
---|
89 | V = pi/3*Level^2*(3*D/2 - Level); |
---|
90 | end |
---|
91 | end |
---|
92 | end |
---|