1 | #*------------------------------------------------------------------- |
---|
2 | * Model of tanks |
---|
3 | *-------------------------------------------------------------------- |
---|
4 | * Streams: |
---|
5 | * * an inlet stream |
---|
6 | * * an outlet stream |
---|
7 | * |
---|
8 | * Specify: |
---|
9 | * * the Inlet stream |
---|
10 | * * the Outlet flow |
---|
11 | * * the tank Q |
---|
12 | * |
---|
13 | * Initial: |
---|
14 | * * the tank temperature (OutletL.T) |
---|
15 | * * the tank level (h) |
---|
16 | * * (NoComps - 1) Outlet compositions |
---|
17 | *---------------------------------------------------------------------- |
---|
18 | * Author: Paula B. Staudt |
---|
19 | * $Id: tank.mso 42 2006-10-26 19:44:05Z paula $ |
---|
20 | *--------------------------------------------------------------------*# |
---|
21 | |
---|
22 | using "streams"; |
---|
23 | |
---|
24 | Model tank |
---|
25 | |
---|
26 | PARAMETERS |
---|
27 | ext PP as CalcObject; |
---|
28 | ext NComp as Integer; |
---|
29 | Across as area (Brief="Tank cross section area", Default=2); |
---|
30 | |
---|
31 | VARIABLES |
---|
32 | in Inlet as stream; |
---|
33 | out Outlet as stream_therm; |
---|
34 | |
---|
35 | in Q as heat_rate (Brief="Rate of heat supply"); |
---|
36 | Level as length(Brief="Tank level"); |
---|
37 | M(NComp) as mol (Brief="Molar Holdup in the tank"); |
---|
38 | E as energy (Brief="Total Energy Holdup on tank"); |
---|
39 | vL as volume_mol (Brief="Liquid Molar Volume"); |
---|
40 | |
---|
41 | EQUATIONS |
---|
42 | "Mass balance" |
---|
43 | diff(M) = Inlet.F*Inlet.z - Outlet.F*Outlet.z; |
---|
44 | |
---|
45 | "Energy balance" |
---|
46 | diff(E) = Inlet.F*Inlet.h - Outlet.F*Outlet.h + Q; |
---|
47 | |
---|
48 | "Energy Holdup" |
---|
49 | E = sum(M)*Outlet.h; |
---|
50 | |
---|
51 | "Mechanical Equilibrium" |
---|
52 | Inlet.P = Outlet.P; |
---|
53 | |
---|
54 | "Liquid Volume" |
---|
55 | vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z); |
---|
56 | |
---|
57 | "Composition" |
---|
58 | M = Outlet.z*sum(M); |
---|
59 | |
---|
60 | "Level of liquid phase" |
---|
61 | Level = sum(M)*vL/Across; |
---|
62 | |
---|
63 | "Vapourisation Fraction" |
---|
64 | Outlet.v = Inlet.v; |
---|
65 | end |
---|
66 | |
---|
67 | Model tank_cylindrical |
---|
68 | |
---|
69 | PARAMETERS |
---|
70 | ext PP as CalcObject; |
---|
71 | ext NComp as Integer; |
---|
72 | radius as length(Brief="Tank radius"); |
---|
73 | L as length(Brief="Tank length"); |
---|
74 | |
---|
75 | VARIABLES |
---|
76 | in Inlet as stream; |
---|
77 | out Outlet as stream_therm; |
---|
78 | |
---|
79 | in Q as heat_rate (Brief="Rate of heat supply"); |
---|
80 | Level as length(Brief="Tank level"); |
---|
81 | Across as area (Brief="Tank cross section area", Default=2); |
---|
82 | M(NComp) as mol (Brief="Molar Holdup in the tank"); |
---|
83 | E as energy (Brief="Total Energy Holdup on tank"); |
---|
84 | vL as volume_mol (Brief="Liquid Molar Volume"); |
---|
85 | |
---|
86 | EQUATIONS |
---|
87 | "Mass balance" |
---|
88 | diff(M) = Inlet.F*Inlet.z - Outlet.F*Outlet.z; |
---|
89 | |
---|
90 | "Energy balance" |
---|
91 | diff(E) = Inlet.F*Inlet.h - Outlet.F*Outlet.h + Q; |
---|
92 | |
---|
93 | "Energy Holdup" |
---|
94 | E = sum(M)*Outlet.h; |
---|
95 | |
---|
96 | "Mechanical Equilibrium" |
---|
97 | Inlet.P = Outlet.P; |
---|
98 | |
---|
99 | "Liquid Volume" |
---|
100 | vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z); |
---|
101 | |
---|
102 | "Composition" |
---|
103 | M = Outlet.z*sum(M); |
---|
104 | |
---|
105 | "Cylindrical Area" |
---|
106 | Across = radius^2 * (asin(1) - asin((radius-Level)/radius) ) + |
---|
107 | (Level-radius)*sqrt(Level*(2*radius - Level)); |
---|
108 | |
---|
109 | "Level of liquid phase" |
---|
110 | Level = sum(M)*vL/Across; |
---|
111 | |
---|
112 | "Vapourisation Fraction" |
---|
113 | Outlet.v = Inlet.v; |
---|
114 | end |
---|
115 | |
---|
116 | Model tank_simplified |
---|
117 | PARAMETERS |
---|
118 | k as Real (Brief="Valve Constant", Unit = "m^2.5/h", Default=4); |
---|
119 | A as area (Brief="Tank area", Default=2); |
---|
120 | |
---|
121 | VARIABLES |
---|
122 | h as length(Brief="Tank level"); |
---|
123 | in Fin as flow_vol(Brief="Input flow"); |
---|
124 | out Fout as flow_vol(Brief="Output flow"); |
---|
125 | |
---|
126 | EQUATIONS |
---|
127 | "Mass balance" |
---|
128 | diff(A*h) = Fin - Fout; |
---|
129 | |
---|
130 | "Valve equation" |
---|
131 | Fout = k*sqrt(h); |
---|
132 | end |
---|