import math
from __future__ import division
#Variable declaration
M1=28.02; # Molecular mass of N2
M2=32; # Molecular mass of O2
M3=39.91; # Molecular mass of Ar
M4=44; # Molecular mass of CO2
M5=2.02; # Molecular mass of H2
y1=0.7803; # Part by volume of N2 in dry atmospheric air
y2=0.2099; # Part by volume of O2 in dry atmospheric air
y3=0.0094; # Part by volume of Ar in dry atmospheric air
y4=0.0003; # Part by volume of CO2 in dry atmospheric air
y5=0.0001; # Part by volume of H2 in dry atmospheric air
R_1=8.3143; # Universal gas constant of air in kJ/kmol K
#Calculation for (a)
# (a).Average molecular mass and apperent gas constant of dry atmospheric air
M=(y1*M1)+(y2*M2)+(y3*M3)+(y4*M4)+(y5*M5); # Average molecular mass
R=R_1/M; #Apperent gas constant of dry atmospheric air
#Result for (a)
print "(a).Average molecular mass and apperent gas constant of dry atmospheric air","\nAverage molecular mass = ",round(M,3),"kmol"
print "Apperent gas constant of dry atmospheric air =",round(R,3),"kJ/kg K"
#Calculation for (b)
# (b).The fraction of each component
m1=(M1*y1)/M;#The fraction of N2 component
m2=(M2*y2)/M;#The fraction of O2 component
m3=(M3*y3)/M;#The fraction of Ar component
m4=(M4*y4)/M;#The fraction of CO2 component
m5=(M5*y5)/M;#The fraction of H2 component
#Result for (b)
print "\n(b).The fraction of N2,O2,Ar,CO2,H2 components are given below respectively "
print "m1 =",round(m1,4)
print "m2 =",round(m2,4)
print "m3 =",round(m3,4)
print "m4 =",round(m4,4)
print "m5 =",round(m5,4)
import math
from __future__ import division
#Variable declaration
M1=44; # Molecular mass of CO2
M2=32; # Molecular mass of O2
M3=28; # Molecular mass of CO
M4=28; # Molecular mass of N2
y1=0.1; # Part by volume of CO2 in exhaust gas
y2=0.06; # Part by volume of O2 in exhaust gas
y3=0.03; # Part by volume of CO in exhaust gas
y4=0.81; # Part by volume of N2 in exhaust gas
R_1=8.3143; # Universal gas constant in kJ/kmol K
#Calculation for (a)
# (a).Average molecular mass and apperent gas constant of exhaust gas
M=(y1*M1)+(y2*M2)+(y3*M3)+(y4*M4); # Average molecular mass
R=R_1/M; #Apperent gas constant of dry atmospheric air
#Result for (a)
print "(a).Average molecular mass and apperent gas constant of exhaust gas","\nAverage molecular mass = ",round(M,3),"kmol"
print "Apperent gas constant of exhaust gas =",round(R,4),"kJ/kg K"
#Calculation for (b)
# (b).The fraction of each component
m1=(M1*y1)/M;#The fraction of CO2 component
m2=(M2*y2)/M;#The fraction of O2 component
m3=(M3*y3)/M;#The fraction of CO component
m4=(M4*y4)/M;#The fraction of N2 component
print "\n(b).The fraction of CO2,O2,CO,N2 components are given below respectively "
print "m1 =",round(m1,3)
print "m2 =",round(m2,3)
print "m3 =",round(m3,3)
print "m4 =",round(m4,3)
import math
from __future__ import division
#Variable declaration
y1=0.79; # Volume of Nitrogen in 1 kg of air
y2=0.21; # Volume of Oxygen in 1 kg of air
R_1=8.3143; # Universal gas constant of air in kJ/kmol K
T0=298; # temperature of Surroundings in kelvin
#Calculation
del_Sgen=-R_1*((y1*math.log (y1))+(y2*math.log (y2))); #Entropy generation
LW=T0*del_Sgen; # Minimum work
#Result
print "The minimum work required for separation of two gases = ",round(LW,0),"kJ/kmmol K"
import math
#Variable declaration
DPT=8; # Dew point temperature in degree celcius
p=100; # Pressure of air in kPa
T=25; # Temperature of air in degree celcius
#Calculation for (a)
# (a).partial pressure of water vapour in air
pv=1.0854; # Saturation pressure of water at DBT in kPa
#Result for (a)
print "(a).partial pressure of water vapour in air = ",pv,"kPa"
#Calculation for (b)
# (b).Specific humidity
sh=0.622*pv/(p-pv);#Specific humidity
#Result for (b)
print "\n(b).Specific humidity =",round(sh,4),"kg of water vapour /kg of dry air"
#Calculation for (c)
# (c).Relative humidity
pg=3.169; # Saturation pressure of water at T in kPa
RH=pv/pg; #Relative humidity
#Result for (c)
print "\n(c).Relative humidity =",round(RH*100,2),"%"
#Variable declaration
DBT=35; # Dry bulb temperature in degree celcius
WBT=23; # Wet bulb temperature in degree celcius
P=100; # Pressure of air in kPa
Cpo=1.0035; # Specific heat at constant pressure in kJ/kg K
R=0.287; # characteristic gas constant of air in kJ/kg K
# (a).Humidity ratio
hv=2565.3; # specific enthalpy hg at DBT in kJ/kg
hfWBT=96.52; hfgWBT=2443; # specific enthalpy at WBT in kJ/kg
PsatWBT=2.789;# Saturation pressure at WBT in kPa
#Calculation for (a)
shWBT=0.622*PsatWBT/(P-PsatWBT);# specific humidity
sh=((Cpo*(WBT-DBT))+(shWBT*hfgWBT))/(hv-hfWBT); # Humidity ratio
#Result for (a)
print "(a).Humidity ratio =",round(sh,4),"kg w.v /kg d.a"
#Calculation for (b)
# (b).Relative Humidity
pv=sh*P/(0.622+sh); # Partial pressure of water vapour
pg=5.628; # Saturation pressure at DBT in kPa
RH=pv/pg; #Relative Humidity
#Result for (b)
print "\n(b).Relative Humidity =",round(RH*100,2),"%"
#Calculation for (c)
# (c).Dew point temperature
DPT=17.5; # Saturation temperature at pg in degree celcius
#Result for (c)
print "\n(c).Dew point temperature =",DPT,"oC"
#Calculation for (d)
# (d).Specific volume
v=(R*(DBT+273))/(P-pv); # Specific volume
#Result for (d)
print "\n(d).Specific volume = ",round(v,1),"m^3/kg"
#Calculation for (e)
# (e).Enthalpy of air
h=(Cpo*DBT)+(sh*hv); #Enthalpy of air
#Result for (e)
print "\n(e).Enthalpy of air =",round(h,0),"kJ/kg d.a"
#Variable declaration
DPT1=30; # Dew point temperature at inlet in degree celcius
DPT2=15; # Dew point temperature at outlet in degree celcius
RH1=0.50; # Relative humidity at inlet
RH2=0.80; # Relative humidity at outlet
p=101.325; # Atmospheric pressure in kPa
Cpo=1.0035; # Specific heat at constant pressure in kJ/kg K
pg1=4.246; # saturation pressure of water at DBT1 in kPa
pg2=1.7051; # saturation pressure of water at DBT2 in kPa
pv1=RH1*pg1; pv2=RH2*pg2; # Partial pressure of water vapour in air at inlet and outlet
hv1=2556.3;# specific enthalpy hg at DBT1 in kJ/kg
hv2=2528.9;# specific enthalpy hg at DBT2 in kJ/kg
hv3=63;# specific enthalpy hf at DBT 2in kJ/kg
#Calculation
sh1=0.622*pv1/(p-pv1); sh2=0.622*pv2/(p-pv2); # Specific humidities at inlet and outlet
q=(Cpo*(DPT2-DPT1))+(sh2*hv2)-(sh1*hv1)+((sh1-sh2)*hv3); # Heat transfer
#Result
print "Heat removed from the air =",round(q,1),"kJ/kg of dry air"
#Variable declaration
y1=0.5; # Molecular mass of CH4 in kmol
y2=0.5; # Molecular mass of C3H8 in kmol
T=363; # Temperature of gas in kelvin
p=5.06; # Pressure of gas in MPa
v=0.48; # volume of cylinder in m^3
R_1=8.3143; # Universal gas constant of air in kJ/kmol K
# (a).Using kay’s rule
# let component 1 refer to methane and component 2 to propane
# the critical properties
Tc1=190.7; Tc2=370; # temperature in kelvin
Pc1=46.4; Pc2=42.7; # Pressure in bar
#Calculation for (a)
# using kay’s rule for the mixture
Tcmix=y1*Tc1+y2*Tc2;
Pcmix=y1*Pc1+y2*Pc2;
# reduced properties
Tr=T/Tcmix; Pr=p/Pcmix;
# From generalized chart
z=0.832;
v_1=z*R_1*T/(p*10**3); # molar volume of the mixture
d=(v-v_1)/v; # Percentage deviation from actual value
#Result for (a)
print "(a).Using kay’s rule","\nPercentage deviation from actual value = ",round(d*100,1),"%"
#Calculation for (b)
# (b).Using Redlich-Kwong equation of state
a1=0.42748*R_1*Tc1**2.5/Pc1;
a2=0.42748*R_1*Tc2**2.5/Pc2;
b1=0.08664*R_1*Tc1/Pc1;
b2=0.08664*R_1*Tc2/Pc2;
# Substituting these values in the equation 12.16
# And solving these equation by iteration method we get
v_1=0.47864;# molar volume of the mixture
d=(v-v_1)/v; # Percentage deviation from actual value
#Result for (b)
print "\n(b).Using Redlich-Kwong equation of state","\nPercentage deviation from actual value = ",round(d*100,1),"%"
#Variable declaration
ln_piCH4=-0.0323;
pi_CH4=0.9683;
p=6895; # Pressure in kPa
T=104.4; # Temperature in degree celcius
a=0.784;
#Calculation
f_CH4=pi_CH4*a*p; # Faguacity
#Result
print "The Required Faguacity = ",round(f_CH4,0),"kPa"