# -*- coding: utf8 -*-
from __future__ import division
#Example: 12.1
''' '''
#Variable Declaration:
#1-Inlet for compressor
#2-Exit for compressor
#T-Temperature at a state
#P-Pressure at a state
T1 = 288.2 #K
P2 = 1000 #kPa
P1 = 100 #kPa
k = 1.4
T2 = T1*(P2/P1)**(1-1/k) #K
Cp = 1.004 #Specific heat at constant pressure in kJ/kg
wc = Cp*(T2-T1) #compressor work in kJ/kg
print ('Temperature T2 = %.1f K',T2)
print (' Compressor work = %.1f kJ/kg ',wc)
#3-Turbine Inlet
#4-Turbine Exit
P4 = P1
P3 = P2
T3 = 1373.2 #K
T4 = T3*(P4/P3)**(1-1/k) #K
wt = Cp*(T3-T4)
wnet = wt-wc
print (' Temperature T3 = %.1f K',T3)
print (' Temperature T4 = %.1f K',T4)
print (' Turbine work = %.1f kJ/kg',wt)
print (' Net work = %.1f kJ/kg',wt-wc)
#2-Also high temperature heat exchanger Inlet
#3-(-do-) Exit
qh = Cp*(T3-T2) #Heat of source in kJ/kg
#4-high temp heat exchanger inlet
#1-(-do-) Exit
ql = Cp*(T4-T1) #Heat of sink in kJ/kg
nth = wnet/qh
print (' Thermal Efficiency of cycle = %.1f percent',nth*100)
# -*- coding: utf8 -*-
from __future__ import division
#Example: 12.2
''' '''
#Variable Declaration:
#Standard brayton cycle
#Calculation mistake in book
#1-Inlet for compressor
#2-Exit for compressor
#T-Temperature at a state
#P-Pressure at a state
T1 = 288.2 #K
P2 = 1000 #kPa
P1 = 100 #kPa
k = 1.4
T2s = T1*(P2/P1)**(1-1/k) #K
nc = .80 #Compressor Efficiency
T2 = T1+(T2s-T1)/0.80
Cp = 1.004 #Specific heat at constant pressure in kJ/kg
wc = Cp*(T2-T1) #compressor work in kJ/kg
print ('Temperature T2 = %.1f K',T2)
print (' Compressor work = %.1f kJ/kg ',wc)
#3-Turbine Inlet
#4-Turbine Exit
P4 = P1
P3 = P2
T3 = 1373.2 #K
T4s = T3*(P4/P3)**(1-1/k) #K
nt = 0.85 #turbine Efficiency
T4 = T3-(T3-T4s)*0.85
wt = Cp*(T3-T4)
wnet = wt-wc
print (' Temperature T3 = %.1f K',T3)
print (' Temperature T4 = %.1f K',T4)
print (' Turbine work = %.1f kJ/kg',wt)
print (' Net work = %.1f kJ/kg',wt-wc)
#2-Also high temperature heat exchanger Inlet
#3-(-do-) Exit
qh = Cp*(T3-T2) #Heat of source in kJ/kg
#4-high temp heat exchanger inlet
#1-(-do-) Exit
ql = Cp*(T4-T1) #Heat of sink in kJ/kg
nth = wnet/qh
print (' Thermal Efficiency of cycle = %.1f percent',nth*100)
# -*- coding: utf8 -*-
from __future__ import division
#Example: 12.3
''' '''
#Variable Declaration:
wnet = 395.2 #kJ/kg from example no 1
#Tx = T4
Tx = 710.8 #K from example no 1
T3 = 1373.2 #K from example no 1
Cp = 1.004 #specific heat in kJ/kg
qh = Cp*(T3-Tx)
nth = wnet/qh
print ('Thermal efficiency = %.1f percent',nth*100)
# -*- coding: utf8 -*-
from __future__ import division
#Example: 12.4
''' '''
from math import log
#Variable Declaration:
R = 0.287 #gas constant
T1 = 288.2 #compressor temperature K
T2 = 1373.2 #K turbine temperature K
#Pe/Pi = c = 10, Pi/Pe = 1/c from example 12.1
c = 10
wc = -R*T1*log(c)
print ('Isothermal work in compressor = %.1f kJ/kg ',wc)
wt = -R*T2*log(1/c)
print (' Isothermal work in turbine = %.1f kJ/kg',wt)
# -*- coding: utf8 -*-
from __future__ import division
#Example: 12.5
''' '''
from math import sqrt
#Variable Declaration:
#1-compressor inlet
#2-Compressor exit
#P-Pressure at given point
#T-Temperature at given point
P1 = 100 #kPa
P2 = 1000 #kPa
T1 = 288.2 #K
T2 = 556.8 #K
wc = 269.5 #from ex 12.1 work done in compressor in kJ/kg
#2-Burner inlet
#3-Burner exit
P3 = 1000 #kPa
T3 = 1373.2 #K
#wc = wt
Cp = 1.004 #specific enthalpy of heat at constant pressure in kJ/kg
k = 1.4
T4 = T3-wc/Cp
P4 = P3*(T4/T3)**(1-1/k)
#from s4 = s5 and h4 = h5+v2/2 we get
T5 = 710.8 #K, from second law
v = sqrt(2*Cp*1000*(T4-T5)) #m/s
print ('Velocity of air leaving the nozel = %.0f m/s',v)
# -*- coding: utf8 -*-
from __future__ import division
#Example: 12.6
''' '''
#Variable Declaration:
#1-compressor inlet
#2-compressor exit
P1 = 100 #kPa
P2 = 500 #kPa
k = 1.4
rp = P2/P1
cop = (rp**(1-1/k)-1)**-1
print ('Coefficient of performance = %.3f ',cop)
#3-Expander inlet
#4-Expander exit
P3 = P2
P4 = P1
T3 = 288.23 #K, given and fixed
T4 = T3/(P3/P4)**(1-1/k)
T1 = 253.2 #K, given
Cp = 1.004 #Specific heat at cons pressure in kJ/kg
ql = Cp*(T1-T4) #heat released in kJ/kg
P = 1 #power required in kW
ms = P/ql #kg/s
print (' Rate at which the air enter the compressor = %.3f kg/s ',ms)
# -*- coding: utf8 -*-
from __future__ import division
#Example: 12.7
''' '''
#Variable Declaration:
#1-compressor inlet
#2-compressor exit
P1 = 100 #kPa
T1 = 288.2 #K
R = 0.287 #gas constant
v1 = R*T1/P1 #specific volume at inlet in m**3/kg
rv = 10 #compression ratio given
k = 1.4 #constant
T2 = T1*rv**(k-1) #K
print 'Temperature at compressor exit, T2 = %.1f K ',T2
P2 = P1*rv**k #kPa
print ' Pressure at compressor exit, P2 = %.3f MPa ',P2/1000
v2 = v1/rv #specific heat at exit in m**3/kg
#23-heat addition process
#q23 = Cv*(T3-T2) = 1800 kJ/kg given
q23 = 1800 #kJ/kg heat addition, given
Cv = 0.717 #specific heat at constant volume in kJ/kg
T3 = T2+q23/Cv #K
print ' Initial Temperature during heat additon process, T3 = %.0f K ',T3
P3 = P2*(T3/T2) #kPa
print ' Initial pressure during heat addition process, P3 = %.3f MPa ',P3/1000
r = 10 #k = V4/V3 = P3/P4
T4 = T3*(1/r)**(k-1)
print ' Final temperature during heat addition process, T4 = %.1f K ',T4
P4 = P3/r**k #kPa
print ' Final pressure during heat addition process, P4 = %.4f MPa ',P4/1000
nth = 1-1/r**k #thermal efficiency
print ' Thermal efficiency = %.1f percent ',nth*100
q41 = Cv*(T1-T4) #/heat for process 4-1 in kJ/kg
wnet = q23+q41
mep = wnet/(v1-v2) #effective mean pressure n kPa
print ' Mean effective pressure = %.0f kPa ',mep
# -*- coding: utf8 -*-
from __future__ import division
#Example: 12.8
''' '''
#Variable Declaration:
#1-compressor inlet
#2-compressor exit
P1 = 100 #kPa
T1 = 288.2 #K
R = 0.287 #gas constant
v1 = R*T1/P1 #specific volume at inlet in m**3/kg
rv = 20 #compression ratio given
k = 1.4 #constant
T2 = T1*rv**(k-1) #K
print 'Temperature at compressor exit, T2 = %.1f K ',T2
P2 = P1*rv**k #kPa
print ' Pressure at compressor exit, P2 = %.3f MPa ',P2/1000
v2 = v1/rv #specific heat at exit in m**3/kg
#23-heat addition process
#q23 = Cv*(T3-T2) = 1800 kJ/kg given
q23 = 1800 #kJ/kg heat addition, given
Cv = .717
Cp = 1.004 #specific heat at constant pressure in kJ/kg
T3 = T2+q23/Cp #K
print ' Initial Temperature during heat addition process, T3 = %.0f K ',T3
r = T3/T2 #T3/T2 = V3/V2 = r
v3 = r*v2
T4 = T3/(v1/v3)**(k-1)
print ' Final temperature during heat addition process, T4 = %.0f K ',T4
q41 = Cv*(T1-T4) #/heat for process 4-1 in kJ/kg
wnet = q23+q41
mep = wnet/(v1-v2) #effective mean pressure in kPa
qh = 1800 #heat transfer in kJ/kg
nth = wnet/qh #thermal efficiency
print ' Thermal efficiency = %.1f percent ',nth*100
print ' Mean effective pressure = %.0f kPa ',mep