# Variables
T1f = 125. ; # Temperature of NH3 -[degree F]
T1 = 460. +T1f ; # Temperature NH3 -[degree Rankine]
Pg = 292. ; # Pressure of NH3 -[psig]
Pa = Pg+14.7 ; #Pressure of NH3 -[psia]
R = 10.73 ; #Universal gas constant-[(psia*cubic feet)/(lb mol*R)]
mw_NH3 = 17. ; # Molecular wt. 1 lb mol NH3-[lb]
n = 1/17. ; #[mol]
V_tank = 120. ; # Volume of tank-[cubic feet]
# Calculations
V_id = (n*R*T1)/Pa ; # Specific volume of NH3 treating it ideal gas-[cubic feet/lb]
Tc = 729.9 ; #[degree R]
Pc = 1636. ; #[psia]
Tr = T1/Tc;
Pr = Pa/Pc;
z_real = 0.855;
z_ideal = 1.;
V_real = V_id*z_real/z_ideal; # Specific volume of NH3 treating it real gas-[cubic feet/lb]
NH3 = V_tank/V_real ; # Actual amt. of NH3 in tank-[lb]
# Results
print 'Actual amt. of NH3 in tank is %.0f lb. Therefore , boss is wrong.'%NH3
# Variables
Tc = 154.4 ; #[K]
Pc1 = 49.7 ; # [atm]
Pc = 101.3 * Pc1; #[kPa]
T_O21 = -25 ; # Temperature-[degree C]
T_O2 = 273+T_O21; #Temperature -[K]
R = 8.134 ; # gas constant-[(cubic metre * kPa)/(kg mol * K)]
V_tank = 0.0284 ; # Volume of tank-[cubic metre]
mol_O2 = 32 ; # Kmol. wt. of O2-[kg]
m_O2 = 3.5 ; # Mass of liquid O2-[kg]
# Calculations
V_sp = V_tank * mol_O2/m_O2 ; # Specific molar volume-[m**3/kg]
Vc = R * Tc/Pc ; # [cubic metre/kg mol]
Vr = V_sp/Vc;
Tr = T_O2/Tc;
Pr = 1.43 ; # [kPa]
P_O2 = Pr * Pc ; # The pressure in the tank -[kPa]
# Results
print 'The pressure in the tank is %.2f kPa.'%P_O2
# Variables
Tc = 100. ; # Temperature -[degree C]
T = 273 +Tc ; # Temperature -[K]
P = 90. ; # Pressure [atm]
R = 82.06 ; # gas constant-[(cubic centimetre * atm)/(g mol * K)]
Y_CH4 = 20./100 ; # [mole fraction]
Y_C2H4 = 30./100 ; # [mole fraction]
Y_N2 = 50./100 ; #[mole fraction]
#Additional information from appendix D
Tc_CH4 = 191. ; #[K]
Pc_CH4 = 45.8 ; # [atm]
Tc_C2H4 = 283. ; #[K]
Pc_C2H4 = 50.5 ; # [atm]
Tc_N2 = 126. ; #[K]
Pc_N2 = 33.5 ; # [atm]
# Calculations & Results
#(a)-Ideal gas law
V_sp1 = R * T/P ; # Molar volume-[cubic centimetre/g mol]
print '(a) The volume per mole of mixture by ideal gas law is %.1f cubic centimetre/g mol.'%V_sp1
#(b)
Pc_mix = Pc_CH4 * Y_CH4+Pc_C2H4 * Y_C2H4+Pc_N2 * Y_N2; # [atm]
Tc_mix = Tc_CH4 * Y_CH4+Tc_C2H4 * Y_C2H4+Tc_N2 * Y_N2 ; # [K]
Pr_mix = P/Pc_mix;
Tr_mix = T/Tc_mix;
# With 2 parameters(Pr_mix and Tr_mix) , you can find from figure 14.4b that z * Tr_mix = 1.91
z = 1.91/Tr_mix;
V_sp2 = z * R * T/P ; # Molar volume-[cubic centimetre/g mol]
print '(b) The volume per mole of mixture by treating it to be real gas is %.1f cubic centimetre/g mol.'%V_sp2