Changeset 571 for branches/gui/eml/streams.mso
- Timestamp:
- Jul 24, 2008, 8:02:39 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gui/eml/streams.mso
r569 r571 531 531 532 532 end 533 534 Model source_testing 535 536 #Testing a new way to specify stream composition !!!! 537 # Must be added a set of equations to solve the "Switch CompostionBasis" !!!!!! 538 539 ATTRIBUTES 540 Pallete = true; 541 Icon = "icon/Source"; 542 Brief = "Material stream source"; 543 Info = " 544 This model should be used for boundary streams. 545 Usually these streams are known and come from another process 546 units. 547 548 The user should specify: 549 * Total molar (mass or volumetric) flow 550 * Temperature 551 * Pressure 552 * Molar (mass or volumetric) composition 553 554 No matter the specification set, the model will calculate some 555 additional properties: 556 * Mass density 557 * Mass flow 558 * Mass compostions 559 * Specific volume 560 * Vapour fraction 561 * Volumetric flow 562 * Liquid and Vapour compositions 563 "; 564 565 PARAMETERS 566 outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); 567 outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); 568 M(NComp) as molweight (Brief = "Component Mol Weight"); 569 rhoModel as Switcher (Brief = "Density model", Valid = ["volume", "correlation"], Default="volume"); 570 CompostionBasis as Switcher (Brief = "Molar or Mass Compostion", Valid = ["Molar", "Mass"], Default="Molar"); 571 572 Composition(NComp) as fraction (Brief = "Stream Composition"); 573 574 SET 575 576 M = PP.MolecularWeight(); 577 578 VARIABLES 579 out Outlet as stream (Brief = "Outlet stream", PosX=1, PosY=0.5256, Symbol="_{out}"); 580 x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); 581 y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); 582 hl as enth_mol (Brief = "Liquid Enthalpy"); 583 hv as enth_mol (Brief = "Vapour Enthalpy"); 584 s as entr_mol (Brief = "Stream Entropy"); 585 sl as entr_mol (Brief = "Liquid Entropy"); 586 sv as entr_mol (Brief = "Vapour Entropy"); 587 zmass(NComp) as fraction (Brief = "Mass Fraction",Protected=true); 588 Mw as molweight (Brief = "Average Mol Weight"); 589 vm as volume_mol (Brief = "Molar Volume"); 590 rho as dens_mass (Brief = "Stream Mass Density"); 591 rhom as dens_mol (Brief = "Stream Molar Density"); 592 Fw as flow_mass (Brief = "Stream Mass Flow"); 593 Fvol as flow_vol (Brief = "Volumetric Flow"); 594 T_Cdeg as temperature (Brief = "Temperature in °C", Lower=-200); 595 596 EQUATIONS 597 598 switch CompostionBasis 599 600 case "Molar": 601 "Stream Molar Composition" 602 Outlet.z = Composition/sum(Composition); 603 604 "Stream Mass Composition" 605 zmass = M*Outlet.z / Mw; 606 607 case "Mass": 608 "Stream Mass Composition" 609 zmass = Composition/sum(Composition); 610 611 "Stream Molar Composition" 612 Outlet.z = (Composition/sum(Composition)/M)*sum(M*Outlet.z);# do not converge fixme !!!!! 613 614 end 615 616 "Flash Calculation" 617 [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z); 618 619 "Overall Enthalpy" 620 Outlet.h = (1-Outlet.v)*hl + Outlet.v*hv; 621 622 "Liquid Enthalpy" 623 hl = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x); 624 625 "Vapour Enthalpy" 626 hv = PP.VapourEnthalpy(Outlet.T, Outlet.P, y); 627 628 "Overall Entropy" 629 s = (1-Outlet.v)*sl + Outlet.v*sv; 630 631 "Liquid Entropy" 632 sl = PP.LiquidEntropy(Outlet.T, Outlet.P, x); 633 634 "Vapour Entropy" 635 sv = PP.VapourEntropy(Outlet.T, Outlet.P, y); 636 637 "Average Molecular Weight" 638 Mw = sum(M*Outlet.z); 639 640 switch rhoModel 641 case "volume": 642 "Molar Density" 643 rhom * vm = 1; 644 645 case "correlation": 646 "Mass Density" 647 rho*((1-Outlet.v)/PP.LiquidDensity(Outlet.T,Outlet.P,x) + Outlet.v/PP.VapourDensity(Outlet.T,Outlet.P,y)) = 1; 648 end 649 650 "Mass or Molar Density" 651 rhom * Mw = rho; 652 653 "Flow Mass" 654 Fw = Mw*Outlet.F; 655 656 "Molar Volume" 657 vm = (1-Outlet.v)*PP.LiquidVolume(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourVolume(Outlet.T,Outlet.P,y); 658 659 "Volumetric Flow" 660 Fvol = Outlet.F*vm ; 661 662 "Temperature in °C" 663 T_Cdeg = Outlet.T - 273.15 * 'K'; 664 665 end
Note: See TracChangeset
for help on using the changeset viewer.