Changeset 757 for branches/gui/eml
- Timestamp:
- Jun 3, 2009, 5:07:22 PM (14 years ago)
- Location:
- branches/gui/eml
- Files:
-
- 14 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gui/eml/controllers/icon/PID.svg
r683 r757 18 18 sodipodi:docname="PID.svg" 19 19 inkscape:export-filename="/home/bicca/apps/biblioteca/branches/gui/eml/controllers/icon/PID.png" 20 inkscape:export-xdpi=" 161.7"21 inkscape:export-ydpi=" 161.7"20 inkscape:export-xdpi="92.743233" 21 inkscape:export-ydpi="92.743233" 22 22 inkscape:output_extension="org.inkscape.output.svg.inkscape" 23 23 version="1.0"> … … 258 258 </sodipodi:namedview> 259 259 <rect 260 style="fill:url(#linearGradient2433);fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width: 2.1458962;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"260 style="fill:url(#linearGradient2433);fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.646;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" 261 261 id="rect2047" 262 262 width="111.34344" … … 269 269 <path 270 270 sodipodi:type="arc" 271 style="opacity:0.9700000 2;fill:url(#linearGradient3198);fill-opacity:1;stroke:#000000;stroke-width:2.97000003;stroke-linecap:round;stroke-linejoin:round;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:0.74250001, 0.74250001;stroke-dashoffset:0;stroke-opacity:1"271 style="opacity:0.97000001999999996;fill:url(#linearGradient3198);fill-opacity:1;stroke:#000000;stroke-width:1.17;stroke-linecap:round;stroke-linejoin:round;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:0.2925,0.2925;stroke-dashoffset:0;stroke-opacity:1" 272 272 id="path2396" 273 273 sodipodi:cx="4.4411087" -
branches/gui/eml/mixers_splitters/splitter.mso
r739 r757 219 219 220 220 end 221 222 Model splitter_column 223 ATTRIBUTES 224 Pallete = true; 225 Icon = "icon/splitter_column"; 226 Brief = "Splitter with 2 outlet streams to be used with column section model"; 227 Info = 228 "== Assumptions == 229 *Thermodynamics equilibrium 230 *Adiabatic 231 232 == Specify == 233 * The inlet stream 234 * One FlowRatios of split of the outlet streams: 235 236 FlowRatios(i) = (Mole Flow of the outlet stream i / 237 Mole Flow of the inlet stream) 238 where i = 1, 2 239 "; 240 241 VARIABLES 242 in Inlet as stream (Brief = "Inlet stream", PosX=0.5, PosY=0, Symbol="_{in}"); 243 out Reflux as stream (Brief = "Reflux stream", PosX=0.25, PosY=1, Symbol="_{reflux}"); 244 out Distillate as stream (Brief = "Distillate stream", PosX=0.75, PosY=1, Symbol="_{distillate}"); 245 FlowRatios(2) as fraction (Brief = "Distribution of Outlets", Default=0.33, Symbol="\phi"); 246 247 EQUATIONS 248 249 "Normalize Flow Ratios" 250 sum(FlowRatios) = 1; 251 252 "Flow" 253 Reflux.F = Inlet.F * FlowRatios(1); 254 Inlet.F = Reflux.F + Distillate.F; 255 256 "Composition" 257 Reflux.z = Inlet.z; 258 Distillate.z = Inlet.z; 259 260 "Pressure" 261 Reflux.P = Inlet.P; 262 Distillate.P = Inlet.P; 263 264 "Enthalpy" 265 Reflux.h = Inlet.h; 266 Distillate.h = Inlet.h; 267 268 "Temperature" 269 Reflux.T = Inlet.T; 270 Distillate.T = Inlet.T; 271 272 "Vapourisation Fraction" 273 Reflux.v = Inlet.v; 274 Distillate.v = Inlet.v; 275 276 end -
branches/gui/eml/pressure_changers/pump.mso
r742 r757 200 200 Outlet.h = Inlet.h; 201 201 end 202 203 Model pump2 204 ATTRIBUTES 205 Pallete = true; 206 Icon = "icon/Pump2"; 207 Brief = "Model of a simplified pump, used in distillation column model."; 208 Info = 209 "Specify: 210 * the inlet stream; 211 * the pump press delta dP. 212 "; 213 214 PARAMETERS 215 outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); 216 outer NComp as Integer; 217 218 VARIABLES 219 in Inlet as stream (Brief = "Inlet stream", PosX=1, PosY=0.4727, Symbol="_{in}"); 220 out Outlet as streamPH (Brief = "Outlet stream", PosX=0, PosY=0.1859, Symbol="_{out}"); 221 222 dP as press_delta (Brief="Pump head"); 223 224 EQUATIONS 225 "Molar Balance" 226 Inlet.F = Outlet.F; 227 Inlet.z = Outlet.z; 228 229 "Pump head" 230 Outlet.P = Inlet.P + dP; 231 232 "FIXME: pump potency" 233 Outlet.h = Inlet.h; 234 end 235 -
branches/gui/eml/stage_separators/condenser.mso
r755 r757 273 273 ATTRIBUTES 274 274 Pallete = true; 275 Icon = "icon/Condenser_column ";276 Brief = "Model of a dynamic condenser with splitter.";275 Icon = "icon/Condenser_column2"; 276 Brief = "Model of a dynamic condenser with control."; 277 277 Info = 278 278 "== Assumptions == … … 286 286 287 287 == Initial Conditions == 288 * the condenser temperature (OutletLiquid.T);289 * the condenser liquid level (Level);290 * (NoComps - 1) OutletLiquid (OR OutletVapour)compositions.288 * Initial_Temperature : the condenser temperature (OutletLiquid.T); 289 * Initial_Level : the condenser liquid level (Level); 290 * Initial_Composition : (NoComps) OutletLiquid compositions. 291 291 "; 292 292 293 293 PARAMETERS 294 294 outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); 295 outer NComp as Integer ;295 outer NComp as Integer (Brief="Number of Components"); 296 296 297 297 V as volume (Brief="Condenser total volume"); 298 Across as area (Brief="Cross Section Area of reboiler");299 300 Initial_Level as length(Brief="Initial Level of liquid phase");301 Initial_Temperature as temperature(Brief="Initial Temperature of Condenser");302 Initial_Composition(NComp) as fraction (Brief="Initial Liquid Composition");298 Across as area (Brief="Cross Section Area of condenser"); 299 300 Initial_Level as length (Brief="Initial Level of liquid phase"); 301 Initial_Temperature as temperature (Brief="Initial Temperature of Condenser"); 302 Initial_Composition(NComp) as fraction (Brief="Initial Liquid Composition"); 303 303 304 304 VARIABLES 305 in InletVapour as stream (Brief="Vapour inlet stream", PosX=0, PosY=0.5, Symbol="_{inV}"); 305 306 in InletVapour as stream (Brief="Vapour inlet stream", PosX=0, PosY=0.5, Symbol="_{inV}"); 306 307 out OutletLiquid as liquid_stream (Brief="Liquid outlet stream", PosX=0.5, PosY=1, Symbol="_{outL}"); 307 out OutletVapour as vapour_stream (Brief="Vapour outlet stream", PosX=0.5, PosY=0, Symbol="_{outV}"); 308 in InletQ as power (Brief="Cold supplied", PosX=1, PosY=0.6, Symbol="_{in}"); 309 310 M(NComp) as mol (Brief="Molar Holdup in the tray"); 311 ML as mol (Brief="Molar liquid holdup"); 312 MV as mol (Brief="Molar vapour holdup"); 308 out OutletVapour as vapour_stream (Brief="Vapour outlet stream", PosX=0.5, PosY=0, Symbol="_{outV}"); 309 in InletQ as power (Brief="Heat supplied", Protected = true, PosX=1, PosY=0.6, Symbol="_{in}"); 310 311 out TCI as control_signal (Brief="Temperature Indicator of Condenser", Protected = true, PosX=1, PosY=0.40); 312 out LCI as control_signal (Brief="Level Indicator of Condenser", Protected = true, PosX=1, PosY=0.25); 313 314 M(NComp) as mol (Brief="Molar Holdup in the tray"); 315 ML as mol (Brief="Molar liquid holdup"); 316 MV as mol (Brief="Molar vapour holdup"); 313 317 E as energy (Brief="Total Energy Holdup on tray"); 314 318 vL as volume_mol (Brief="Liquid Molar Volume"); 315 319 vV as volume_mol (Brief="Vapour Molar volume"); 316 Level as length (Brief="Level of liquid phase");320 Level as length (Brief="Level of liquid phase"); 317 321 318 322 INITIAL 319 323 320 Level = Initial_Level; 321 OutletLiquid.T = Initial_Temperature; 322 OutletLiquid.z(1:NComp-1) = Initial_Composition(1:NComp-1)/sum(Initial_Composition); 324 "Initial Level" 325 Level = Initial_Level; 326 327 "Initial Temperature" 328 OutletLiquid.T = Initial_Temperature; 329 330 "Initial Composition" 331 OutletLiquid.z(1:NComp-1) = Initial_Composition(1:NComp-1)/sum(Initial_Composition); 323 332 324 333 EQUATIONS … … 361 370 Level = ML*vL/Across; 362 371 372 "Temperature indicator" 373 TCI * 'K' = OutletLiquid.T; 374 375 "Level indicator" 376 LCI*V = Level*Across; 377 363 378 end -
branches/gui/eml/stage_separators/reboiler.mso
r735 r757 337 337 338 338 end 339 340 Model reboiler_column 341 342 ATTRIBUTES 343 Pallete = true; 344 Icon = "icon/reboiler_column"; 345 Brief = "Model of a dynamic reboiler - kettle with control."; 346 Info = 347 "== Assumptions == 348 349 * perfect mixing of both phases; 350 * thermodynamics equilibrium; 351 * no liquid entrainment in the vapour stream. 352 353 == Specify == 354 355 * the inlet stream; 356 * the liquid inlet stream; 357 * the outlet flows: OutletVapour.F and OutletLiquid.F; 358 * the heat supply. 359 360 == Initial Conditions == 361 362 * Initial_Temperature : the reboiler temperature (OutletLiquid.T); 363 * Initial_Level : the reboiler liquid level (Level); 364 * Initial_Composition : (NoComps) OutletLiquid compositions. 365 "; 366 367 PARAMETERS 368 outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); 369 outer NComp as Integer (Brief="Number of Components"); 370 Across as area (Brief="Cross Section Area of reboiler"); 371 V as volume (Brief="Total volume of reboiler"); 372 373 Initial_Level as length (Brief="Initial Level of liquid phase"); 374 Initial_Temperature as temperature (Brief="Initial Temperature of Reboiler"); 375 Initial_Composition(NComp) as fraction (Brief="Initial Liquid Composition"); 376 377 VARIABLES 378 379 in InletLiquid as stream (Brief="Liquid inlet stream", PosX=0, PosY=0.80, Symbol="_{inL}"); 380 out OutletLiquid as liquid_stream (Brief="Liquid outlet stream", PosX=0.50, PosY=1, Symbol="_{outL}"); 381 out OutletVapour as vapour_stream (Brief="Vapour outlet stream", PosX=0.50, PosY=0, Symbol="_{outV}"); 382 in InletQ as power (Brief="Heat supplied", Protected = true, PosX=1, PosY=0.55, Symbol="_{in}"); 383 384 out TCI as control_signal (Brief="Temperature Indicator of Reboiler", Protected = true, PosX=1, PosY=0.40); 385 out LCI as control_signal (Brief="Level Indicator of Reboiler", Protected = true, PosX=1, PosY=0.25); 386 387 M(NComp) as mol (Brief="Molar Holdup in the tray"); 388 ML as mol (Brief="Molar liquid holdup"); 389 MV as mol (Brief="Molar vapour holdup"); 390 E as energy (Brief="Total Energy Holdup on tray"); 391 vL as volume_mol (Brief="Liquid Molar Volume"); 392 vV as volume_mol (Brief="Vapour Molar volume"); 393 Level as length (Brief="Level of liquid phase"); 394 rhoV as dens_mass (Brief="Vapour Density"); 395 396 INITIAL 397 398 Level = Initial_Level; 399 OutletLiquid.T = Initial_Temperature; 400 OutletLiquid.z(1:NComp-1) = Initial_Composition(1:NComp-1)/sum(Initial_Composition); 401 402 EQUATIONS 403 "Component Molar Balance" 404 diff(M)= InletLiquid.F*InletLiquid.z - OutletLiquid.F*OutletLiquid.z - OutletVapour.F*OutletVapour.z; 405 406 "Energy Balance" 407 diff(E) = InletLiquid.F*InletLiquid.h - OutletLiquid.F*OutletLiquid.h - OutletVapour.F*OutletVapour.h + InletQ; 408 409 "Molar Holdup" 410 M = ML*OutletLiquid.z + MV*OutletVapour.z; 411 412 "Energy Holdup" 413 E = ML*OutletLiquid.h + MV*OutletVapour.h - OutletLiquid.P*V; 414 415 "Mol fraction normalisation" 416 sum(OutletLiquid.z)=1.0; 417 sum(OutletLiquid.z)=sum(OutletVapour.z); 418 419 "Vapour Density" 420 rhoV = PP.VapourDensity(OutletVapour.T, OutletVapour.P, OutletVapour.z); 421 422 "Liquid Volume" 423 vL = PP.LiquidVolume(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z); 424 425 "Vapour Volume" 426 vV = PP.VapourVolume(OutletVapour.T, OutletVapour.P, OutletVapour.z); 427 428 "Chemical Equilibrium" 429 PP.LiquidFugacityCoefficient(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z)*OutletLiquid.z = PP.VapourFugacityCoefficient(OutletVapour.T, OutletVapour.P, OutletVapour.z)*OutletVapour.z; 430 431 "Mechanical Equilibrium" 432 OutletLiquid.P = OutletVapour.P; 433 434 "Thermal Equilibrium" 435 OutletLiquid.T = OutletVapour.T; 436 437 "Geometry Constraint" 438 V = ML*vL + MV*vV; 439 440 "Level of liquid phase" 441 Level = ML*vL/Across; 442 443 end -
branches/gui/eml/streams.mso
r739 r757 214 214 end 215 215 216 Model sink2 217 ATTRIBUTES 218 Pallete = true; 219 Icon = "icon/Sink2"; 220 Brief = "Material stream sink"; 221 Info = " 222 This model should be used for boundary streams when additional 223 information about the stream is desired. 224 225 Some of the additional informations calculated by this models are: 226 * Mass density 227 * Mass flow 228 * Mass compostions 229 * Specific volume 230 * Vapour fraction 231 * Volumetric flow 232 * Liquid and Vapour compositions 233 "; 234 235 PARAMETERS 236 outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); 237 outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); 238 M(NComp) as molweight (Brief = "Component Mol Weight"); 239 240 SET 241 242 M = PP.MolecularWeight(); 243 244 VARIABLES 245 in Inlet as stream (Brief = "Inlet Stream", PosX=1, PosY=0.5308, Protected=true,Symbol="_{in}"); 246 v as fraction (Brief = "Vapourization fraction",Hidden=true); 247 x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); 248 y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); 249 zmass(NComp) as fraction (Brief = "Mass Fraction"); 250 Mw as molweight (Brief = "Average Mol Weight"); 251 vm as volume_mol (Brief = "Molar Volume"); 252 rho as dens_mass (Brief = "Stream Mass Density"); 253 rhom as dens_mol (Brief = "Stream Molar Density"); 254 Fw as flow_mass (Brief = "Stream Mass Flow"); 255 Fvol as flow_vol (Brief = "Volumetric Flow"); 256 T_Cdeg as temperature (Brief = "Temperature in °C", Lower=-200); 257 258 EQUATIONS 259 "Flash Calculation" 260 [v, x, y] = PP.FlashPH(Inlet.P, Inlet.h, Inlet.z); 261 262 "Average Molecular Weight" 263 Mw = sum(M*Inlet.z); 264 265 "Molar Density" 266 rhom * vm = 1; 267 268 "Mass or Molar Density" 269 rhom * Mw = rho; 270 271 "Flow Mass" 272 Fw = Mw*Inlet.F; 273 274 "Molar Volume" 275 vm = (1-v)*PP.LiquidVolume(Inlet.T, Inlet.P, x) + v*PP.VapourVolume(Inlet.T,Inlet.P,y); 276 277 "Volumetric Flow" 278 Fvol = Inlet.F*vm ; 279 280 "Mass Fraction" 281 zmass = M*Inlet.z / Mw; 282 283 "Temperature in °C" 284 T_Cdeg = Inlet.T - 273.15 * 'K'; 285 286 end 287 216 288 Model simple_sink 217 289 ATTRIBUTES … … 228 300 end 229 301 302 Model simple_sink2 303 ATTRIBUTES 304 Pallete = true; 305 Icon = "icon/Sink2"; 306 Brief = "Simple material stream sink"; 307 Info = " 308 This model should be used for boundary streams when no additional 309 information about the stream is desired. 310 "; 311 312 VARIABLES 313 in Inlet as stream (Brief = "Inlet Stream", PosX=1, PosY=0.5308, Protected=true,Symbol="_{in}"); 314 315 end 316 230 317 Model energy_source 231 318 ATTRIBUTES … … 236 323 VARIABLES 237 324 out OutletQ as power(Brief = "Outlet energy stream", PosX=1, PosY=0.40, Symbol="_{out}"); 325 326 end 327 328 Model energy_source2 329 ATTRIBUTES 330 Pallete = true; 331 Icon = "icon/energy_source2"; 332 Brief = "Energy stream source"; 333 334 VARIABLES 335 out OutletQ as power(Brief = "Outlet energy stream", PosX=0, PosY=0.40, Symbol="_{out}"); 238 336 239 337 end … … 539 637 end 540 638 639 Model source2 640 641 ATTRIBUTES 642 Pallete = true; 643 Icon = "icon/Source2"; 644 Brief = "Material stream source"; 645 Info = " 646 This model should be used for boundary streams. 647 Usually these streams are known and come from another process 648 units. 649 650 The user should specify: 651 * Total molar (mass or volumetric) flow 652 * Temperature 653 * Pressure 654 * Molar or mass composition 655 656 No matter the specification set, the model will calculate some 657 additional properties: 658 * Mass density 659 * Mass flow 660 * Mass compostions 661 * Specific volume 662 * Vapour fraction 663 * Volumetric flow 664 * Liquid and Vapour compositions 665 "; 666 667 PARAMETERS 668 outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); 669 outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); 670 M(NComp) as molweight (Brief = "Component Mol Weight"); 671 CompositionBasis as Switcher (Brief = "Molar or Mass Composition", Valid = ["Molar", "Mass"], Default="Molar"); 672 ValidPhases as Switcher (Brief = "Valid Phases for Flash Calculation", Valid = ["Vapour-Only", "Liquid-Only","Vapour-Liquid"], Default="Vapour-Liquid"); 673 674 675 SET 676 677 M = PP.MolecularWeight(); 678 679 VARIABLES 680 681 out Outlet as stream (Brief = "Outlet stream", PosX=0, PosY=0.5256, Symbol="_{out}",Protected=true); 682 683 Composition(NComp) as fraction (Brief = "Stream Composition"); 684 SumOfComposition as positive (Brief = "Sum of Stream Composition",Protected=true); 685 F as flow_mol (Brief = "Stream Molar Flow Rate"); 686 Fw as flow_mass (Brief = "Stream Mass Flow"); 687 Fvol as flow_vol (Brief = "Volumetric Flow"); 688 T as temperature (Brief = "Stream Temperature"); 689 T_Cdeg as temperature (Brief = "Temperature in °C", Lower=-200); 690 P as pressure (Brief = "Stream Pressure"); 691 692 x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); 693 y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); 694 695 Mw as molweight (Brief = "Average Mol Weight",Protected=true); 696 vm as volume_mol (Brief = "Molar Volume",Protected=true); 697 rho as dens_mass (Brief = "Stream Mass Density",Protected=true); 698 rhom as dens_mol (Brief = "Stream Molar Density",Protected=true); 699 700 zmass(NComp) as fraction (Brief = "Mass Fraction",Protected=true); 701 702 EQUATIONS 703 704 switch CompositionBasis 705 706 case "Molar": 707 "Stream Molar Composition" 708 Outlet.z = Composition/sum(Composition); 709 710 "Stream Mass Composition" 711 zmass = M*Outlet.z / Mw; 712 713 case "Mass": 714 "Stream Mass Composition" 715 zmass = Composition/sum(Composition); 716 717 "Stream Molar Composition" 718 Outlet.z*sum(zmass/M) = zmass/M; 719 720 end 721 722 switch ValidPhases 723 724 case "Liquid-Only": 725 726 "Vapour Fraction" 727 Outlet.v = 0; 728 729 "Liquid Composition" 730 x = Outlet.z; 731 732 "Vapour Composition" 733 y = Outlet.z; 734 735 "Overall Enthalpy" 736 Outlet.h = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x); 737 738 "Molar Volume" 739 vm = PP.LiquidVolume(Outlet.T, Outlet.P, x); 740 741 case "Vapour-Only": 742 743 "Vapor Fraction" 744 Outlet.v = 1; 745 746 "Liquid Composition" 747 x = Outlet.z; 748 749 "Vapour Composition" 750 y = Outlet.z; 751 752 "Overall Enthalpy" 753 Outlet.h = PP.VapourEnthalpy(Outlet.T, Outlet.P, y); 754 755 "Molar Volume" 756 vm = PP.VapourVolume(Outlet.T, Outlet.P, y); 757 758 759 case "Vapour-Liquid": 760 761 "Flash Calculation" 762 [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z); 763 764 "Overall Enthalpy" 765 Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, y); 766 767 "Molar Volume" 768 vm = (1-Outlet.v)*PP.LiquidVolume(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourVolume(Outlet.T,Outlet.P,y); 769 770 end 771 772 "Sum of Composition" 773 SumOfComposition = sum(Composition); 774 775 "Molar Density" 776 rhom * vm = 1; 777 778 "Average Molecular Weight" 779 Mw = sum(M*Outlet.z); 780 781 "Mass or Molar Density" 782 rhom * Mw = rho; 783 784 "Flow Mass" 785 Fw = Mw*Outlet.F; 786 787 "Volumetric Flow" 788 Fvol = Outlet.F*vm ; 789 790 "Temperature in °C" 791 T_Cdeg = Outlet.T - 273.15 * 'K'; 792 793 "Equate Flow" 794 Outlet.F = F; 795 796 "Equate Pressures" 797 Outlet.P = P; 798 799 "Equate Temperatures" 800 Outlet.T = T; 801 802 end 803 541 804 Model simple_source 542 805 … … 649 912 end 650 913 914 Model simple_source2 915 916 ATTRIBUTES 917 Pallete = true; 918 Icon = "icon/Source2"; 919 Brief = "Simple Material stream source"; 920 Info = " 921 This model should be used for boundary streams. 922 Usually these streams are known and come from another process 923 units. 924 925 The user should specify: 926 * Total molar flow 927 * Temperature 928 * Pressure 929 * Molar composition 930 "; 931 932 PARAMETERS 933 outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); 934 outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); 935 M(NComp) as molweight (Brief = "Component Mol Weight"); 936 ValidPhases as Switcher (Brief = "Valid Phases for Flash Calculation", Valid = ["Vapour-Only", "Liquid-Only","Vapour-Liquid"], Default="Vapour-Liquid"); 937 938 939 SET 940 941 M = PP.MolecularWeight(); 942 943 VARIABLES 944 945 out Outlet as stream (Brief = "Outlet stream", PosX=1, PosY=0.5256, Symbol="_{out}",Protected=true); 946 947 MolarComposition(NComp) as fraction (Brief = "Stream Molar Composition"); 948 SumOfComposition as positive (Brief = "Sum of Stream Composition",Protected=true); 949 F as flow_mol (Brief = "Stream Molar Flow Rate"); 950 T as temperature (Brief = "Stream Temperature"); 951 T_Cdeg as temperature (Brief = "Temperature in °C", Lower=-200); 952 P as pressure (Brief = "Stream Pressure"); 953 954 x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); 955 y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); 956 957 958 EQUATIONS 959 960 "Sum of Composition" 961 SumOfComposition = sum(MolarComposition); 962 963 "Stream Molar Composition" 964 Outlet.z = MolarComposition/sum(MolarComposition); 965 966 967 switch ValidPhases 968 969 case "Liquid-Only": 970 971 "Vapour Fraction" 972 Outlet.v = 0; 973 974 "Liquid Composition" 975 x = Outlet.z; 976 977 "Vapour Composition" 978 y = Outlet.z; 979 980 "Overall Enthalpy" 981 Outlet.h = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x); 982 983 984 case "Vapour-Only": 985 986 "Vapor Fraction" 987 Outlet.v = 1; 988 989 "Liquid Composition" 990 x = Outlet.z; 991 992 "Vapour Composition" 993 y = Outlet.z; 994 995 "Overall Enthalpy" 996 Outlet.h = PP.VapourEnthalpy(Outlet.T, Outlet.P, y); 997 998 999 case "Vapour-Liquid": 1000 1001 "Flash Calculation" 1002 [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z); 1003 1004 "Overall Enthalpy" 1005 Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, y); 1006 1007 1008 end 1009 1010 "Temperature in °C" 1011 T_Cdeg = Outlet.T - 273.15 * 'K'; 1012 1013 "Equate Flow" 1014 Outlet.F = F; 1015 1016 "Equate Pressures" 1017 Outlet.P = P; 1018 1019 "Equate Temperatures" 1020 Outlet.T = T; 1021 1022 end 1023 651 1024 Model sourceNoFlow 652 1025
Note: See TracChangeset
for help on using the changeset viewer.