[881] | 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 | * Author: Paula B. Staudt |
---|
| 17 | * $Id: condenser.mso 555 2008-07-18 19:01:13Z rafael $ |
---|
| 18 | *--------------------------------------------------------------------*# |
---|
| 19 | |
---|
| 20 | using "tank"; |
---|
| 21 | |
---|
| 22 | Model condenserSteady |
---|
| 23 | |
---|
| 24 | ATTRIBUTES |
---|
| 25 | Pallete = true; |
---|
| 26 | Icon = "icon/CondenserSteady"; |
---|
| 27 | Brief = "Model of a Steady State condenser with no thermodynamics equilibrium."; |
---|
| 28 | Info = |
---|
| 29 | "== ASSUMPTIONS == |
---|
| 30 | * perfect mixing of both phases; |
---|
| 31 | * no thermodynamics equilibrium. |
---|
| 32 | |
---|
| 33 | == SET == |
---|
| 34 | * the pressure drop in the condenser; |
---|
| 35 | |
---|
| 36 | == SPECIFY == |
---|
| 37 | * the InletVapour stream; |
---|
| 38 | * the InletQ (the model requires an energy stream, also you can use a controller for setting the heat duty using the heat_flow model). |
---|
| 39 | |
---|
| 40 | == OPTIONAL == |
---|
| 41 | * the condenser model has two control ports |
---|
| 42 | ** TI OutletLiquid Temperature Indicator; |
---|
| 43 | ** PI OutletLiquid Pressure Indicator; |
---|
| 44 | "; |
---|
| 45 | |
---|
| 46 | PARAMETERS |
---|
| 47 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
| 48 | outer NComp as Integer (Brief = "Number of Components"); |
---|
| 49 | |
---|
| 50 | Pdrop as press_delta (Brief="Pressure Drop in the condenser",Default=0, Symbol="\Delta _P"); |
---|
| 51 | |
---|
| 52 | VARIABLES |
---|
| 53 | in InletVapour as stream (Brief="Vapour inlet stream", PosX=0.16, PosY=0, Symbol="_{in}^{Vapour}"); |
---|
| 54 | out OutletLiquid as liquid_stream (Brief="Liquid outlet stream", PosX=0.53, PosY=1, Symbol="_{out}^{Liquid}"); |
---|
| 55 | in InletQ as power (Brief="Heat Duty", PosX=1, PosY=0.08, Symbol="Q_{in}",Protected=true); |
---|
| 56 | |
---|
| 57 | Tbubble as temperature (Brief ="Bubble Temperature",Protected=true, Symbol ="T_{bubble}"); |
---|
| 58 | Deg_Subcooled as temp_delta (Brief ="Degrees subcooled",Symbol ="\Delta T_{subcooled}"); |
---|
| 59 | |
---|
| 60 | out TI as control_signal (Brief="Temperature Indicator of Condenser", Protected = true, PosX=0.50, PosY=0); |
---|
| 61 | out PI as control_signal (Brief="Pressure Indicator of Condenser", Protected = true, PosX=0.32, PosY=0); |
---|
| 62 | |
---|
| 63 | EQUATIONS |
---|
| 64 | |
---|
| 65 | "Molar Flow Balance" |
---|
| 66 | InletVapour.F = OutletLiquid.F; |
---|
| 67 | |
---|
| 68 | "Molar Composition Balance" |
---|
| 69 | InletVapour.z = OutletLiquid.z; |
---|
| 70 | |
---|
| 71 | "Energy Balance" |
---|
| 72 | InletVapour.F*InletVapour.h + InletQ = OutletLiquid.F*OutletLiquid.h; |
---|
| 73 | |
---|
| 74 | "Pressure Drop" |
---|
| 75 | OutletLiquid.P = InletVapour.P - Pdrop; |
---|
| 76 | |
---|
| 77 | "Bubble Temperature" |
---|
| 78 | Tbubble = PP.BubbleT(OutletLiquid.P,OutletLiquid.z); |
---|
| 79 | |
---|
| 80 | "Temperature" |
---|
| 81 | OutletLiquid.T = Tbubble-Deg_Subcooled; |
---|
| 82 | |
---|
| 83 | "Temperature indicator" |
---|
| 84 | TI * 'K' = OutletLiquid.T; |
---|
| 85 | |
---|
| 86 | "Pressure indicator" |
---|
| 87 | PI * 'atm' = OutletLiquid.P; |
---|
| 88 | |
---|
| 89 | end |
---|
| 90 | |
---|
| 91 | Model condenserSteady_fakeH |
---|
| 92 | |
---|
| 93 | ATTRIBUTES |
---|
| 94 | Pallete = true; |
---|
| 95 | Icon = "icon/CondenserSteady"; |
---|
| 96 | Brief = "Model of a Steady State condenser with fake calculation of outlet conditions."; |
---|
| 97 | Info = |
---|
| 98 | "Model of a Steady State condenser with fake calculation of output temperature, but with a real |
---|
| 99 | calculation of the output stream enthalpy. |
---|
| 100 | |
---|
| 101 | == ASSUMPTIONS == |
---|
| 102 | * perfect mixing of both phases; |
---|
| 103 | * no thermodynamics equilibrium. |
---|
| 104 | |
---|
| 105 | == SET == |
---|
| 106 | * the fake Outlet temperature ; |
---|
| 107 | * the pressure drop in the condenser; |
---|
| 108 | |
---|
| 109 | == SPECIFY == |
---|
| 110 | * the InletVapour stream; |
---|
| 111 | * the InletQ (the model requires an energy stream, also you can use a controller for setting the heat duty using the heat_flow model). |
---|
| 112 | |
---|
| 113 | == OPTIONAL == |
---|
| 114 | * the condenser model has two control ports |
---|
| 115 | ** TI OutletLiquid Temperature Indicator; |
---|
| 116 | ** PI OutletLiquid Pressure Indicator; |
---|
| 117 | "; |
---|
| 118 | |
---|
| 119 | PARAMETERS |
---|
| 120 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
| 121 | outer NComp as Integer (Brief = "Number of Components"); |
---|
| 122 | |
---|
| 123 | Pdrop as press_delta (Brief="Pressure Drop in the condenser",Default=0, Symbol="\Delta _P"); |
---|
| 124 | Fake_Temperature as temperature (Brief="Fake temperature", Symbol = "T_{fake}"); |
---|
| 125 | |
---|
| 126 | |
---|
| 127 | VARIABLES |
---|
| 128 | in InletVapour as stream (Brief="Vapour inlet stream", PosX=0.16, PosY=0, Symbol="_{in}^{Vapour}"); |
---|
| 129 | out OutletLiquid as stream (Brief="Liquid outlet stream", PosX=0.53, PosY=1, Symbol="_{out}^{Liquid}"); |
---|
| 130 | in InletQ as power (Brief="Heat Duty", PosX=1, PosY=0.08, Symbol="Q_{in}",Protected=true); |
---|
| 131 | |
---|
| 132 | out TI as control_signal (Brief="Temperature Indicator of Condenser", Protected = true, PosX=0.50, PosY=0); |
---|
| 133 | out PI as control_signal (Brief="Pressure Indicator of Condenser", Protected = true, PosX=0.32, PosY=0); |
---|
| 134 | |
---|
| 135 | EQUATIONS |
---|
| 136 | |
---|
| 137 | "Molar Flow Balance" |
---|
| 138 | InletVapour.F = OutletLiquid.F; |
---|
| 139 | |
---|
| 140 | "Molar Composition Balance" |
---|
| 141 | InletVapour.z = OutletLiquid.z; |
---|
| 142 | |
---|
| 143 | "Energy Balance" |
---|
| 144 | InletVapour.F*InletVapour.h + InletQ = OutletLiquid.F*OutletLiquid.h; |
---|
| 145 | |
---|
| 146 | "Pressure Drop" |
---|
| 147 | OutletLiquid.P = InletVapour.P - Pdrop; |
---|
| 148 | |
---|
| 149 | "Fake Temperature" |
---|
| 150 | OutletLiquid.T = Fake_Temperature; |
---|
| 151 | |
---|
| 152 | "Vapourisation Fraction" |
---|
| 153 | OutletLiquid.v = 0; |
---|
| 154 | |
---|
| 155 | "Temperature indicator" |
---|
| 156 | TI * 'K' = OutletLiquid.T; |
---|
| 157 | |
---|
| 158 | "Pressure indicator" |
---|
| 159 | PI * 'atm' = OutletLiquid.P; |
---|
| 160 | |
---|
| 161 | end |
---|
| 162 | |
---|
| 163 | Model condenserReact |
---|
| 164 | ATTRIBUTES |
---|
| 165 | Pallete = false; |
---|
| 166 | Icon = "icon/Condenser"; |
---|
| 167 | Brief = "Model of a Condenser with reaction in liquid phase."; |
---|
| 168 | Info = |
---|
| 169 | "== Assumptions == |
---|
| 170 | * perfect mixing of both phases; |
---|
| 171 | * thermodynamics equilibrium; |
---|
| 172 | * the reaction only takes place in liquid phase. |
---|
| 173 | |
---|
| 174 | == Specify == |
---|
| 175 | * the reaction related variables; |
---|
| 176 | * the inlet stream; |
---|
| 177 | * the outlet flows: OutletVapour.F and OutletLiquid.F; |
---|
| 178 | * the heat supply. |
---|
| 179 | |
---|
| 180 | == Initial Conditions == |
---|
| 181 | * the condenser temperature (OutletLiquid.T); |
---|
| 182 | * the condenser liquid level (Level); |
---|
| 183 | * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions. |
---|
| 184 | "; |
---|
| 185 | |
---|
| 186 | PARAMETERS |
---|
| 187 | outer PP as Plugin(Type="PP"); |
---|
| 188 | outer NComp as Integer; |
---|
| 189 | |
---|
| 190 | V as volume (Brief="Condenser total volume"); |
---|
| 191 | Across as area (Brief="Cross Section Area of reboiler"); |
---|
| 192 | |
---|
| 193 | stoic(NComp) as Real (Brief="Stoichiometric matrix"); |
---|
| 194 | Hr as energy_mol; |
---|
| 195 | Initial_Level as length (Brief="Initial Level of liquid phase"); |
---|
| 196 | Initial_Temperature as temperature (Brief="Initial Temperature of Condenser"); |
---|
| 197 | Initial_Composition(NComp) as fraction (Brief="Initial Liquid Composition"); |
---|
| 198 | |
---|
| 199 | VARIABLES |
---|
| 200 | |
---|
| 201 | in InletVapour as stream (Brief="Vapour inlet stream", PosX=0.1164, PosY=0, Symbol="_{inV}"); |
---|
| 202 | out OutletLiquid as liquid_stream (Brief="Liquid outlet stream", PosX=0.4513, PosY=1, Symbol="_{outL}"); |
---|
| 203 | out OutletVapour as vapour_stream (Brief="Vapour outlet stream", PosX=0.4723, PosY=0, Symbol="_{outV}"); |
---|
| 204 | InletQ as power (Brief="Cold supplied", PosX=1, PosY=0.6311, Symbol="_{in}"); |
---|
| 205 | |
---|
| 206 | M(NComp) as mol (Brief="Molar Holdup in the tray"); |
---|
| 207 | ML as mol (Brief="Molar liquid holdup"); |
---|
| 208 | MV as mol (Brief="Molar vapour holdup"); |
---|
| 209 | E as energy (Brief="Total Energy Holdup on tray"); |
---|
| 210 | vL as volume_mol (Brief="Liquid Molar Volume"); |
---|
| 211 | vV as volume_mol (Brief="Vapour Molar volume"); |
---|
| 212 | Level as length (Brief="Level of liquid phase"); |
---|
| 213 | Vol as volume; |
---|
| 214 | r3 as reaction_mol (Brief="Reaction Rates", DisplayUnit = 'mol/l/s'); |
---|
| 215 | C(NComp) as conc_mol (Brief="Molar concentration", Lower = -1); |
---|
| 216 | |
---|
| 217 | INITIAL |
---|
| 218 | |
---|
| 219 | Level = Initial_Level; |
---|
| 220 | OutletLiquid.T = Initial_Temperature; |
---|
| 221 | OutletLiquid.z(1:NComp-1) = Initial_Composition(1:NComp-1)/sum(Initial_Composition); |
---|
| 222 | |
---|
| 223 | EQUATIONS |
---|
| 224 | "Molar Concentration" |
---|
| 225 | OutletLiquid.z = vL * C; |
---|
| 226 | |
---|
| 227 | "Reaction" |
---|
| 228 | r3 = exp(-7150*'K'/OutletLiquid.T)*(4.85e4*C(1)*C(2) - 1.23e4*C(3)*C(4)) * 'l/mol/s'; |
---|
| 229 | |
---|
| 230 | "Component Molar Balance" |
---|
| 231 | diff(M) = InletVapour.F*InletVapour.z - OutletLiquid.F*OutletLiquid.z - OutletVapour.F*OutletVapour.z + stoic*r3*ML*vL; |
---|
| 232 | |
---|
| 233 | "Energy Balance" |
---|
| 234 | diff(E) = InletVapour.F*InletVapour.h - OutletLiquid.F*OutletLiquid.h- OutletVapour.F*OutletVapour.h + InletQ + Hr * r3 * ML*vL; |
---|
| 235 | |
---|
| 236 | "Molar Holdup" |
---|
| 237 | M = ML*OutletLiquid.z + MV*OutletVapour.z; |
---|
| 238 | |
---|
| 239 | "Energy Holdup" |
---|
| 240 | E = ML*OutletLiquid.h + MV*OutletVapour.h - OutletVapour.P*V; |
---|
| 241 | |
---|
| 242 | "Mol fraction normalisation" |
---|
| 243 | sum(OutletLiquid.z)=1.0; |
---|
| 244 | |
---|
| 245 | "Liquid Volume" |
---|
| 246 | vL = PP.LiquidVolume(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z); |
---|
| 247 | |
---|
| 248 | "Vapour Volume" |
---|
| 249 | vV = PP.VapourVolume(OutletVapour.T, OutletVapour.P, OutletVapour.z); |
---|
| 250 | |
---|
| 251 | "Thermal Equilibrium" |
---|
| 252 | OutletLiquid.T = OutletVapour.T; |
---|
| 253 | |
---|
| 254 | "Mechanical Equilibrium" |
---|
| 255 | OutletVapour.P = OutletLiquid.P; |
---|
| 256 | |
---|
| 257 | "Geometry Constraint" |
---|
| 258 | V = ML*vL + MV*vV; |
---|
| 259 | |
---|
| 260 | Vol = ML*vL; |
---|
| 261 | |
---|
| 262 | "Level of liquid phase" |
---|
| 263 | Level = ML*vL/Across; |
---|
| 264 | |
---|
| 265 | "Chemical Equilibrium" |
---|
| 266 | PP.LiquidFugacityCoefficient(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z)*OutletLiquid.z = |
---|
| 267 | PP.VapourFugacityCoefficient(OutletVapour.T, OutletVapour.P, OutletVapour.z)*OutletVapour.z; |
---|
| 268 | |
---|
| 269 | sum(OutletLiquid.z)=sum(OutletVapour.z); |
---|
| 270 | |
---|
| 271 | end |
---|
| 272 | |
---|
| 273 | Model condenser |
---|
| 274 | |
---|
| 275 | ATTRIBUTES |
---|
| 276 | Pallete = true; |
---|
| 277 | Icon = "icon/Condenser"; |
---|
| 278 | Brief = "Model of a dynamic condenser with control."; |
---|
| 279 | Info = |
---|
| 280 | "== ASSUMPTIONS == |
---|
| 281 | * perfect mixing of both phases; |
---|
| 282 | * thermodynamics equilibrium. |
---|
| 283 | |
---|
| 284 | == SPECIFY == |
---|
| 285 | * the InletVapour stream; |
---|
| 286 | * the outlet flows: OutletVapour.F and OutletLiquid.F; |
---|
| 287 | * the InletQ (the model requires an energy stream, also you can use a controller for setting the heat duty using the heat_flow model). |
---|
| 288 | |
---|
| 289 | == OPTIONAL == |
---|
| 290 | * the condenser model has three control ports |
---|
| 291 | ** TI OutletLiquid Temperature Indicator; |
---|
| 292 | ** PI OutletLiquid Pressure Indicator; |
---|
| 293 | ** LI Level Indicator of Condenser; |
---|
| 294 | |
---|
| 295 | == INITIAL CONDITIONS == |
---|
| 296 | * Initial_Temperature : the condenser temperature (OutletLiquid.T); |
---|
| 297 | * Levelpercent_Initial : the condenser liquid level in percent (LI); |
---|
| 298 | * Initial_Composition : (NoComps) OutletLiquid compositions. |
---|
| 299 | "; |
---|
| 300 | |
---|
| 301 | PARAMETERS |
---|
| 302 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
| 303 | outer NComp as Integer (Brief="Number of Components"); |
---|
| 304 | |
---|
| 305 | Mw(NComp) as molweight (Brief = "Component Mol Weight",Hidden=true); |
---|
| 306 | low_flow as flow_mol (Brief = "Low Flow",Default = 1E-6, Hidden=true); |
---|
| 307 | zero_flow as flow_mol (Brief = "No Flow",Default = 0, Hidden=true); |
---|
| 308 | |
---|
| 309 | VapourFlow as Switcher (Brief="Vapour Flow", Valid = ["on", "off"], Default = "on",Hidden=true); |
---|
| 310 | |
---|
| 311 | Kfactor as positive (Brief="K factor for pressure drop", Lower = 1E-8, Default = 1E-3); |
---|
| 312 | |
---|
| 313 | Levelpercent_Initial as positive (Brief="Initial liquid height in Percent", Default = 0.70); |
---|
| 314 | Initial_Temperature as temperature (Brief="Initial Temperature of Condenser"); |
---|
| 315 | Initial_Composition(NComp) as positive (Brief="Initial Liquid Composition", Lower=1E-6); |
---|
| 316 | |
---|
| 317 | VARIABLES |
---|
| 318 | |
---|
| 319 | Geometry as VesselVolume (Brief="Vessel Geometry", Symbol=" "); |
---|
| 320 | |
---|
| 321 | in InletVapour as stream (Brief="Vapour inlet stream", PosX=0.13, PosY=0, Symbol="_{in}^{Vapour}"); |
---|
| 322 | out OutletLiquid as liquid_stream (Brief="Liquid outlet stream", PosX=0.35, PosY=1, Symbol="_{out}^{Liquid}"); |
---|
| 323 | out OutletVapour as vapour_stream (Brief="Vapour outlet stream", PosX=0.54, PosY=0, Symbol="_{out}^{Vapour}"); |
---|
| 324 | in InletQ as power (Brief="Heat supplied", Protected = true, PosX=1, PosY=0.08, Symbol="Q_{in}"); |
---|
| 325 | |
---|
| 326 | out TI as control_signal (Brief="Temperature Indicator of Condenser", Protected = true, PosX=0.33, PosY=0); |
---|
| 327 | out LI as control_signal (Brief="Level Indicator of Condenser", Protected = true, PosX=0.43, PosY=0); |
---|
| 328 | out PI as control_signal (Brief="Pressure Indicator of Condenser", Protected = true, PosX=0.25, PosY=0); |
---|
| 329 | |
---|
| 330 | M(NComp) as mol (Brief="Molar Holdup in the tray", Protected = true); |
---|
| 331 | ML as mol (Brief="Molar liquid holdup", Protected = true); |
---|
| 332 | MV as mol (Brief="Molar vapour holdup", Protected = true); |
---|
| 333 | E as energy (Brief="Total Energy Holdup on tray", Protected = true); |
---|
| 334 | vL as volume_mol (Brief="Liquid Molar Volume", Protected = true); |
---|
| 335 | vV as volume_mol (Brief="Vapour Molar volume", Protected = true); |
---|
| 336 | rho as dens_mass (Brief ="Inlet Vapour Mass Density",Hidden=true, Symbol ="\rho"); |
---|
| 337 | Pdrop as press_delta (Brief = "Pressure Drop", DisplayUnit = 'kPa', Symbol ="\Delta P", Protected=true); |
---|
| 338 | |
---|
| 339 | SET |
---|
| 340 | Mw = PP.MolecularWeight(); |
---|
| 341 | low_flow = 1E-6 * 'kmol/h'; |
---|
| 342 | zero_flow = 0 * 'kmol/h'; |
---|
| 343 | |
---|
| 344 | INITIAL |
---|
| 345 | |
---|
| 346 | "Initial level Percent" |
---|
| 347 | LI = Levelpercent_Initial; |
---|
| 348 | |
---|
| 349 | "Initial Temperature" |
---|
| 350 | OutletLiquid.T = Initial_Temperature; |
---|
| 351 | |
---|
| 352 | "Initial Composition" |
---|
| 353 | OutletLiquid.z(1:NComp-1) = Initial_Composition(1:NComp-1)/sum(Initial_Composition); |
---|
| 354 | |
---|
| 355 | EQUATIONS |
---|
| 356 | |
---|
| 357 | switch VapourFlow |
---|
| 358 | |
---|
| 359 | case "on": |
---|
[929] | 360 | InletVapour.F*vV = Kfactor *sqrt(Pdrop/rho)*'m^2'; |
---|
[881] | 361 | |
---|
| 362 | when InletVapour.F < low_flow switchto "off"; |
---|
| 363 | |
---|
| 364 | case "off": |
---|
| 365 | InletVapour.F = zero_flow; |
---|
| 366 | |
---|
| 367 | when InletVapour.P > OutletLiquid.P switchto "on"; |
---|
| 368 | |
---|
| 369 | end |
---|
| 370 | |
---|
| 371 | "Component Molar Balance" |
---|
| 372 | diff(M) = InletVapour.F*InletVapour.z - OutletLiquid.F*OutletLiquid.z- OutletVapour.F*OutletVapour.z; |
---|
| 373 | |
---|
| 374 | "Energy Balance" |
---|
| 375 | diff(E) = InletVapour.F*InletVapour.h - OutletLiquid.F*OutletLiquid.h- OutletVapour.F*OutletVapour.h + InletQ; |
---|
| 376 | |
---|
| 377 | "Molar Holdup" |
---|
| 378 | M = ML*OutletLiquid.z + MV*OutletVapour.z; |
---|
| 379 | |
---|
| 380 | "Energy Holdup" |
---|
| 381 | E = ML*OutletLiquid.h + MV*OutletVapour.h - OutletVapour.P*Geometry.Vtotal; |
---|
| 382 | |
---|
| 383 | "Mol fraction normalisation" |
---|
| 384 | sum(OutletLiquid.z)=1.0; |
---|
| 385 | |
---|
| 386 | "Mol fraction Constraint" |
---|
| 387 | sum(OutletLiquid.z)=sum(OutletVapour.z); |
---|
| 388 | |
---|
| 389 | "Liquid Volume" |
---|
| 390 | vL = PP.LiquidVolume(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z); |
---|
| 391 | |
---|
| 392 | "Vapour Volume" |
---|
| 393 | vV = PP.VapourVolume(OutletVapour.T, OutletVapour.P, OutletVapour.z); |
---|
| 394 | |
---|
| 395 | "Inlet Vapour Density" |
---|
| 396 | rho = PP.VapourDensity(InletVapour.T, InletVapour.P, InletVapour.z); |
---|
| 397 | |
---|
| 398 | "Chemical Equilibrium" |
---|
| 399 | PP.LiquidFugacityCoefficient(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z)*OutletLiquid.z = |
---|
| 400 | PP.VapourFugacityCoefficient(OutletVapour.T, OutletVapour.P, OutletVapour.z)*OutletVapour.z; |
---|
| 401 | |
---|
| 402 | "Thermal Equilibrium" |
---|
| 403 | OutletLiquid.T = OutletVapour.T; |
---|
| 404 | |
---|
| 405 | "Mechanical Equilibrium" |
---|
| 406 | OutletVapour.P = OutletLiquid.P; |
---|
| 407 | |
---|
| 408 | "Pressure Drop" |
---|
| 409 | OutletLiquid.P = InletVapour.P - Pdrop; |
---|
| 410 | |
---|
| 411 | "Geometry Constraint" |
---|
| 412 | Geometry.Vtotal = ML*vL + MV*vV; |
---|
| 413 | |
---|
| 414 | "Liquid Level" |
---|
| 415 | ML * vL = Geometry.Vfilled; |
---|
| 416 | |
---|
| 417 | "Temperature indicator" |
---|
| 418 | TI * 'K' = OutletLiquid.T; |
---|
| 419 | |
---|
| 420 | "Pressure indicator" |
---|
| 421 | PI * 'atm' = OutletLiquid.P; |
---|
| 422 | |
---|
| 423 | "Level indicator" |
---|
| 424 | LI*Geometry.Vtotal= Geometry.Vfilled; |
---|
| 425 | |
---|
| 426 | end |
---|
| 427 | |
---|
| 428 | |
---|
[930] | 429 | Model condenser2 |
---|
| 430 | |
---|
| 431 | ATTRIBUTES |
---|
| 432 | Pallete = true; |
---|
| 433 | Icon = "icon/Condenser"; |
---|
| 434 | Brief = "Model of a dynamic condenser with control."; |
---|
| 435 | Info = |
---|
| 436 | "== ASSUMPTIONS == |
---|
| 437 | * perfect mixing of both phases; |
---|
| 438 | * thermodynamics equilibrium. |
---|
| 439 | |
---|
| 440 | == SPECIFY == |
---|
| 441 | * the InletVapour stream; |
---|
| 442 | * the outlet flows: Product.F and Reflux.F; |
---|
| 443 | * the InletQ (the model requires an energy stream, also you can use a controller for setting the heat duty using the heat_flow model). |
---|
| 444 | |
---|
| 445 | == OPTIONAL == |
---|
| 446 | * the condenser model has three control ports |
---|
| 447 | ** TI OutletLiquid Temperature Indicator; |
---|
| 448 | ** PI OutletLiquid Pressure Indicator; |
---|
| 449 | ** LI Level Indicator of Condenser; |
---|
| 450 | |
---|
| 451 | == INITIAL CONDITIONS == |
---|
| 452 | * Initial_Temperature : the condenser temperature (OutletLiquid.T); |
---|
| 453 | * Levelpercent_Initial : the condenser liquid level in percent (LI); |
---|
| 454 | * Initial_Composition : (NoComps) OutletLiquid compositions. |
---|
| 455 | "; |
---|
| 456 | |
---|
| 457 | PARAMETERS |
---|
| 458 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
| 459 | outer NComp as Integer (Brief="Number of Components"); |
---|
| 460 | |
---|
| 461 | Mw(NComp) as molweight (Brief = "Component Mol Weight",Hidden=true); |
---|
| 462 | low_flow as flow_mol (Brief = "Low Flow",Default = 1E-6, Hidden=true); |
---|
| 463 | zero_flow as flow_mol (Brief = "No Flow",Default = 0, Hidden=true); |
---|
| 464 | |
---|
| 465 | CondenserType as Switcher (Brief="Condenser type", Valid = ["partial", "total"], Default = "partial"); |
---|
| 466 | VapourFlow as Switcher (Brief="Vapour Flow", Valid = ["on", "off"], Default = "on",Hidden=true); |
---|
| 467 | |
---|
| 468 | Kfactor as positive (Brief="K factor for pressure drop", Lower = 1E-8, Default = 1E-3); |
---|
| 469 | |
---|
| 470 | Levelpercent_Initial as positive (Brief="Initial liquid height in Percent", Default = 0.70); |
---|
| 471 | Initial_Temperature as temperature (Brief="Initial Temperature of Condenser"); |
---|
| 472 | Initial_Composition(NComp) as positive (Brief="Initial Liquid Composition", Lower=1E-6); |
---|
| 473 | |
---|
| 474 | VARIABLES |
---|
| 475 | |
---|
| 476 | Geometry as VesselVolume (Brief="Vessel Geometry", Symbol=" "); |
---|
| 477 | |
---|
| 478 | in InletVapour as stream (Brief="Vapour inlet stream", PosX=0.13, PosY=0, Symbol="_{in}^{Vapour}"); |
---|
| 479 | out OutletLiquid as liquid_stream (Brief="Liquid outlet stream", PosX=0.35, PosY=1, Symbol="_{out}^{Liquid}"); |
---|
| 480 | Vapour as vapour_stream (Brief="Vapour outlet stream", Hidden=true, Symbol="_{out}^{Vapour}"); |
---|
| 481 | out Product as stream (Brief="Vapour or Liquid product stream", PosX=0.54, PosY=0, Symbol="_{out}^{Vapour}"); |
---|
| 482 | in InletQ as power (Brief="Heat supplied", Protected = true, PosX=1, PosY=0.08, Symbol="Q_{in}"); |
---|
| 483 | |
---|
| 484 | RefluxRatio as positive (Brief = "Reflux Ratio", Default=10, Lower = 0.05); |
---|
| 485 | |
---|
| 486 | out TI as control_signal (Brief="Temperature Indicator of Condenser", Protected = true, PosX=0.33, PosY=0); |
---|
| 487 | out LI as control_signal (Brief="Level Indicator of Condenser", Protected = true, PosX=0.43, PosY=0); |
---|
| 488 | out PI as control_signal (Brief="Pressure Indicator of Condenser", Protected = true, PosX=0.25, PosY=0); |
---|
| 489 | |
---|
| 490 | M(NComp) as mol (Brief="Molar Holdup in the tray", Protected = true); |
---|
| 491 | ML as mol (Brief="Molar liquid holdup", Protected = true); |
---|
| 492 | MV as mol (Brief="Molar vapour holdup", Protected = true); |
---|
| 493 | E as energy (Brief="Total Energy Holdup on tray", Protected = true); |
---|
| 494 | vL as volume_mol (Brief="Liquid Molar Volume", Protected = true); |
---|
| 495 | vV as volume_mol (Brief="Vapour Molar volume", Protected = true); |
---|
| 496 | rho as dens_mass (Brief ="Inlet Vapour Mass Density",Hidden=true, Symbol ="\rho"); |
---|
| 497 | Pdrop as press_delta (Brief = "Pressure Drop", DisplayUnit = 'kPa', Symbol ="\Delta P", Protected=true); |
---|
| 498 | |
---|
| 499 | SET |
---|
| 500 | Mw = PP.MolecularWeight(); |
---|
| 501 | low_flow = 1E-6 * 'kmol/h'; |
---|
| 502 | zero_flow = 0 * 'kmol/h'; |
---|
| 503 | |
---|
| 504 | INITIAL |
---|
| 505 | |
---|
| 506 | "Initial level Percent" |
---|
| 507 | LI = Levelpercent_Initial; |
---|
| 508 | |
---|
| 509 | "Initial Temperature" |
---|
| 510 | OutletLiquid.T = Initial_Temperature; |
---|
| 511 | |
---|
| 512 | "Initial Composition" |
---|
| 513 | OutletLiquid.z(1:NComp-1) = Initial_Composition(1:NComp-1)/sum(Initial_Composition); |
---|
| 514 | |
---|
| 515 | EQUATIONS |
---|
| 516 | |
---|
| 517 | |
---|
| 518 | Vapour.F = zero_flow; |
---|
| 519 | "Reflux ratio" |
---|
| 520 | RefluxRatio*Product.F = OutletLiquid.F; |
---|
| 521 | |
---|
| 522 | switch CondenserType |
---|
| 523 | |
---|
| 524 | case "partial": |
---|
| 525 | Product.v = Vapour.v; |
---|
| 526 | Product.h = Vapour.h; |
---|
| 527 | Product.z = Vapour.z; |
---|
| 528 | |
---|
| 529 | case "total": |
---|
| 530 | Product.v = OutletLiquid.v; |
---|
| 531 | Product.h = OutletLiquid.h; |
---|
| 532 | Product.z = OutletLiquid.z; |
---|
| 533 | end |
---|
| 534 | |
---|
| 535 | |
---|
| 536 | switch VapourFlow |
---|
| 537 | |
---|
| 538 | case "on": |
---|
| 539 | InletVapour.F*vV = Kfactor *sqrt(Pdrop/rho)*'m^2'; |
---|
| 540 | |
---|
| 541 | when InletVapour.F < low_flow switchto "off"; |
---|
| 542 | |
---|
| 543 | case "off": |
---|
| 544 | InletVapour.F = zero_flow; |
---|
| 545 | |
---|
| 546 | when InletVapour.P > OutletLiquid.P switchto "on"; |
---|
| 547 | |
---|
| 548 | end |
---|
| 549 | |
---|
| 550 | "Component Molar Balance" |
---|
| 551 | diff(M) = InletVapour.F*InletVapour.z - OutletLiquid.F*OutletLiquid.z- Product.F*Product.z; |
---|
| 552 | |
---|
| 553 | "Energy Balance" |
---|
| 554 | diff(E) = InletVapour.F*InletVapour.h - OutletLiquid.F*OutletLiquid.h- Product.F*Product.h + InletQ; |
---|
| 555 | |
---|
| 556 | "Molar Holdup" |
---|
| 557 | M = ML*OutletLiquid.z + MV*Vapour.z; |
---|
| 558 | |
---|
| 559 | "Energy Holdup" |
---|
| 560 | E = ML*OutletLiquid.h + MV*Vapour.h - Vapour.P*Geometry.Vtotal; |
---|
| 561 | |
---|
| 562 | "Mol fraction normalisation" |
---|
| 563 | sum(OutletLiquid.z)=1.0; |
---|
| 564 | |
---|
| 565 | "Mol fraction Constraint" |
---|
| 566 | sum(OutletLiquid.z)=sum(Vapour.z); |
---|
| 567 | |
---|
| 568 | "Liquid Volume" |
---|
| 569 | vL = PP.LiquidVolume(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z); |
---|
| 570 | |
---|
| 571 | "Vapour Volume" |
---|
| 572 | vV = PP.VapourVolume(Vapour.T, Vapour.P, Vapour.z); |
---|
| 573 | |
---|
| 574 | "Inlet Vapour Density" |
---|
| 575 | rho = PP.VapourDensity(InletVapour.T, InletVapour.P, InletVapour.z); |
---|
| 576 | |
---|
| 577 | "Chemical Equilibrium" |
---|
| 578 | PP.LiquidFugacityCoefficient(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z)*OutletLiquid.z = |
---|
| 579 | PP.VapourFugacityCoefficient(Vapour.T, Vapour.P, Vapour.z)*Vapour.z; |
---|
| 580 | |
---|
| 581 | "Thermal Equilibrium" |
---|
| 582 | OutletLiquid.T = Vapour.T; |
---|
| 583 | OutletLiquid.T = Product.T; |
---|
| 584 | |
---|
| 585 | "Mechanical Equilibrium" |
---|
| 586 | Vapour.P = OutletLiquid.P; |
---|
| 587 | Vapour.P = Product.P; |
---|
| 588 | |
---|
| 589 | "Pressure Drop" |
---|
| 590 | OutletLiquid.P = InletVapour.P - Pdrop; |
---|
| 591 | |
---|
| 592 | "Geometry Constraint" |
---|
| 593 | Geometry.Vtotal = ML*vL + MV*vV; |
---|
| 594 | |
---|
| 595 | "Liquid Level" |
---|
| 596 | ML * vL = Geometry.Vfilled; |
---|
| 597 | |
---|
| 598 | "Temperature indicator" |
---|
| 599 | TI * 'K' = OutletLiquid.T; |
---|
| 600 | |
---|
| 601 | "Pressure indicator" |
---|
| 602 | PI * 'atm' = OutletLiquid.P; |
---|
| 603 | |
---|
| 604 | "Level indicator" |
---|
| 605 | LI*Geometry.Vtotal= Geometry.Vfilled; |
---|
| 606 | |
---|
| 607 | end |
---|
| 608 | |
---|
| 609 | |
---|
[881] | 610 | Model condenserSubcooled |
---|
| 611 | |
---|
| 612 | ATTRIBUTES |
---|
| 613 | Pallete = true; |
---|
| 614 | Icon = "icon/CondenserSteady"; |
---|
[900] | 615 | Brief = "Model of a Steady State total condenser with specified outlet temperature conditions."; |
---|
[881] | 616 | Info = |
---|
[899] | 617 | "A simple model of a Steady State total condenser with specified temperature (or subcooling degree), with a real |
---|
[900] | 618 | calculation of the output stream enthalpy. The subcooling degree is considered to be the difference between the |
---|
| 619 | inlet vapour and the outlet liquid temperatures. |
---|
[881] | 620 | |
---|
| 621 | == ASSUMPTIONS == |
---|
| 622 | * perfect mixing of both phases; |
---|
[899] | 623 | * saturated vapour at the Inlet; |
---|
| 624 | * no thermodynamics equilibrium; |
---|
| 625 | * no pressure drop in the condenser. |
---|
[881] | 626 | |
---|
| 627 | == SPECIFY == |
---|
| 628 | * the InletVapour stream; |
---|
| 629 | * the subcooled temperature OR the the degree of subcooling. |
---|
| 630 | |
---|
| 631 | "; |
---|
| 632 | |
---|
| 633 | PARAMETERS |
---|
[893] | 634 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
| 635 | outer NComp as Integer (Brief = "Number of Components"); |
---|
| 636 | |
---|
[899] | 637 | # Pdrop as press_delta (Brief="Pressure Drop in the condenser",Default=0, Symbol="\Delta _P"); |
---|
[893] | 638 | #Fake_Temperature as temperature (Brief="Fake temperature", Symbol = "T_{fake}"); |
---|
| 639 | |
---|
| 640 | |
---|
| 641 | VARIABLES |
---|
| 642 | in InletVapour as stream (Brief="Vapour inlet stream", PosX=0.16, PosY=0, Symbol="_{in}^{Vapour}"); |
---|
| 643 | out OutletLiquid as stream (Brief="Liquid outlet stream", PosX=0.53, PosY=1, Symbol="_{out}^{Liquid}"); |
---|
| 644 | #in InletQ as power (Brief="Heat Duty", PosX=1, PosY=0.08, Symbol="Q_{in}",Protected=true); |
---|
| 645 | T_sub as temperature (Brief="Condensate temperature (subcooled)", Symbol = "T_{sub}"); |
---|
[900] | 646 | SubcoolingDegree as temp_delta (Brief="Subcooling Degree", Symbol = "\Delta T_{sub}"); |
---|
[893] | 647 | CondenserDuty as power (Brief="Calculated condenser duty for desired subcooling", Protected = true, Symbol = "Q_{cond}"); |
---|
| 648 | |
---|
[899] | 649 | #out TI as control_signal (Brief="Temperature Indicator of Condenser", Protected = true, PosX=0.50, PosY=0); |
---|
| 650 | #out PI as control_signal (Brief="Pressure Indicator of Condenser", Protected = true, PosX=0.32, PosY=0); |
---|
[893] | 651 | |
---|
| 652 | EQUATIONS |
---|
| 653 | |
---|
| 654 | "Molar Flow Balance" |
---|
| 655 | InletVapour.F = OutletLiquid.F; |
---|
| 656 | |
---|
| 657 | "Molar Composition Balance" |
---|
| 658 | InletVapour.z = OutletLiquid.z; |
---|
| 659 | |
---|
| 660 | #"Energy Balance" |
---|
| 661 | #InletVapour.F*InletVapour.h + InletQ = OutletLiquid.F*OutletLiquid.h; |
---|
| 662 | |
---|
| 663 | "Pressure Drop" |
---|
[899] | 664 | OutletLiquid.P = InletVapour.P; |
---|
[893] | 665 | |
---|
| 666 | "Subcooled Temperature" |
---|
| 667 | OutletLiquid.T = T_sub; |
---|
| 668 | |
---|
[899] | 669 | "Degree of subcooling" |
---|
| 670 | SubcoolingDegree = InletVapour.T - T_sub; |
---|
[893] | 671 | |
---|
| 672 | "Liquid enthalpy" |
---|
| 673 | OutletLiquid.h = PP.LiquidEnthalpy(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z); |
---|
| 674 | |
---|
| 675 | "Condenser Duty" |
---|
| 676 | CondenserDuty = OutletLiquid.F*OutletLiquid.h - InletVapour.F*InletVapour.h; |
---|
| 677 | |
---|
| 678 | "Vapourisation Fraction" |
---|
| 679 | OutletLiquid.v = 0; |
---|
| 680 | |
---|
| 681 | end |
---|
| 682 | |
---|