import math
from sympy import Symbol, solve
def horner(coeffs, x):
acc = 0
for c in reversed(coeffs):
acc = acc * x + c
return acc
#Given:
P1 = 101.325 #Pressure at the beginning(1) in kPa
T1 = 27.+273 #Temperature at the beginning(1) in K
r_p = 6. #pressure ratio
g = 1.4 #Specific heat ratio(gamma)
cp = 1.005 #Specific heat in kJ/kgK
W_TC = 2.5 #Ratio of Turbine work and compressor work
m = 1. #Assume mass in kg
#Solution:
#Refer fig 26.22
T2 = T1*r_p**((g-1)/g) #Temperature at 2 in K
T3 = Symbol('T3') #Defining temperature at 3 as a unknown in K
T4 = T3/r_p**((g-1)/g) #Defining temperature at 4 in terms of T3 in K
W_C = m*cp*(T2-T1) #Compressor work in kJ
W_T = m*cp*(T3-T4) #Turbine work in kJ
T3 = solve(W_T-W_TC*W_C)[0] #Temperature at 3 in K
T4 = horner([0.5993],T3) #Temperature at 4 in K
eta = ((T3-T4)-(T2-T1))/(T3-T2) #Cycle efficiency
#Results:
print " The maximum temperature in the cycle, T3 = %.1f K"%(T3)
print " The cycle efficiency, eta = %.2f percent"%(eta*100)
import math
#Given:
T1 = 25.+273
T3 = 825.+273 #Minimum and maximum temperature in K
r_p = 4.5 #pressure ratio
eta_C = 85.
eta_T = 90. #Isentropic efficiencies of compressor and turbine in percent
P = 1300. #Power rating of the turbine in kW
cp = 1.005 #Specific heat in kJ/kgK
g = 1.4 #Specific heat ratio(gamma)
#Solution:
#Refer fig 26.23
T21 = T1*r_p**((g-1)/g) #Isentropic temperature at 2 in K
T2 = (T21-T1)/(eta_C/100)+T1 #Temperature at 2 in K
T41 = T3/r_p**((g-1)/g) #Isentropic temperature at 4 in K
T4 = T3-eta_T/100*(T3-T41) #Temperature at 4 in K
W_C = cp*(T2-T1) #Compressor work in kJ/kg
W_T = cp*(T3-T4) #Turbine work in kJ/kg
Q1 = cp*(T3-T2) #Heat added in kJ/kg
W = W_T-W_C #Work output in kJ/kg (Round off error)
eta = W/Q1 #Cycle efficiency
r_w = W/W_T #Work ratio
HR = 3600/(eta) #Heat rate in kJ/kWh (Round off error)
m = P/W #Mass flow rate in kg/s
#Results:
print " The specific work output, W = %d kJ/kg"%(W)
print " The cycle efficiency, eta = %.1f percent"%(eta*100)
print " The work ratio, rw = %.3f"%(r_w)
print " The heat rate = %d kJ/kWh"%(HR)
print " The mass flow rate for 1300 kW, m = %.2f kg/s"%(m)
#Round off error in the values of 'W' and 'HR'
#Given:
T1 = 25.+273
T3 = 750.+273 #Minimum and maximum temperature in K
r_p = 4. #pressure ratio
eta_C = 75. #Isentropic efficiency of compressor in percent
g = 1.4 #Specific heat ratio(gamma)
#Solution:
#Refer fig 26.24
T21 = T1*r_p**((g-1)/g) #Isentropic temperature at 2 in K
T2 = (T21-T1)/(eta_C/100)+T1 #Temperature at 2 in K
T41 = T3/r_p**((g-1)/g) #Isentropic temperature at 4 in K
#For zero efficiency of the cycle (T3-T4) = (T2-T1)
eta_T = (T2-T1)/(T3-T41) #Turbine efficiency
#Results:
print " The turbine efficiency for zero cycle efficiency, eta_T = %.1f percent"%(eta_T*100)
#Given:
P1 = 1.
P2 = 6. #Pressure at entering and leaving of compressor in bar
T1 = 27.+273 #Temperature at entering in K
T3 = 700.+273 #Maximum temperature in K
eta_C = 0.80
eta_T = 0.85 #Isentropic efficiencies of compressor and turbine in percent
eta_c = 0.98 #Combustion efficiency in percent
P3 = P2-0.1 #Pressure at 3 after falling 0.1 bar in bar
cp_a = 1.005 #Specific heat of air in kJ/kgK
g = 1.4 #Specific heat ratio(gamma)
cp_g = 1.147 #Specific heat of gas in kJ/kgK
g1 = 1.333 #Specific heat ratio(gamma) of gas
CV = 42700. #Calorific value of fuel in kJ/kg
#Solution:
#Refer fig 26.25
T21 = T1*(P2/P1)**((g-1)/g) #Isentropic temperature at 2 in K
T2 = (T21-T1)/(eta_C)+T1 #Temperature at 2 in K
T41 = T3/(P3/P1)**((g1-1)/g1) #Isentropic temperature at 4 in K
T4 = T3-eta_T*(T3-T41) #Temperature at 4 in K
W_C = cp_a*(T2-T1) #Compressor work in kJ/kg
W_T = cp_g*(T3-T4) #Turbine work in kJ/kg
W = W_T-W_C #Work output in kJ/kg
Q1 = cp_g*(T3-T2)/eta_c #Heat added in kJ/kg
eta = W/Q1 #Cycle efficiency
r_w = W/W_T #Work ratio
AR = round(3600/W) #Air rate in kg/kWh
sfc = Q1*AR/CV #Specific fuel consumption in kg/kWh
A_F = AR/sfc #Air fuel ratio
#Results:
print " a)The thermal efficiency, eta = %.1f percent"%(eta*100)
print " b)The work ratio, rw = %.3f"%(r_w)
print " e)The air rate = %d kg/kWh"%(AR)
print " d)The specific fuel consumption, sfc = %.3f kg/kWh"%(sfc)
print " c)The air fuel ratio = %.1f"%(A_F)
#Given:
P1 = 1.
P2 = 6.20 #Pressure at entering and leaving of compressor in bar
T1 = 300. #Temperature at entering in K
eta_C = 88.
eta_T = 90. #Isentropic efficiencies of compressor and turbine in percent
CV = 44186. #Calorific value of fuel in kJ/kg
F_A = 0.017 #Fuel air ratio
cp_a = 1.005 #Specific heat of air in kJ/kgK
g = 1.4 #Specific heat ratio(gamma)
cp_g = 1.147 #Specific heat of gas in kJ/kgK
g1 = 1.333 #Specific heat ratio(gamma) of gas
#Solution:
#Refer fig 26.26
T21 = T1*(P2/P1)**((g-1)/g) #Isentropic temperature at 2 in K
T2 = (T21-T1)/(eta_C/100)+T1 #Temperature at 2 in K
m_a = 1 #Assume mass of air in kg
m_f = F_A*m_a #Mass of fuel in kg
T3 = (cp_a*m_a*T2+m_f*CV)/(cp_g*(m_a+m_f)) #Temperature at 3 in K
r_p = P2/P1 #pressure ratio
T41 = T3/r_p**((g1-1)/g1) #Isentropic temperature at 4 in K
T4 = T3-eta_T/100*(T3-T41) #Temperature at 4 in K
W_C = m_a*cp_a*(T2-T1) #Compressor work in kJ/kg
W_T = (m_a+m_f)*cp_g*(T3-T4) #Turbine work in kJ/kg
W = W_T-W_C #Work output in kJ/kg
Q1 = m_f*CV #Heat added in kJ/kg
eta = W/Q1 #Cycle efficiency
#Results:
print " The turbine work, W_T = %.2f kJ/kg"%(W_T)
print " The compressor work, W_C = %.2f kJ/kg"%(W_C)
print " The thermal efficiency, eta = %.2f percent"%(eta*100)
from scipy.optimize import fsolve
import math
#Given:
T1 = 17.+273 #Temperature at entering in K
P1 = 1. #Pressure at entering of compressor in bar
r_p = 4.5 #pressure ratio
W = 4000. #Work output in kW
m = 40. #Mass flow rate in kg/s
e = 0.6 #Thermal ratio or effectiveness of heat exchanger
eta_C = 84. #Isentropic efficiency of compressor in percent
eta = 0.29 #Thermal efficiency
cp_a = 1.005 #Specific heat of air in kJ/kgK
g = 1.4 #Specific heat ratio(gamma) of air
cp_g = 1.07 #Specific heat of gas in kJ/kgK
g1 = 1.365 #Specific heat ratio(gamma) of gas
#Solution:
#Refer fig 26.27
T21 = T1*r_p**((g-1)/g) #Isentropic temperature at 2 in K
T2 = (T21-T1)/(eta_C/100)+T1 #Temperature at 2 in K
W = W/m #Specific work output in kJ/kg
Q1 = W/eta #Heat added in kJ/kg
W_C = cp_a*(T2-T1) #Compressor work in kJ/kg
W_T = W+W_C #Turbine work in kJ/kg
def f(T4):
T3 = T4-Q1/cp_g #Defining temperature at 3 in terms of T4 in K
T5 = T4-W_T/cp_g #Defining temperature at 5 in terms of T4 in K
return (cp_a*(T3-T2))/(cp_g*(T5-T2))-e
#Since effectiveness from the relation must be equal to the given effectiveness
#Thus their difference must be equal to Zero, thus function, f solve for zero to get the value of variable(T4)
T4 = fsolve(f,1000)
T5 = T4-W_T/cp_g #Temperature at 5 in K
T51 = T4/r_p**((g1-1)/g1) #Isentropic temperature at 5 in K
eta_T = (T4-T5)/(T4-T51) #Isentropic efficiency of turbine
#Results:
print " The isentropic efficiency of the gas turbine, eta_T = %.1f percent"%(eta_T*100)
import math
from sympy import Symbol,solve
#Given:
r_p = 4. #pressure ratio
eta_C = 0.86
eta_HPT = 0.84
eta_LPT = 0.80 #Isentropic efficiencies of compressor and high and low pressure turbine in percent
e = 70. #Effectiveness of heat exchanger in percent
eta_d = 0.92 #Mechanical efficiency of drive to compressor
T4 = 660.+273
T6 = 625.+273 #Temperature of gases entering H.P. turbine and L.P. turbine in K
cp_a = 1.005 #Specific heat of air in kJ/kgK
g = 1.4 #Specific heat ratio(gamma)
cp_g = 1.15 #Specific heat of gas in kJ/kgK
g1 = 1.333 #Specific heat ratio(gamma) of gas
T1 = 15.+273 #Atmospheric temperature in K
P1 = 1. #Atmospheric pressure in bar
#Solution:
#Refer fig 26.28, 26.29
P2 = r_p*P1;P4 = P2 #Pressure at 2, 4 in bar
T21 = T1*r_p**((g-1)/g) #Isentropic temperature at 2 in K
T2 = (T21-T1)/(eta_C)+T1 #Temperature at 2 in K
W_C = cp_a*(T2-T1) #Compressor work in kJ/kg
W_HPT = W_C/eta_d #Work done by H.P. turbine in kJ/kg
T5 = T4-W_HPT/cp_g #Temperature at 5 in K
T51 = T4-(T4-T5)/(eta_HPT) #Isentropic temperature at 5 in K
P5 = P4/(T4/T51)**(g1/(g1-1)) #Pressure at 5 in bar
P6 = P5;P7 = P1 #Pressure at 6, 7 in bar
T71 = T6*(P7/P6)**((g1-1)/g1) #Isentropic temperature at 7 in K
T7 = T6-eta_LPT*(T6-T71) #Temperature at 7 in K
W_LPT = cp_g*(T6-T7) #Work done by L.P. turbine in kJ/kg
T3 = Symbol('T3') #Defining temperature at 3 as a unknown in K
e1 = (cp_a*(T3-T2))/(cp_g*(T7-T2)) #Effectiveness in terms of T3
#Effectiveness from the relation must be equal to the given effectiveness
#Thus their difference must be zero
T3 = solve(e1-e/100)[0] #Temperature at 3 in K
W = cp_g*(T6-T7) #Work output in kJ/kg (error in book)
Q1 = cp_g*(T4-T3)+cp_g*(T6-T5) #Heat added in kJ/kg
eta = W/Q1 #Cycle efficiency
#Results:
print " The pressure of the gas entering L.P.T., P6 = %.2f bar"%(P6)
print " The net specific power, W = %.2f kW/kg/s"%(W)
print " The overall efficiency, eta = %.4f"%(eta)
#Answer is wrong in book
#Given:
r_p = 6. #pressure ratio
e = 65. #Effectiveness of heat exchanger in percent
T5 = 800.+273
T1 = 15.+273 #Inlet temperature to H.P. turbine and L.P. compressor in K
m = 0.7 #Mass flow rate in kg/s
eta_C = 0.8
eta_HPT = 0.85
eta_LPT = 0.85 #Isentropic efficiency of compressor and high and low pressure turbine in percent
eta_d = 98. #Mechanical efficiency to drive compressor in percent
eta_c = 97. #Combustion efficiency in percent
CV = 42600. #Calorific value of fuel in kJ/kg
cp = 1.005 #Assume specific heat in kJ/kgK
g = 1.4 #Specific heat ratio(gamma)
#Solution:
#Refer fig 26.30, 26.31
P1 = 1. #Atmospheric pressure in bar
P3 = r_p*P1
P5 = P3
P7 = P1 #Pressure at 3, 5, 7 in bar
T31 = T1*r_p**((g-1)/g) #Isentropic temperature at 3 in K
T31 = round(T31*10)/10
T3 = (T31-T1)/(eta_C)+T1 #Temperature at 3 in K
W_C = m*cp*(T3-T1) #Compressor work in kW
W_HPT = W_C*100/eta_d #Work done by H.P. turbine in kW
T6 = T5-W_HPT/(m*cp) #Temperature at 6 in K
T61 = T5-(T5-T6)/(eta_HPT) #Isentropic temperature at 6 in K
P6 = P5/(T5/T61)**(g/(g-1)) #Pressure at 6 in bar
T71 = T6*(P7/P6)**((g-1)/g) #Isentropic temperature at 7 in K
T7 = T6-eta_LPT*(T6-T71) #Temperature at 7 in K
W = m*cp*(T6-T7) #Net power developed in kW
T4 = e/100*(T7-T3)+T3 #Temperature at 4 in K
Q1 = m*cp*(T5-T4)*100/eta_c #Heat supplied in kJ/s
eta = W/Q1 #Overall thermal efficiency
sfc = Q1*3600/(CV*W) #Specific fuel consumption in kg/kWh
#Results:
print " a)The net power developed, W = %.2f kW"%(W)
print " b)The overall thermal efficiency, eta = %.1f percent"%(eta*100)
print " c)The specific fuel consumption, sfc = %.3f kg/kWh"%(sfc)
import math
#Given:
P1 = 4;P2 = 16 #Pressure at entering and leaving of compressor in bar
T1 = 320;T2 = 590 #Temperature at entering and leaving of compressor in K
e = 70 #Effectiveness of heat exchanger in percent
P3 = 15.5;P4 = 4.2 #Pressure at entering and leaving of turbine in bar
T3 = 1400;T4 = 860 #Temperature at entering and leaving of turbine in K
P = 100 #Net power output in MW
cp_h = 5.2 #Specific heat of helium in kJ/kgK
g_h = 1.67 #Specific heat ratio(gamma) for helium
#Solution:
#Refer fig 26.32, 26.33
T21 = T1*(P2/P1)**((g_h-1)/g_h) #Isentropic temperature at 2 in K
eta_C = (T21-T1)/(T2-T1) #Compressor efficiency
T41 = T3/(P3/P4)**((g_h-1)/g_h) #Isentropic temperature at 4 in K
eta_T = (T3-T4)/(T3-T41) #Turbine efficiency
Tx = T2+(T4-T2)*e/100 #Temperature at leaving of regenerator in K
Q1 = cp_h*(T3-Tx) #Heat supplied in kJ/kg
W_T = cp_h*(T3-T4) #Turbine work in kJ/kg
W_C = cp_h*(T2-T1) #Compressor work in kJ/kg
W = W_T-W_C #Work output in kJ/kg
eta = W/Q1 #Cycle efficiency
T5 = T4-(Tx-T2) #Temperature at 5 in K
Qout = cp_h*(T5-T1) #Heat rejected in precooler in kJ/kg
m_h = P*1000/W #Helium flow rate in kg/s
#Results:
print " a)The compressor efficiency, ,eta_C = %.3f\tThe turbine efficiency, eta_T = %.3f"%(eta_C,eta_T)
print " b)The thermal efficiency of the cycle, eta = ; %.1f percent"%(eta*100)
print " c)The heat rejected in the cooler before compressor, Qout = %.1f kJ/kg"%(Qout)
print " d)The helium flow rate for the net power output of 100 MW, m = %.2f kg/s"%(m_h)
import math
#Calculations on closed cycle gas turbine
#Given:
r_p = 9. #Overall pressure ratio
eta_LPC = 85.;eta_HPC = 85. #Isentropic efficiency of L.P. and H.P. compressors in percent
eta_LPT = 90.;eta_HPT = 90. #Isentropic efficiency of L.P. and H.P. turbine in percent
T1 = 300.;T5 = 1100. #Inlet temperature to turbine and compressor in K
cp_ar = 0.5207 #Specific heat of Argon in kJ/kgK
g_ar = 1.667 #Specific heat ratio(gamma) for Argon
R_ar = 0.20813 #Specific gas consmath.tant for Argon in kJ/kgK
#Solution:
#Refer fig. 26.34; 26.35
m_ar = 1. #Assume mass flow rate in kg/s
P1 = 1. #Assume pressure at entering to L.P. compressor in bar
P2 = math.sqrt(r_p)*P1 #Pressure at leaving to L.P. compressor in bar
P3 = P2 #Pressure at entering to H.P. compressor in bar
P4 = r_p*P1 #Pressure at leaving to H.P. compressor in bar
T21 = T1*(P2/P1)**((g_ar-1)/g_ar) #Isentropic temperature at 2 in K
T2 = (T21-T1)/(eta_LPC/100)+T1 #Temperature at ;2 in K
W_LPC = m_ar*cp_ar*(T2-T1) #Work required by L.P. compressor in kJ/kg/s
T3 = T1 #Temperature at 3 in K
T41 = T3*(P4/P3)**((g_ar-1)/g_ar) #Isentropic temperature at 4 in K
T4 = (T41-T3)/(eta_HPC/100)+T3 #Temperature at 4 in K
#Work required is same for both L.P.C. and H.P.C. as pressure ratio is same for both
W_HPC = W_LPC #Work required by H.P. compressor in kJ/kg/s
P5 = P4;P6 = P2;P7 = P6;P8 = P1 #Pressure at 5; 6; 7; 8 in bar
T61 = T5/(P5/P6)**((g_ar-1)/g_ar) #Isentropic temperature at 6 in K
T6 = T5-eta_HPT/100*(T5-T61) #Temperature at 6 in K
W_HPT = m_ar*cp_ar*(T5-T6) #Work done by H.P. turbine in kJ/kg/s
#Work done is same for both L.P.T. and H.P.T. as pressure ratio is same for both
W_LPT = W_HPT #Work done by L.P. turbine in kJ/kg/s
T7 = T5 #Temperature at 7 in K
#(a)
W = (W_HPT+W_LPT)-(W_HPC+W_LPC) #Net work done in kW/kg
#(b)
r_w = W/(W_HPT+W_LPT) #Work ratio
#(c)
Q1_c = m_ar*cp_ar*(T5-T4) #Heat supplied in combustion chamber in kJ/kg/s
Q1_r = m_ar*cp_ar*(T7-T6) #Heat supplied in reheater in kJ/kg/s
eta = W/(Q1_c+Q1_r) #Overall efficiency
#Results:
print " a)The work done per kg of fuel flow, W = %.1f kW/kg"%(W)
print " b)The work ratio, r_w = %.3f"%(r_w)
print " c)The overall efficiency, eta = %.3f"%(eta)