- Timestamp:
- Sep 23, 2008, 5:23:00 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/eml/streams.mso
r616 r631 103 103 x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); 104 104 y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); 105 s as entr_mol (Brief = "Stream Entropy");106 105 107 106 EQUATIONS … … 110 109 111 110 "Enthalpy" 112 h = (1-v)*PP.LiquidEnthalpy(T, P, x) + 113 v*PP.VapourEnthalpy(T, P, y); 114 115 "Entropy" 116 s = (1-v)*PP.LiquidEntropy(T, P, x) + 117 v*PP.VapourEntropy(T, P, y); 111 h = (1-v)*PP.LiquidEnthalpy(T, P, x) + v*PP.VapourEnthalpy(T, P, y); 112 113 end 114 115 Model streamPHS as streamPH 116 ATTRIBUTES 117 Brief = "Stream with built-in flash calculation"; 118 Info = " 119 This model should be used when the vaporization fraction 120 is unknown. 121 122 The built-in flash calculation will determine the stream 123 state as a function of the overall composition '''z''', the 124 pressure '''P''' and the enthalpy '''h'''. 125 126 Additionally, the liquid composition '''x''', the vapor 127 composition '''y''' and the stream entropy are calculated. 128 "; 129 Pallete = false; 130 131 PARAMETERS 132 outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); 133 134 VARIABLES 135 s as entr_mol (Brief = "Stream Entropy"); 136 137 EQUATIONS 138 139 "Entropy" 140 s = (1-v)*PP.LiquidEntropy(T, P, x) + v*PP.VapourEntropy(T, P, y); 141 118 142 end 119 143 120 144 Model source 121 145 ATTRIBUTES 122 146 Pallete = true; 123 147 Icon = "icon/Source"; … … 132 156 * Temperature 133 157 * Pressure 134 * Molar (mass or volumetric)composition158 * Molar or mass composition 135 159 136 160 No matter the specification set, the model will calculate some … … 145 169 "; 146 170 147 PARAMETERS 148 outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); 149 outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); 150 M(NComp) as molweight (Brief = "Component Mol Weight"); 151 rhoModel as Switcher (Brief = "Density model", Valid = ["volume", "correlation"], Default="volume"); 152 153 SET 171 PARAMETERS 172 outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); 173 outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); 174 M(NComp) as molweight (Brief = "Component Mol Weight"); 175 CompositionBasis as Switcher (Brief = "Molar or Mass Composition", Valid = ["Molar", "Mass"], Default="Molar"); 176 ValidPhases as Switcher (Brief = "Valid Phases for Flash Calculation", Valid = ["Vapour-Only", "Liquid-Only","Vapour-Liquid"], Default="Vapour-Liquid"); 177 178 179 SET 154 180 155 181 M = PP.MolecularWeight(); 156 182 157 VARIABLES 158 out Outlet as stream (Brief = "Outlet stream", PosX=1, PosY=0.5256, Symbol="_{out}"); 183 VARIABLES 184 185 out Outlet as stream (Brief = "Outlet stream", PosX=1, PosY=0.5256, Symbol="_{out}",Protected=true); 186 187 Composition(NComp) as fraction (Brief = "Stream Composition"); 188 F as flow_mol (Brief = "Stream Molar Flow Rate"); 189 Fw as flow_mass (Brief = "Stream Mass Flow"); 190 Fvol as flow_vol (Brief = "Volumetric Flow"); 191 T as temperature (Brief = "Stream Temperature"); 192 T_Cdeg as temperature (Brief = "Temperature in °C", Lower=-200); 193 P as pressure (Brief = "Stream Pressure"); 194 159 195 x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); 160 196 y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); 161 hl as enth_mol (Brief = "Liquid Enthalpy"); 162 hv as enth_mol (Brief = "Vapour Enthalpy"); 163 s as entr_mol (Brief = "Stream Entropy"); 164 sl as entr_mol (Brief = "Liquid Entropy"); 165 sv as entr_mol (Brief = "Vapour Entropy"); 166 zmass(NComp) as fraction (Brief = "Mass Fraction"); 167 Mw as molweight (Brief = "Average Mol Weight"); 168 vm as volume_mol (Brief = "Molar Volume"); 169 rho as dens_mass (Brief = "Stream Mass Density"); 170 rhom as dens_mol (Brief = "Stream Molar Density"); 171 Fw as flow_mass (Brief = "Stream Mass Flow"); 172 Fvol as flow_vol (Brief = "Volumetric Flow"); 173 T_Cdeg as temperature (Brief = "Temperature in °C", Lower=-200); 197 198 Mw as molweight (Brief = "Average Mol Weight",Protected=true); 199 vm as volume_mol (Brief = "Molar Volume",Protected=true); 200 rho as dens_mass (Brief = "Stream Mass Density",Protected=true); 201 rhom as dens_mol (Brief = "Stream Molar Density",Protected=true); 202 203 zmass(NComp) as fraction (Brief = "Mass Fraction",Protected=true); 174 204 175 205 EQUATIONS 176 "Flash Calculation" 206 207 switch CompositionBasis 208 209 case "Molar": 210 "Stream Molar Composition" 211 Outlet.z = Composition/sum(Composition); 212 213 "Stream Mass Composition" 214 zmass = M*Outlet.z / Mw; 215 216 case "Mass": 217 "Stream Mass Composition" 218 zmass = Composition/sum(Composition); 219 220 "Stream Molar Composition" 221 Outlet.z*sum(zmass/M) = zmass/M; 222 223 end 224 225 switch ValidPhases 226 227 case "Liquid-Only": 228 229 "Vapour Fraction" 230 Outlet.v = 0; 231 232 "Liquid Composition" 233 x = Outlet.z; 234 235 "Vapour Composition" 236 y = Outlet.z; 237 238 "Overall Enthalpy" 239 Outlet.h = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x); 240 241 "Molar Volume" 242 vm = PP.LiquidVolume(Outlet.T, Outlet.P, x); 243 244 case "Vapour-Only": 245 246 "Vapor Fraction" 247 Outlet.v = 1; 248 249 "Liquid Composition" 250 x = Outlet.z; 251 252 "Vapour Composition" 253 y = Outlet.z; 254 255 "Overall Enthalpy" 256 Outlet.h = PP.VapourEnthalpy(Outlet.T, Outlet.P, y); 257 258 "Molar Volume" 259 vm = PP.VapourVolume(Outlet.T, Outlet.P, y); 260 261 262 case "Vapour-Liquid": 263 264 "Flash Calculation" 177 265 [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z); 178 179 "Overall Enthalpy" 180 Outlet.h = (1-Outlet.v)*hl + Outlet.v*hv; 181 182 "Liquid Enthalpy" 183 hl = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x); 184 185 "Vapour Enthalpy" 186 hv = PP.VapourEnthalpy(Outlet.T, Outlet.P, y); 187 188 "Overall Entropy" 189 s = (1-Outlet.v)*sl + Outlet.v*sv; 190 191 "Liquid Entropy" 192 sl = PP.LiquidEntropy(Outlet.T, Outlet.P, x); 193 194 "Vapour Entropy" 195 sv = PP.VapourEntropy(Outlet.T, Outlet.P, y); 196 197 "Average Molecular Weight" 266 267 "Overall Enthalpy" 268 Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, y); 269 270 "Molar Volume" 271 vm = (1-Outlet.v)*PP.LiquidVolume(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourVolume(Outlet.T,Outlet.P,y); 272 273 end 274 275 "Molar Density" 276 rhom * vm = 1; 277 278 "Average Molecular Weight" 198 279 Mw = sum(M*Outlet.z); 199 280 200 switch rhoModel 201 case "volume": 202 "Molar Density" 203 rhom * vm = 1; 204 205 case "correlation": 206 "Mass Density" 207 rho*((1-Outlet.v)/PP.LiquidDensity(Outlet.T,Outlet.P,x) + Outlet.v/PP.VapourDensity(Outlet.T,Outlet.P,y)) = 1; 208 end 209 210 "Mass or Molar Density" 281 "Mass or Molar Density" 211 282 rhom * Mw = rho; 212 283 213 284 "Flow Mass" 214 285 Fw = Mw*Outlet.F; 215 286 216 "Molar Volume" 217 vm = (1-Outlet.v)*PP.LiquidVolume(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourVolume(Outlet.T,Outlet.P,y); 218 219 "Volumetric Flow" 287 "Volumetric Flow" 220 288 Fvol = Outlet.F*vm ; 221 289 222 "Mass Fraction" 223 zmass = M*Outlet.z / Mw; 224 225 "Temperature in °C" 290 "Temperature in °C" 226 291 T_Cdeg = Outlet.T - 273.15 * 'K'; 292 293 "Equate Flow" 294 Outlet.F = F; 295 296 "Equate Pressures" 297 Outlet.P = P; 298 299 "Equate Temperatures" 300 Outlet.T = T; 227 301 228 302 end 229 303 230 304 Model simple_source 231 ATTRIBUTES 305 306 ATTRIBUTES 232 307 Pallete = true; 233 308 Icon = "icon/Source"; 234 Brief = "Simple material stream source";309 Brief = "Simple Material stream source"; 235 310 Info = " 236 311 This model should be used for boundary streams. … … 243 318 * Pressure 244 319 * Molar composition 245 "; 246 247 PARAMETERS 248 outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); 249 outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); 250 251 VARIABLES 252 out Outlet as stream (Brief = "Outlet stream", PosX=1, PosY=0.5256, Symbol="_{out}"); 253 x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); 254 y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); 255 hl as enth_mol (Brief = "Liquid Enthalpy"); 256 hv as enth_mol (Brief = "Vapour Enthalpy"); 257 s as entr_mol (Brief = "Stream Entropy"); 258 sl as entr_mol (Brief = "Liquid Entropy"); 259 sv as entr_mol (Brief = "Vapour Entropy"); 260 261 EQUATIONS 262 "Flash Calculation" 320 "; 321 322 PARAMETERS 323 outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); 324 outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); 325 M(NComp) as molweight (Brief = "Component Mol Weight"); 326 ValidPhases as Switcher (Brief = "Valid Phases for Flash Calculation", Valid = ["Vapour-Only", "Liquid-Only","Vapour-Liquid"], Default="Vapour-Liquid"); 327 328 329 SET 330 331 M = PP.MolecularWeight(); 332 333 VARIABLES 334 335 out Outlet as stream (Brief = "Outlet stream", PosX=1, PosY=0.5256, Symbol="_{out}",Protected=true); 336 337 MolarComposition(NComp) as fraction (Brief = "Stream Molar Composition"); 338 F as flow_mol (Brief = "Stream Molar Flow Rate"); 339 T as temperature (Brief = "Stream Temperature"); 340 T_Cdeg as temperature (Brief = "Temperature in °C", Lower=-200); 341 P as pressure (Brief = "Stream Pressure"); 342 343 x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); 344 y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); 345 346 347 EQUATIONS 348 349 "Stream Molar Composition" 350 Outlet.z = MolarComposition/sum(MolarComposition); 351 352 353 switch ValidPhases 354 355 case "Liquid-Only": 356 357 "Vapour Fraction" 358 Outlet.v = 0; 359 360 "Liquid Composition" 361 x = Outlet.z; 362 363 "Vapour Composition" 364 y = Outlet.z; 365 366 "Overall Enthalpy" 367 Outlet.h = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x); 368 369 370 case "Vapour-Only": 371 372 "Vapor Fraction" 373 Outlet.v = 1; 374 375 "Liquid Composition" 376 x = Outlet.z; 377 378 "Vapour Composition" 379 y = Outlet.z; 380 381 "Overall Enthalpy" 382 Outlet.h = PP.VapourEnthalpy(Outlet.T, Outlet.P, y); 383 384 385 case "Vapour-Liquid": 386 387 "Flash Calculation" 263 388 [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z); 264 265 266 Outlet.h = (1-Outlet.v)* hl + Outlet.v*hv;267 268 "Liquid Enthalpy" 269 hl = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x); 270 271 "Vapour Enthalpy"272 hv = PP.VapourEnthalpy(Outlet.T, Outlet.P, y); 273 274 "Overall Entropy"275 s = (1-Outlet.v)*sl + Outlet.v*sv; 276 277 "Liquid Entropy"278 sl = PP.LiquidEntropy(Outlet.T, Outlet.P, x); 279 280 "Vapour Entropy"281 sv = PP.VapourEntropy(Outlet.T, Outlet.P, y); 389 390 "Overall Enthalpy" 391 Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, y); 392 393 end 394 395 "Temperature in °C" 396 T_Cdeg = Outlet.T - 273.15 * 'K'; 397 398 "Equate Flow" 399 Outlet.F = F; 400 401 "Equate Pressures" 402 Outlet.P = P; 403 404 "Equate Temperatures" 405 Outlet.T = T; 406 282 407 end 283 408
Note: See TracChangeset
for help on using the changeset viewer.