import math
T1 = 35 # Air inlet temperature in degree Celsius
P1 = 0.1 # Air inlet pressure in MPa
Q1 = 2100 # Heat supply in kJ/kg
R = 0.287 # gas constant
rk = 8 # Compression ratio
g = 1.4 # Heat capacity ratio
n_cycle = 1-(1/rk**(g-1)) # cycle efficiency
v1 = (R*(T1+273))/(P1*1e3) # Initial volume
v2 = v1/8 # Volume after compression
T2 = (T1+273)*(v1/v2)**(g-1) # Temperature after compression
cv = 0.718 # Constant volume heat capacity in kJ/kg
T3 = Q1/cv + T2 # Temperature at after heat addition
P21 = (v1/v2)**g # Pressure ratio
P2 = P21*P1 # Pressure after compression
P3 = P2*(T3/T2) # Pressure after heat addition
Wnet = Q1*n_cycle # Net work output
Pm = Wnet/(v1-v2) # Mean pressure
print "\n Example 13.1\n"
print "\n Cycle efficiency is ",n_cycle*100 ," percent"
print "\n Maximum temperature in the cycle is ",T3 ," K"
print "\n Maximum pressure in the cycle is ",P3 ," MPa"
print "\n Mean effective pressure is ",Pm/1e3 ," MPa"
#The answers vary due to round off error
import math
rk = 14.0 # Compression ratio
k = 6.0 # cutoff percentage ratio
rc = k/100*(rk-1)+1
g = 1.4 # Heat capacity ratio
n_diesel = 1.0-((1.0/g))*(1.0/rk**(g-1))*((rc**(g-1))/(rc-1)) # Cycle efficiency
print "\n Example 13.2\n"
print "\n Air standard efficiency is ",n_diesel*100 ," percent"
#The answers vary due to round off error
import math
rk = 16 # Compression ratio
T1 = 15 # Air inlet temperature in degree Celsius
P1 = 0.1 # Air inlet pressure in MPa
T3 = 1480 # Highest temperature in cycle in degree Celsius
g = 1.4 # Heat capacity ratio
R = 0.287 # Gas constant
T2 = (T1+273)*(rk**(g-1)) # Temperature after compression
rc = (T3+273)/T2 # cut off ratio
cp = 1.005 # Constant pressure heat constant
cv = 0.718 # Constant volume heat constant
Q1 = cp*(T3+273-T2) # Heat addition
T4 = (T3+273)*((rc/rk)**(g-1)) # Temperature after heat addition
Q2 = cv*(T4-T1-273) # Heat rejection
n = 1-(Q2/Q1) # cycle efficiency
n_ = 1-((1/g))*(1/rk**(g-1))*((rc**(g-1))/(rc-1)) # cycle efficiency from another formula
Wnet = Q1*n # Net work
v1 = (R*(T1+273))/(P1*1e3) # Volume before compression
v2 = v1/rk # Volume after compression
Pm = Wnet/(v1-v2) # Mean pressure
print "\n Example 13.3\n"
print "\n Cut-off ratio is ",rc
print "\n Heat supplied per kg of air is ",Q1 ," kJ/kg"
print "\n Cycle efficiency is ",n*100 ," percent"
print "\n Mean effective pressure is ",Pm ," kPa"
#The answers vary due to round off error
import math
T1 = 50.0 # Temperature before compression stroke in degree Celsius
rk = 16.0 # Compression ratio
g = 1.4 # Heat capacity ratio
P3 = 70.0 # Maximum cycle pressure in bar
cv = 0.718 # Constant volume heat addition capacity
cp = 1.005 # Constant pressure heat addition capacity
R = 0.287 # Gas constant
T2 = (T1+273)*((rk**(g-1))) #Temperature after compression stroke
P1 = 1.0 # Pressure before compression in bar
P2 = P1*(rk)**g # Pressure after compression
T3 = T2*(P3/P2) # Temperature after constant volume heat addition
Q23 = cv*(T3-T2) # Constant volume heat added
T4 = (Q23/cp)+T3 # Temperature after constant pressure heat addition
v43 = T4/T3 # cut off ratio
v54 = rk/v43 # Expansion ratio
T5 = T4*(1/v54)**(g-1) # Temperature after expansion
P5 = P1*(T5/(T1+273)) # Pressure after expansion
Q1 = cv*(T3-T2)+cp*(T4-T3) # Total heat added
Q2 = cv*(T5-T1-273) # Heat rejected
n_cycle = 1-(Q2/Q1) # Cycle efficiency
v1 = (R*(T1+273))/(P1*1e2) # Volume before compression
v2 = (1/16)*v1 # Swept volume
Wnet = Q1*n_cycle # Net work done
Pm = Wnet/(v1-v2) # Mean pressure
print "\n Example 13.4\n"
print "\n Efficiency of the cycle is ",n_cycle*100 ," percent"
print "\n Mean effective pressure is ",Pm/100 ," bar"
#The answers vary due to round off error
import math
P1 = 0.1 # Air pressure at turbine inlet in MPa
T1 = 30 # Air temperature at turbine inlet in degree Celsius
T3 = 900 # Maximum cycle temperature at turbine inlet in degree Celsius
rp = 6 # Pressure ratio
nt = 0.8 # Turbine efficiency
nc = 0.8# Compressor efficiency
g = 1.4 # Heat capacity ratio
cv = 0.718 # Constant volume heat capacity
cp = 1.005 # Constant pressure heat capacity
R = 0.287 # Gas constant
T2s = (T1+273)*(rp)**((g-1)/g)
T4s = (T3+273)/((rp)**((g-1)/g))
T21 = (T2s-T1-273)/nc # Temperature raise due to compression
T34 = nt*(T3+273-T4s) # Temperature drop due to expansion
Wt = cp*T34 # Turbine work
Wc = cp*T21 # Compressor work
T2 = T21+T1+273 # Temperature after compression
Q1 = cp*(T3+273-T2) # Heat added
n = (Wt-Wc)/Q1 # First law efficiency
T4 = T3+273-T34 # Temperature after expansion
T6 = 0.75*(T4-T2) + T2 # Regeneration temperature
Q1_ = cp*(T3+273-T6)# Heat added
n_ = (Wt-Wc)/Q1_ #cycle efficiency
I = (n_-n)/n # Fractional increase in cycle efficiency
print "\n Example 13.5\n"
print "\n The percentage increase in cycle efficiency \n due to regeneration is ",I*100 ," percent"
#The answers vary due to round off error
import math
cp = 1.005 # Constant pressure heat capacity
Tmax = 1073.0 # Maximum cycle temperature in K
Tmin = 300.0# Minimum cycle temperature in K
Wnet_max = cp*(math.sqrt(Tmax)-math.sqrt(Tmin))**2 # maximum work
n_cycle = 1.0-math.sqrt(Tmin/Tmax) # cycle efficiency
n_carnot = 1.0-(Tmin/Tmax) # Carnot efficiency
r = n_cycle/n_carnot # Efficiency ratio
print "\n Example 13.6\n"
print "\n Maximum work done per kg of air is ",Wnet_max ," kJ/kg"
print "\n Cycle efficiency is ",n_cycle*100 ," percent"
print "\n Ratio of Brayton and Carnot efficiency is ",r
#The answers vary due to round off error
import math
rp = 6 # pressure ratio
g = 1.4 # Heat capacity ratio
cv = 0.718 # Constant volume heat capacity
cp = 1.005 #Constant pressure heat capacity
R = 0.287 # Gas constant
T1 = 300 # Minimum temperature in K
T3 = 1100 # Maximum cycle temperature in K
T0 = 300 # Atmospheric temperature in K
n_cycle = 1-(1/rp**((g-1)/g)) # cycle efficiency
T2 = (T1)*(rp**((g-1)/g)) # Temperature after compression
T4 = (T3)/(rp**((g-1)/g)) # Temperature after expansion
Wc = cp*(T2-T1) # Compressor work
Wt = cp*(T3-T4) # Turbine work
WR = (Wt-Wc)/Wt # Work ratio
Q1 = 100 # Heat addition in MW
PO = n_cycle*Q1 # Power output
m_dot = (Q1*1e06)/(cp*(T3-T2)) # Mass flow rate
R = m_dot*cp*T0*((T4/T0)-1-math.log(T4/T0)) # Exergy flow rate
print "\n Example 13.7\n"
print "\n The thermal efficiency of the cycle is ",n_cycle*100 ," percent"
print "\n Work ratio is ",WR
print "\n Power output is ",PO ," MW"
print "\n Energy flow rate of the exhaust gas stream is ",R/1e6 ," MW"
#The answers vary due to round off error
import math
nc = 0.87 # Compressor efficiency
nt = 0.9 # Turbine efficiency
T1 = 311 # Compressor inlet temperature in K
rp = 8 # compressor pressure ratio
P1 = 1 # Initial pressure in atm
T3 = 1367 # Turbine inlet temperature
P2 = P1*rp # Final pressure
P3 = 0.95*P2 # Actual pressure after compression
P4 = 1 # Atmospheric pressure
g = 1.4 # Heat capacity ratio
cv = 0.718 # Constant volume heat capacity
cp = 1.005 # Constant pressure heat capacity
R = 0.287 # Gas constant
# With no cooling
T2s = T1*((P2/P1)**((g-1)/g)) # Ideal temperature after compression
T2 = T1 + (T2s-T1)/0.87 # Actual temperature after compression
T4s = T3*(P4/P3)**((g-1)/g) # Ideal temperature after expansion
n = (((T3-T4s)*nt)-((T2s-T1)/nc))/(T3-T2) # cycle efficiency
# With cooling
n_cycle = n-0.05
x = 0.13 # Fluid quality
r = x/(x+1) #
print "\n Example 13.8\n"
print "\n Percentage of air that may be taken from the compressor is ",r*100 ," percent"
#The answers vary due to round off error
import math
#Given that
nc = 0.85 # Compressor efficiency
nt = 0.9 # Turbine efficiency
r = 3.5 # Ratio of max and min temperature
gama = 1.4 # Ratio of heat capacities for air
print "\n Example 13.9 \n"
x = (gama-1)/gama
r_opt = ((nc*nt*r)**(2/3))**(1/x)
print "\n Optimum specific output is ",r_opt
#The answers vary due to round off error
import math
#Given that
v = 300.0 # Aircraft velocity in m/s
p1 = 0.35 # Pressure in bar
t1 = -40.0 # Temperature in degree centigrade
rp = 10.0 # The pressure ratio of compressor
t4 = 1100.0 # Temperature of gases at turbine intlet in degree centigrade
ma = 50.0 # Mass flow rate of air at the inlet of compressor in kg/s
cp = 1.005 # Heat capacity of air at constant pressure in kJ/kg-K
gama=1.4 # Ratio of heat capacities for air
print "\n Example 13.10 \n"
T1 = t1+273
T4 = t4+273
T2 = T1 + (v**2)/(2*cp)*(10**-3)
p2 = p1*(100)*((T2/T1)**(gama/(gama-1)))
p3 = rp*p2
p4 =p3
T3 = T2*((p3/p2)**((gama-1)/gama))
T5 = T4-T3+T2
p5 = ((T5/T4)**(gama/(gama-1)))*(p4)
p6 = p1*100
T6 = T5*((p6/p5)**((gama-1)/gama))
V6 = (2*cp*(T5-T6)*1000)**(1/2)
Wp = ma*(V6-v)*v*(10**-6)
Q1 = ma*cp*(T4-T3)*(10**-3)
np = Wp/Q1
print "\n The temperature of the gases at the turbine exit is ",T5 ," K,\n The pressure of the gases at the turbine exit is ",p5 ," kN/m**2,\n The velocity of gases at the nozzle exit is ",V6 ," m/sec,\n The propulsive efficiency of the cycle is ",np*100 ," percent"
#The answers vary due to round off error
import math
Ta = 15 # Atmospheric temperature in degree Celsius
rp = 8 # pressure ratio
g = 1.33 # heat capacity ratio for gas
g1 = 1.40 # heat capacity ratio for air
cv = 0.718 # Constant volume heat capacity
cpa = 1.005 # Constant pressure heat capacity for air
cpg = 1.11 # Constant pressure heat capacity for gas
R = 0.287 # Gas constant
Tb = (Ta+273)*(rp)**((g1-1)/g1) # Temperature after compression
Tc = 800 # Temperature after heat addition in degree Celsius
Td = (Tc+273)/((rp)**((g-1)/g)) # Temperature after expansion
Wgt = cpg*(Tc+273-Td)-cpa*(Tb-Ta-273)
Q1 = cpg*(Tc+273-Tb)
Q1_ = cpg*(Tc+273-Td)
h1 = 3775 # Enthalpy at state 1 in kJ/kg
h2 = 2183 # Enthalpy at state2 in kJ/kg
h3 = 138 # Enthalpy at state3 in kJ/kg
h4 = h3 # Isenthalpic process
Q1_st = h1-h3 # Total heat addition
Q_fe = cpg*(Tc-100) # Heat transfer by steam
was = Q1_st/Q_fe # air steam mass ratio
Wst = h1-h2# work done by steam turbine
PO = 190e03 # Power output in kW
ws = PO/(was*Wgt+Wst)# steam flow rate
wa = was*ws # Air flow rate
CV = 43300 # Calorific volume of fuel in kJ/kg
waf = CV/(Q1+Q1_) # Air fuel ratio
FEI = (wa/waf)*CV # Fuel energy input
noA = PO/FEI # combined cycle efficiency
print "\n Example 13.11 \n"
print "\n Air fuel ratio is ",waf
print "\n Overall efficiency of combined plant is ",noA*100," percent "
#The answers vary due to round off error