from __future__ import division
# Given data
C= 85 # in %
H= 12.5 # in %
H1 = 35000 # heat liberated by carbon in kJ
H2 = 143000 # heat liberated by hydrogen in kJ
HCV = (C*H1+H*H2)/100 # Higher calorific value in kJ/kg
print "Higher calorific value = %0.0f kJ/kg " %HCV
ms = 9
LCV= HCV -(ms*H*2442)/100 # Lower calorific value in kJ/kg
print "Lower calorific value = %0.0f kJ/kg " %LCV
# Note: The calculated value in the book is not accurate
# Given data
CH4 = 77 # in %
C2H6 = 22.5 #in %
H1 = 40.08 # heat liberated by CH4 in MJ/nm**3
H2 = 69.52 # heat liberated by C2H6 in MJ/nm**3
HCV = (CH4*H1+C2H6*H2)/100 # Higher calorific value in kJ/kg
print "The higher calorific value = %0.3f MJ/nm**3" %HCV
V1= CH4*2/100 # volume of water due to combustion of CH4 in m**3
V2= C2H6*3/100 # volume of water due to combustion of C2H6 in m**3
V= V1+V2 # total volume in m**3
ms= 18/22.41 # in kg
LCV= HCV-ms*V*2.242 # in MJ/nm**3
print "The lower calorific value = %0.3f MJ/nm**3" %LCV
print "The word nm**3 means that cubic metre at normal temperature and pressure"
# Note: The calculated value in the book is not accurate
# Given data
mw = 2.5 #mass of water in kg
mc= 0.744 #water equivalen of apparatus in kg
CoalMass = 1.01*10**-3 # in kg
T_r = 2.59 #temp. rise in degree C
C_c = 0.016 # Cooling correction in degree C
theta = T_r +C_c #corrected temp. rise in degree C
Cp = 4.1868 # in kJ/kg-K
m = mw+mc # in kg
Qw = m * Cp*theta #heat received by water in kJ
C = (Qw/CoalMass) # in kJ/kg
print "Calorific value of the fuel = %0.0f kJ/kg " %C
# Given data
T_r = 2.912 # temp. rise in degree C
C_c = 0.058 #cooling correction in degree C
theta = T_r + C_c # in degree C
HyCon= 14/100 # Hydrogen content
C_P = 4.1868 # in J/gm-K
Cc = 16750 #calorific value of cotton in J/gm
m_w = 1400 # in gm
m_c = 500 # in gm
m = m_w+m_c # in gm
m1 = 0.005 #mass of cotton in gm
m2 = 0.579 #mass of oil in gm
Qw = m*C_P*theta # in J
H1= m1*Cc # heat given out by combustion of cotton in J
Qin= Qw-H1 # in J
C= Qin/m2 # J/gm or kJ/kg
LCV= C-2442*9*HyCon # in J/gm or kJ/kg
print "Higher Calorific value of the fuel = %0.0f J/gm or kJ/kg" %C
print "Lower Calorific value of the fuel = %0.0f J/gm or kJ/kg" %LCV
# Given data
W_c = 500*10**-3 #water collected in kg
C_P = 4.1868 # in kJ/kg-K
T_o = 28.3 #outlet temp. in °C
T_i = 14 #inlet temp. in °C
P_bero= 785 # barometric pressure in mm
P_gas= P_bero+90/13.6 # in mm
T1=17+273 # gas temp. in K
T2= 15+273 # in K
theta = T_o-T_i #temp. rise in °C
Qw = W_c * C_P*theta # in kJ
Vgs= 2.8*10**-3 #volume of gas consumed in m**3
E = Qw/Vgs # in kJ
V1= P_gas/760*(T2/T1) # in m**3
CalorificValue= E/V1 # in kJ/standard m**3
print "Calorific value = %0.2f kJ/m**3 " %CalorificValue
# Given data
C = 0.83 # in kg
H = 0.05 # in kg
O = 0.02 # in kg
S = 0.002 # in kg
AbyF_min = (11.6 * C) + +(34.8*(H-(O/8))) + (4.35 * S) # in kg
print "The therotical mass of air = %0.2f kg " %AbyF_min
# Given data
C = 0.86 # in kg
H = 0.14 # in kg
S = 0 # in kg
O = 0 # in kg
Vair = 0.77 #volume of 1kg of air in m**3
Spe_Gravity = 0.8 # specific gravity of petrol
maBYmf = (11.6*C)+(34.8*(H-O/8)) + (4.35*S) # in kg
print "The therotical mass of air = %0.1f kg " %maBYmf
V = maBYmf *Spe_Gravity*Vair # in m**3/litre
print "Volume of air required = %0.3f m**3/litre " %V
# Given data
C = 0.75 # in kg
H = 0.08 # in kg
O = 0.03 # in kg
S = 0 # in kg
P = 1.1 # in bar
P = P*10**5 # in N/m**2
maBYmf = (11.6*C) + (34.8 * (H-(O/8))) + (4.35 *S) # in kg
print "The mass of air = %0.2f kg " %maBYmf
m = 1.5*(maBYmf ) # in kg
T = 20+273 # in K
R = 29.27
V = (m*R*T)/P # in m**3
print "Volume = %0.3f m**3 " %V
# Note: The calculated value of V in the book is wrong.
# Given data
C = 0.82 # in kg
H2 = .12 # in kg
O2 = 0.02 # in kg
a = C/12
b = H2/2
y = (32*(a+(0.5*b))-O2)/0.23
print "Minimum quantity of air = %0.2f kg " %y
# Given data
mC= 0.88 #mass of carbon in kg
mH2= 0.03 #mass of H2 in kg
mS= 0.005 #mass of S in kg
O2_mass= 2.66*mC + 8*mH2 + 2*mS # in kg
Air_mass= O2_mass/0.23 # in kg
Air_mass= 1.5*Air_mass # in kg (as 50% excess air is supplied)
print "Actual mass of air required per kg of fuel for complete combustion = %0.3f kg" %Air_mass
# The flue gases per kg of fuel will be:
CO2= 3.226 # in kg
N2= 13.04 # in kg
O2= 1.298 # in kg
total_mass= CO2+N2+O2 # in kg
CO2_per_by_mass= CO2/total_mass*100 # in %
O2_per_by_mass= O2/total_mass*100 # in %
N2_per_by_mass= N2/total_mass*100 # in %
print "Percentage of CO2 by mass is : %0.1f" %CO2_per_by_mass
print "Percentage of O2 by mass is : %0.1f" %O2_per_by_mass
print "Percentage of N2 by mass is : %0.1f" %N2_per_by_mass
M_wt_CO2= 44
CO2_Per_M_com_M_wt= CO2_per_by_mass/M_wt_CO2 # % Mass composition molecular weight
M_wt_O2= 32
O2_Per_M_com_M_wt= O2_per_by_mass/M_wt_O2 # % Mass composition molecular weight
M_wt_N2= 28
N2_Per_M_com_M_wt= N2_per_by_mass/M_wt_N2 # % Mass composition molecular weight
total= CO2_Per_M_com_M_wt + O2_Per_M_com_M_wt + N2_Per_M_com_M_wt
CO2_per_by_vol= CO2_Per_M_com_M_wt/total*100 # in %
O2_per_by_vol= O2_Per_M_com_M_wt/total*100 # in %
N2_per_by_vol= N2_Per_M_com_M_wt/total*100 # in %
print "Percentage of CO2 by volume is : %0.2f" %CO2_per_by_vol
print "Percentage of O2 by volume is : %0.0f" %O2_per_by_vol
print "Percentage of N2 by volume is : %0.2f" %N2_per_by_vol
# Given data
Cp= 1 # in kJ/kg
H= 2.7*10**3 # total heat of vaport in flue gas in kJ/kg
CoalCalorific= 32.82*10**3 # in kJ/kg
T1= 310 # final gas flue temp. in °C
T2= 25 # boiler house temp. in °C
mC= 0.84 #mass of carbon in kg
mH2= 0.05 #mass of H2 in kg
O2_mass= 2.66*mC + 9*mH2 # in kg
Air_mass= O2_mass/0.23 # in kg
Air_mass= 1.5*Air_mass # in kg (as 50% excess air is supplied)
print "Actual mass of air required per kg of fuel for complete combustion = %0.3f kg " %Air_mass
# Analysis of dry flue gas by weight
CO2= 3.08 # in kg
N2= 13.24 # in kg
O2= 1.32 # in kg
total_mass= CO2+N2+O2 # in kg
CO2_per_by_mass= CO2/total_mass*100 # in %
O2_per_by_mass= O2/total_mass*100 # in %
N2_per_by_mass= N2/total_mass*100 # in %
print "Percentage of CO2 by mass is : %0.2f" %CO2_per_by_mass
print "Percentage of O2 by mass is : %0.2f" %O2_per_by_mass
print "Percentage of N2 by mass is : %0.2f" %N2_per_by_mass
M_wt_CO2= 44
CO2_Per_M_com_M_wt= CO2_per_by_mass/M_wt_CO2 # % Mass composition molecular weight
M_wt_O2= 32
O2_Per_M_com_M_wt= O2_per_by_mass/M_wt_O2 # % Mass composition molecular weight
M_wt_N2= 28
N2_Per_M_com_M_wt= N2_per_by_mass/M_wt_N2 # % Mass composition molecular weight
total= CO2_Per_M_com_M_wt + O2_Per_M_com_M_wt + N2_Per_M_com_M_wt
CO2_per_by_vol= CO2_Per_M_com_M_wt/total*100 # in %
O2_per_by_vol= O2_Per_M_com_M_wt/total*100 # in %
N2_per_by_vol= N2_Per_M_com_M_wt/total*100 # in %
print "Percentage of CO2 by volume is : %0.0f" %CO2_per_by_vol
print "Percentage of O2 by volume is : %0.0f" %O2_per_by_vol
print "Percentage of N2 by volume is : %0.0f" %N2_per_by_vol
H_w_v= 9*mH2*H #heat carried away by water vapour in kJ
H_dry_flue= total_mass*Cp*(T1-T2) # in kJ
H_total= H_w_v+H_dry_flue # in kJ
H_available= CoalCalorific-H_total # in kJ
print "Heat available for steam generation = %0.0f kJ" %H_available
# Given data
mC= 0.86 #mass of carbon in kg
mH2= 0.14 #mass of H2 in kg
maBYmf= (2.66*mC + 8*mH2)/0.23 # in kg/kg of fuel
Air_supp_deficiency= maBYmf/10 # in kg/kg of fuel
Air_saved= 16/(12*0.23) # in kg/kg of carbon
m1= Air_supp_deficiency/Air_saved # mass of coal burns to carbon monoxide
m2= mC-m1 # mass of coal burns to carbon diooxide
CO2_formed= m2*3.66 # in kg
CO_formed= m1*28/12 # in kg
N2_formed= Air_supp_deficiency*0.77*9 # in kg
M_wt_CO2= 44 # molecular weight
M_wt_CO= 28
M_wt_N2= 28
CO2_rel_vol= CO2_formed/M_wt_CO2
CO_rel_vol= CO_formed/M_wt_CO
N2_rel_vol= N2_formed/M_wt_N2
total_rel_vol=CO2_rel_vol+CO_rel_vol+N2_rel_vol
CO2_vol= CO2_rel_vol/total_rel_vol*100 # in %
CO_vol= CO_rel_vol/total_rel_vol*100 # in %
N2_vol= N2_rel_vol/total_rel_vol*100 # in %
print "Volumetric analysis of CO2 = %0.2f %%" %CO2_vol
print "Volumetric analysis of CO = %0.2f %% " %CO_vol
print "Volumetric analysis of N2 = %0.2f %% " %N2_vol
# Given data
N = 83 #compositon of nitrogen in %
C = 81 #carbon mass in the fuel in %
C1 = 11 #compositon of CO2 in %
C2 = 2 # compositon of CO in %
O = 4 # composition of O2 in %
AirSupplied =N*C/(33*(C1+C2)) # in kg/kg
print "The amount of air supplied = %0.1f kg per kg of fuel " %AirSupplied
ExcessAir =79*O*C/(21*33*(C1+C2)) # in kg/kg
print "Weight of excess air = %0.2f kg per kg of fuel " %ExcessAir
# Given data
CO2= 10 # in %
O2= 6 # in %
N2= 84 # in %
# a= x/12 and b= (1-x)/2
# 0.23*y/32= a+b/2+c
abyc= CO2/O2
# a/(0.77*y/28)= CO2/N2
x=0.835
carbon_per= x*100 # in %
hydrogen_per= 100-carbon_per # in %
print "The fuel consists of",round(carbon_per,1),"%% carbon and",round(hydrogen_per,1),"%% hydrogen."
# Given data
H2 = 50 # in %
CO = 5 # in %
CH4 = 35 # in %
V = ((0.5*(H2+CO))+(2*CH4))/21 # in m**3
print "Quantity of air required for complete combustion of 1m**3 of gas = %0.2f m**3" %V
# Given data
H2= 0.4 # in m**3
CH= 0.425 # in m**3
C2H4= 0.0253 # in m**3
C4H8= 0.0127 # in m**3
CO= 0.075 # in m**3
O2_vol= 0.5*H2 + 2*CH + 3*C2H4 + 6*C4H8 + 0.5*CO # in m**3
Air_vol= O2_vol/0.21 # in m**3
print "The volume of air required for complete combustion = %0.1f m**3 " %Air_vol
actualAirSupplied= 1.3*Air_vol # in m**3
print "The actual quantity of air supplied = %0.2f m**3 " %actualAirSupplied
# Given data
V_H2= 0.15 # in m**3
V_CH4= 0.02 # in m**3
V_CO= 0.20 # in m**3
V_CO2= 0.06 # in m**3
V_O2= 0.03 # in m**3
V_N2= 0.54 # in m**3
V1= 0.5*V_H2 # quantity of O2 required for complete combustion of H2
V2= 2*V_CH4 # in m**3
V3= 0.5*V_CO # in m**3
V= V1+V2+V3 # total oxygen required in m**3
O2_supp= V-V_O2 # O2 to be supplied by air in m**3
Air_req_min= O2_supp/0.21 # minimum quantity of air required in m**3
Actual_Air_Supp= 1.5*Air_req_min # m**3 of air
print "The volume of air supplied = %0.2f m**3" %Actual_Air_Supp
Vol_Carbondioxide_inFlue= V_CO2+V_CH4+V_CO #total volume of carbon dioxide
Vol_O2_inFlue= (Actual_Air_Supp-Air_req_min)*0.21 # in m**3
N2_from_air_Supp= 0.79*Actual_Air_Supp # in m**3
Vol_N2_inFlue= N2_from_air_Supp+V_N2 # in m**3
total= Vol_Carbondioxide_inFlue+Vol_O2_inFlue+Vol_N2_inFlue # in m**3
Per_CarbonDioxide= Vol_Carbondioxide_inFlue/total*100 # in %
Per_Oxygen= Vol_O2_inFlue/total*100 # in %
Per_Nitrogen= Vol_N2_inFlue/total*100 # in %
print "%% Carbon dioxide is : %0.1f %%" %Per_CarbonDioxide
print "%% Carbon dioxide is : %0.2f %%" %Per_Oxygen
print "%% Carbon dioxide is : %0.2f %%" %Per_Nitrogen
# Given data
V_CH4= 0.14 # in m**3
V_CO= 0.35 # in m**3
V_CO2= 0.06 # in m**3
V_N2= 0.03 # in m**3
V_H2= 0.42 # in m**3
a= V_CH4+V_CO2+V_CO
b= 2*V_CH4+V_H2
# a+0.5*b+c= V_CO2+V_CO/2+0.21*5
c= V_CO2+V_CO/2+0.21*5-a-0.5*b
d=V_N2+5*0.79
total= a+c+d
Vol_per_CO2= a/total*100 # in %
Vol_per_O2= c/total*100 # in %
Vol_per_N2= d/total*100 # in %
print "Volume percentage of CO2 is : %0.2f" %Vol_per_CO2
print "Volume percentage of O2 is : %0.2f" %Vol_per_O2
print "Volume percentage of N2 is : %0.2f" %Vol_per_N2
m_CO2= 44 # molecular mass
m_O2= 32 # molecular mass
m_N2=28 # molecular mass
mass_ratio_CO2= Vol_per_CO2/m_CO2
mass_ratio_O2= Vol_per_O2/m_O2
mass_ratio_N2= Vol_per_N2/m_N2
total_mass_ratio= mass_ratio_CO2+mass_ratio_O2+mass_ratio_N2
mass_per_CO2= mass_ratio_CO2/total_mass_ratio*100
mass_per_O2= mass_ratio_O2/total_mass_ratio*100
mass_per_N2= mass_ratio_N2/total_mass_ratio*100
print "Mass percentage of CO2 is : %0.2f" %mass_per_CO2
print "Mass percentage of O2 is : %0.2f" %mass_per_O2
print "Mass percentage of N2 is : %0.2f"%mass_per_N2
# Given data
GCR= 110 # gas consumption rate in m**3/hour
rpm= 300 # round per minute
Vs= 0.1 # swept volume of engine in m**3
V_H2=0.50 # in m**3
V_CO= 0.05 # in m**3
V_CH4=0.25 # in m**3
V_CO2= 0.10 # in m**3
V_N2= 0.10 # in m**3
V_O2= 5.8 # in m**3
AirRequired= (0.5*(V_H2+V_CO)+2*V_CH4)/0.21 # in m**3
CO2_formed= V_CO+V_CH4 # in m**3
total_CO2= CO2_formed+V_CO2 # in m**3
N2_of_air= 0.79*AirRequired # in m**3
total_N2= N2_of_air+V_N2 # in m**3
TotalVolume= total_N2+total_CO2 # in m**3
V= TotalVolume # in m**3
ExcessAirSupplied= (V_O2*V)/(21-V_O2) # in m**3
TotalAirSupplied= ExcessAirSupplied+AirRequired # in m**3
AirFuel_ratio= round(TotalAirSupplied)/1
print "Air fuel ratio by volume is : %0.0f" % AirFuel_ratio
# Let V1= Volume of air + gas aspirated per hour
V1= GCR*6 # in m**3
Vs_out= Vs*rpm/2*60 # in m**3
Ratio= V1/Vs_out
print "The value of Ratio i.e."
print "(Volume of air + gas aspirted per hour)/Volume swept out by piston per hour = %0.4f" %Ratio
# Given data
CO2= 9.9 # in %
CO= 7.2 # in %
H2= 3.3 # in %
CH4= 0.3 # in %
N2= 79.3 # in %
O2= N2*21/79 # in %
print "Method 1 : By Carbon balance :- "
Z= (CO2+CO+CH4)/8
x= 8*Z
measured_air_fuel_ratio= 11.3
mm1= 29 # molecular mass of air
mm2= 12*8+17 # molecular mass of C8H17
massOf_air= (O2+N2)*mm1
massOf_fuel= Z*mm2
air_fuel_ratio= massOf_air/massOf_fuel
print "The air fuel ratio by mass is : %0.2f" %air_fuel_ratio
Per_error= (air_fuel_ratio - measured_air_fuel_ratio)/measured_air_fuel_ratio*100
print "Percentage error is : %0.3f %%" %Per_error
print "Method 2 : By Hydrogen balance : "
X= (O2-CO2-CO/2)*2
Z= (4*CH4+2*H2+X*2)/17
massOf_air= (O2+N2)*mm1
massOf_fuel= Z*mm2
air_fuel_ratio= massOf_air/massOf_fuel
print "The air fuel ratio by mass is : %0.2f" %air_fuel_ratio
Per_error= (air_fuel_ratio - measured_air_fuel_ratio)/measured_air_fuel_ratio*100
print "Percentage error is : %0.2f %%" %Per_error
print "Method 3 : By Carbon-Hydrogen balance : "
y= (4*CH4+2*H2+X*2)
massOf_air= (O2+N2)*mm1
massOf_fuel= x*12+y
air_fuel_ratio= massOf_air/massOf_fuel
print "The air fuel ratio by mass is : %0.2f" %air_fuel_ratio
Per_error= (air_fuel_ratio - measured_air_fuel_ratio)/measured_air_fuel_ratio*100
print "Percentage error is : %0.2f %%" %Per_error