Changeset 598 for branches/gui/eml/pressure_changers
 Timestamp:
 Aug 15, 2008, 1:54:51 AM (14 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

branches/gui/eml/pressure_changers/compressor.mso
r596 r598 30 30 PARAMETERS 31 31 32 outer PP as Plugin(Brief = "External Physical Properties", Type="PP");33 outer NComp as Integer 34 R as positive(Brief = "Constant of Gases", Unit= 'kJ/kmol/K', Default = 8.31451,Hidden=true);32 outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); 33 outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); 34 Rgas as positive (Brief = "Constant of Gases", Unit= 'kJ/kmol/K', Default = 8.31451,Hidden=true); 35 35 Mw(NComp) as molweight (Brief = "Molar Weight"); 36 CompressorType as Switcher (Brief = "Compressor Model Type",Valid=["Polytropic Operation","Isentropic Operation"], Default="Isentropic Operation"); 36 37 37 38 VARIABLES 38 39 39 n as positive (Brief = "Politropic Coefficient", Lower=0);40 k as positive(Brief = "Isentropic Coefficient", Lower=1e3);41 Cp as cp_mol 42 Cv as cv_mol 40 PolyCoeff as positive (Brief = "Polytropic Coefficient", Lower=0); 41 IseCoeff as positive (Brief = "Isentropic Coefficient", Lower=1e3); 42 Cp as cp_mol (Brief = "Heat Capacity"); 43 Cv as cv_mol (Brief = "Heat Capacity"); 43 44 Pratio as positive (Brief = "Pressure Ratio", Symbol ="P_{ratio}"); 44 45 Pdrop as press_delta (Brief = "Pressure Drop", DisplayUnit = 'kPa', Symbol ="\Delta P"); 45 Wp as energy_mol (Brief = "Politropic Head");46 Ws as energy_mol (Brief = "Isentropic Head");47 Tiso as temperature (Brief = "Isentropic Temperature");48 Effp as positive (Brief = "Politropic efficiency");49 Effs as efficiency (Brief = "Isentropic efficiency");50 FPower as power (Brief = "Fluid Power");51 Mwm as molweight (Brief = "Mixture Molar Weight");52 46 53 in Inlet as stream (Brief = "Inlet stream", PosX=0.35, PosY=1, Symbol="_{in}"); 54 out Outlet as streamPH (Brief = "Outlet stream", PosX=1, PosY=0.0, Symbol="_{out}"); 47 Head as energy_mass (Brief = "Isentropic Head"); 48 Tiso as temperature (Brief = "Isentropic Temperature"); 49 50 PolytropicEff as efficiency (Brief = "Polytropic efficiency"); 51 IsentropicEff as efficiency (Brief = "Isentropic efficiency"); 52 MechanicalEff as efficiency (Brief = "Mechanical efficiency"); 53 54 FluidPower as power (Brief = "Fluid Power"); 55 Mwm as molweight (Brief = "Mixture Molar Weight"); 56 rho as dens_mass (Brief = "Mass Density"); 57 Zfac_in as fraction (Brief = "Compressibility factor at inlet"); 58 Zfac_out as fraction (Brief = "Compressibility factor at outlet"); 55 59 56 in WorkIn as power (Brief = "Work Inlet", PosX=0, PosY=0.46); 60 in Inlet as stream (Brief = "Inlet stream", PosX=0.437, PosY=1, Symbol="_{in}"); 61 out Outlet as streamPH (Brief = "Outlet stream", PosX=0.953, PosY=0.0, Symbol="_{out}"); 62 63 in WorkIn as power (Brief = "Work Inlet", PosX=0, PosY=0.45); 57 64 58 65 SET … … 60 67 Mw = PP.MolecularWeight(); 61 68 62 R = 8.31451*'kJ/kmol/K';69 Rgas = 8.31451*'kJ/kmol/K'; 63 70 64 71 EQUATIONS 65 72 66 "Calculate Mwm for Inlet Mixture" 73 "Overall Molar Balance" 74 Outlet.F = Inlet.F; 75 76 "Component Molar Balance" 77 Outlet.z = Inlet.z; 78 79 "Average Molecular Weight" 67 80 Mwm = sum(Mw*Inlet.z); 68 81 … … 73 86 Outlet.P = Inlet.P  Pdrop; 74 87 75 "Calculate Cp Using a External Physical Properties Routine" 88 "Mass Density" 89 rho = PP.VapourDensity(Inlet.T, Inlet.P, Inlet.z); 90 91 "Heat Capacity at Constant Pressure" 76 92 Cp = PP.VapourCp(Inlet.T,Inlet.P,Inlet.z); 77 93 78 " Calculate Cv Using a External Physical Properties Routine"94 "Heat Capacity at Constant Volume" 79 95 Cv = PP.VapourCv(Inlet.T,Inlet.P,Inlet.z); 80 96 81 "C alculate Isentropic Coeficient"82 k * Cv = Cp;97 "Compressibility factor at Inlet Conditions" 98 Zfac_in = PP.VapourCompressibilityFactor(Inlet.T,Inlet.P,Inlet.z); 83 99 84 "C alculate Isentropic Head"85 Ws = (k/(k1))*R*Inlet.T*((Outlet.P/Inlet.P)^((k1)/k)  1);100 "Compressibility factor at Outlet Conditions" 101 Zfac_out = PP.VapourCompressibilityFactor(Outlet.T,Outlet.P,Outlet.z); 86 102 87 "Calculate Isentropic Outlet Temperature" 88 # Tiso = Inlet.T * (Outlet.P/Inlet.P)^((k1)/k); 103 "Isentropic Coeficient" 104 IseCoeff * Cv = Cp; 105 106 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 107 switch CompressorType 108 109 case "Isentropic Operation": 110 111 "Isentropic Head" 112 Head = (0.5*Zfac_in+0.5*Zfac_out)*(1/Mwm)*(IseCoeff/(IseCoeff1))*Rgas*Inlet.T*((Outlet.P/Inlet.P)^((IseCoeff1)/IseCoeff)  1); 113 114 "Fluid Power" 115 FluidPower*IsentropicEff = Head*sum(Mw*Inlet.z)*Inlet.F; 116 117 case "Polytropic Operation": 118 119 "Polytropic Head" 120 Head = (0.5*Zfac_in+0.5*Zfac_out)*(1/Mwm)*(PolyCoeff/(PolyCoeff1))*Rgas*Inlet.T*((Outlet.P/Inlet.P)^((PolyCoeff1)/PolyCoeff)  1); 121 122 "Fluid Power" 123 FluidPower*PolytropicEff = Head*sum(Mw*Inlet.z)*Inlet.F; 124 125 end 126 127 "Isentropic Outlet Temperature"#Mollier Method ? 89 128 PP.VapourEntropy(Tiso, Outlet.P, Outlet.z) = PP.VapourEntropy(Inlet.T, Inlet.P, Inlet.z); 90 129 91 " Calculate Real OutletTemperature"92 Effs* (Outlet.T Inlet.T) = (Tiso  Inlet.T);93 130 "Discharge Temperature" 131 IsentropicEff * (Outlet.T Inlet.T) = (Tiso  Inlet.T); 132 94 133 "Calculate Politropic Coefficient" 95 n*(ln(Outlet.T/Inlet.T)) = (n1)*(ln(Outlet.P/Inlet.P)); 96 97 "Calculate Politropic Efficiency" 98 Effp * (n1) * k = n * (k1); 99 100 "Calculate Politropic Head" 101 Ws*Effp = Wp*Effs; 134 PolyCoeff*(ln(Outlet.T/Inlet.T)) = (PolyCoeff1)*(ln(Outlet.P/Inlet.P)); 102 135 103 "Overall Molar Balance" 104 Outlet.F = Inlet.F; 105 106 "Component Molar Balance" 107 Outlet.z = Inlet.z; 108 109 # Testing Equations 136 #"Polytropic Efficiency" 137 #PolytropicEff * (PolyCoeff1) * IseCoeff = PolyCoeff * (IseCoeff1); 110 138 111 139 "Fluid Power" 112 FPower*Effs = Inlet.F*Ws; 113 114 "Fluid Power" 115 FPower = WorkIn; 140 FluidPower = WorkIn; 116 141 117 142 end
Note: See TracChangeset
for help on using the changeset viewer.