In [1]:

```
import math
#Input data
p = 4 #Pressure ratio
T3 = 1000 #Turbine inlet temperature in K
T1 = 15+273 #Inlet temperature in K
p1 = 1 #Inlet pressure in kg/cm**2
m = 11 #Mass flow rate of air in kg/s
Cp = 0.24 #Specific heat at constant pressure in kJ/kg.K
R = 29.27 #haracteristic gas constant in kg.m/kg.K
g = 1.4 #Ratio of specific heats
#Calculations
Pc = (m*R*T1*(p**((g-1)/g)-1))/75 #Power consumed by the compressor in H.P
Pt = (m*R*T3*(1-(1/p)**((g-1)/g)))/75 #Power consumed by the turbine in H.P
N = (Pt-Pc) #Net output of the plant in H.P. In textbook answer is given wrong
T2 = (T1*(p)**((g-1)/g)) #Temperature at the end of compression in K
q = (Cp*(T3-T2)) #Heat supplied in kcal/kg of air
n = (((N*4500)/427)/(q*m*60))*100 #Overall efficiency of the plant in percent
#Output
print 'Horse power developed is %3.0f H.P The overall efficiency of the plant is %3.2f percent'%(N,n)
```

In [2]:

```
import math
#Input data
T1 = 15+273 #Temperature of air entering the compressor in K
rp = 5 #Pressure ratio
T3 = 700+273 #Temperature of air after heating in K
g = 1.4 #Ratio of specific heats
Cp = 0.24 #Specific heat at constant pressure in kJ/kg.K
#Calculations
T2 = (T1*rp**((g-1)/g)) #Temperature of air after compression in K
T4 = (T3/rp**((g-1)/g)) #Temperature of air after expansion in K
Wc = (Cp*(T2-T1)) #Workdone in the compressor in kcal/kg of air
Wt = (Cp*(T3-T4)) #Workdone in the turbine in kcal/kg of air
N = (Wt-Wc) #Net workdone in kcal/kg of air
SHP = (N*427)/75 #Shaft horse power in H.P per kg of air/sec
q = (Cp*(T3-T2)) #Heat supplied in kcal/kg of air
n = (N/q)*100 #Overall efficiency in percent
#Output
print 'Efficiency of plant is %3.1f percent \
\nThe shaft horse-power per kg of air per second is %3.0f H.P'%(n,SHP)
```

In [4]:

```
import math
#Input data
g = 1.4 #Ratio of specific heats
Cp = 0.24 #Specific heat at constant pressure in kJ/kg.K
m = 20.5 #Air flow rate in kg/sec
p = [5.85,1.03,1.03,5.85] #Inlet and outlet pressure of turbine and compressor respectively in kg/cm**2
T = [20+273,250+273,600+273,360+273] #Inlet and outlet temperatures of turbine and compressor respectively in degree C. In textbook instead of 360 degree C, 375 degree C is given
#Calculations
T2 = (T[0]*(p[3]/p[2])**((g-1)/g)) #Temperature at the outlet of compressor in ideal cycle in K
T4 = (T[2]/(p[0]/p[1])**((g-1)/g)) #Temperature at the outlet of turbine in ideal cycle in K
ic = ((T2-T[0])/(T[1]-T[0]))*100 #Isentropic efficiency of compressor in percent
it = ((T[2]-T[3])/(T[2]-T4))*100 #Isentropic efficiency of turbine in percent
Wc = (Cp*(T[1]-T[0])) #Workdone in compressor in kcal/kg of air
Wt = (Cp*(T[2]-T[3])) #Workdone in turbine in kcal/kg of air
N = (Wt-Wc) #Net workdone in kcal/kg of air
P = (N*427*m)/75 #Power output in H.P
#Output
print 'The net output is %3.0f H.P'%(P)
```

In [6]:

```
import math
#Input data
rp = 5. #Pressure ratio
T1 = 15.+273 #Inlet temperature in K
nc = 80. #Adiabatic efficiency of the compressor in percent
n = 1.4 #Adiabatic index
#Calculations
T2 = (T1*rp**((n-1)/n)) #Temperature at the outlet of compressor in ideal cycle in K. The textbook answer is wrong. Instead of 456 K, it is given as 452K
T2i = (((nc/100)*T1)+T2-T1)/(nc/100) #Temperature at the outlet of the compressor in the actual cycle in K
#Output
print 'The temperature at the end of compression is %3.0f K'%(T2i)
```

In [7]:

```
import math
#Input data
p1 = 5.62 #Pressure of gas entering the turbine in kg/cm**2
T1 = 1000+273 #Temperature of gas entering the turbine in K
p2 = 1.124 #Pressure of gas leaving the turbine in kg/cm**2. In textbook it is given as 1.24 instead of 1.124
n1 = 0.8 #Isotropic efficiency of the turbine in ratio
n = 1.36 #Adiabatic index
Cp = 0.25 #Specific heat at constant pressure in kJ/kg.K
#Calculations
T2 = (T1/(p1/p2)**((n-1)/n)) #Temperature at the end of adiabatic expansion in K
dt = (T1-T2) #Isentropic temperature drop in K
adt = (n1*dt) #Actual temperature drop in K
T2i = (T1-adt) #Temperature at the end of actual expansion in K
W = (Cp*(T1-T2i)) #Workdone per kg of gas in kcal
q = (W*427)/4500 #H.P developed per kg of gas per minute
t2i = (T2i-273) #Exhaust gas temperature in degree C
#Output
print '1) H.P developed per kg of gas per min is %3.2f \
\n2) Exhaust gas temperature is %3.1f degree C'%(q,t2i)
```

In [10]:

```
import math
#Input data
pt1 = [1.,15.+273] #Pressure and temperature at the inlet of compressor in kg/cm**2 and K respectively
pt3 = [4.,650.+273] #Pressure and temperature at the inlet of turbine in kg/cm**2 and K respectively
n = [85.,80.] #Isentropic efficiencies of turbine and compressor respectively in percent
g = 1.4 #Ratio of specific heats
Cp = 0.24 #Specific heat at constant pressure in kJ/kg.K
#Calculations
T2 = (pt1[1]*(pt3[0]/pt1[0])**((g-1)/g)) #Temperature at the end of adiabatic compression in K
T2i = (pt1[1]+((T2-pt1[1])/(n[1]/100))) #Temperature at the end of actual compression in K
T4 = (pt3[1]/(pt3[0]/pt1[0])**((g-1)/g)) #Temperature at the end of adiabatic expansion in K
T4i = (pt3[1]-((pt3[1]-T4)*(n[0]/100))) #Temperature at the end of actual expansion in K
Wt = (Cp*(pt3[1]-T4i)) #Workdone in turbine in kcal/kg of air
Wc = (Cp*(T2i-pt1[1])) #Workdone in compressor in kcal/kg of air
N = (Wt-Wc) #Net workdone in kcal/kg of air
q = (Cp*(pt3[1]-T2i)) #Heat supplied in kcal/kg of air
nt = (N/q)*100 #Thermal efficiency in percent
#Output
print 'Thermal efficiency of the cycle is %3.2f percent'%(nt)
```

In [12]:

```
import math
#Input data
p1 = 1.03 #Inlet air pressure in kg/cm**2
T1 = 15.5+273 #Inlet temperature of air in K
rp = 5. #Compression ratio
nc = 85. #Isentropic efficiency of the compressor in percent
T3 = 540.+273 #Temperature of the gas entering the turbine in K
p3 = 1.03 #Pressure of gas entering the turbine in kg/cm**2
nt = 80. #Isentropic efficiency of the turbine in percent
O = 2500. #Net output in H.P
fp = 0.07 #Fall of pressure through the combustion chamber in kg/cm**2
g = 1.4 #Ratio of specific heats for both air and gas
Cp = 0.24 #Specific heat at constant pressure in kJ/kg.K for both air and gas
#Calculations
T2 = (T1*rp**((g-1)/g)) #Temperature of air at the end of adiabatic compression in K
T2i = (T1+((T2-T1)/(nc/100))) #Temperature of air at the end of actual compression in K
T4 = (T3/((rp*p3-fp)/p3)**((g-1)/g)) #Temperature of air at the end of adiabatic compression in K
T4i = (T3-((T3-T4)*(nt/100))) #Temperature of air at the end of actual compression in K
Wt = (Cp*(T3-T4i)) #Workdone in turbine in kcal/kg of air
Wc = (Cp*(T2i-T1)) #Workdone in compressor in kcal/kg of air
N = (Wt-Wc) #Net workdone in kcal/kg of air
Fl = (O*4500)/(427*N*60) #Flow rate for 2500 H.P in kg/sec
#Output
print 'Flow rate of air is %3.1f kg/sec for a net output of %i H.P'%(Fl,O)
```

In [14]:

```
import math
#Input data
p1 = 1. #Inlet air pressure in kg/cm**2
T1 = 16.+273 #Inlet temperature of air in K
rp = 3.5 #Pressure ratio
nc = 85. #Isentropic efficiency of the compressor in percent
T3 = 500.+273 #Temperature of the gas entering the turbine in K
nt = 80. #Isentropic efficiency of the turbine in percent
mc = 4. #Mass of air entering the compressor in tonnes/hour
g = 1.4 #Ratio of specific heats
Cp = 0.24 #Specific heat at constant pressure in kJ/kg.K
#Calculations
T2 = (T1*rp**((g-1)/g)) #Temperature of air at the end of adiabatic compression in K
dt = (T2-T1) #Isentropic temperature rise in K
adt = (dt/(nc/100)) #Actual temperature rise in K
T2i = (T1+((T2-T1)/(nc/100))) #Temperature of air at the end of actual compression in K
T4 = (T3/rp**((g-1)/g)) #Temperature of air at the end of adiabatic compression in K
T4i = (T3-((T3-T4)*(nt/100))) #Temperature of air at the end of actual compression in K
Wt = (Cp*(T3-T4i)) #Workdone in turbine in kcal/kg of air
Wc = (Cp*(T2i-T1)) #Workdone in compressor in kcal/kg of air
N = (Wt-Wc) #Net workdone in kcal/kg of air
q = (Cp*(T3-T2i)) #Heat supplied in kcal/kg of air
NHP = (N*427*mc*1000)/(60*4500) #Net Horse Power available in H.P
nt = (N/q)*100 #Thermal efficiency in percent
#Output
print 'i) The net Horse power available from this unit is %3.1f H.P \
\nii) The thermal efficiency of the plant is %3.2f percent'%(NHP,nt)
```

In [16]:

```
import math
#Input data
p1 = 1.02 #Inlet air pressure in kg/cm**2
T1 = 27.+273 #Inlet temperature of air in K
p2 = 4.08 #Pressure after compression in kg/cm**2
nc = 80. #Isentropic efficiency of compressor in percent
mf = 1. #Mass of fuel in kg
ma = 80. #Mass of air in kg
nt = 85. #Isentropic efficiency of the turbine in percent
CV = 10000. #Calorific value of fuel n kcal per kg
g = 1.4 #Ratio of specific heats
Cp = 0.24 #Specific heat at constant pressure in kJ/kg.K
#Calculations
rp = (p2/p1) #Pressure ratio
T2 = (T1*rp**((g-1)/g)) #Temperature of air at the end of adiabatic compression in K
dt = (T2-T1) #Isentropic temperature rise in K
adt = (dt/(nc/100)) #Actual temperature rise in K
T2i = (T1+((T2-T1)/(nc/100))) #Temperature of air at the end of actual compression in K
q = (mf/ma)*CV #Heat supplied per kg of air in kcal
T3 = (q/Cp)+T2i #Temperature of gas at the inlet of the turbine in K
T4 = (T3/rp**((g-1)/g)) #Temperature of air at the end of adiabatic expansion in K
T4i = (T3-((T3-T4)*(nt/100))) #Temperature of air at the end of actual expansion in K
Wt = (Cp*(T3-T4i)*((ma+mf)/ma)) #Workdone in turbine in kcal/kg of air
Wc = (Cp*(T2i-T1)) #Workdone in compressor in kcal/kg of air
N = (Wt-Wc) #Net workdone in kcal/kg of air
nt = (N/q)*100 #Thermal efficiency in percent
#Output
print 'a) The net work output of installation is %3.2f kcal/kg of air \
\nb) Overall efficiency of the plant is %3.1f percent'%(N,nt)
```

In [17]:

```
import math
#Input data
rp = 5. #Pressure ratio
T3 = 580.+273 #Temperature of gas at the inlet of the turbine in K
p1 = 1.03 #Inlet air pressure in kg/cm**2
T1 = 15.+273 #Inlet temperature of air in K
nc = 80. #Isentropic efficiency of compressor in percent
no = 18. #Overall efficiency of the plant in percent
Cpa = 0.239 #Specific heat of air at constant pressure in kJ/kg.K
Cpg = 0.261 #Specific heat of gas at constant pressure in kJ/kg.K
R = 29.27 #haracteristic gas constant in kg.m/kg.K
g = 1.4 #Ratio of specific heats for air
g1 = 1.355 #Ratio of specific heats for gas
#Calculations
T2 = (T1*rp**((g-1)/g)) #Temperature of air at the end of adiabatic compression in K
T2i = (T1+((T2-T1)/(nc/100))) #Temperature of air at the end of actual compression in K
q = (Cpg*(T3-T2i)) #Heat supplied in kcal/kg of air
Wc = (Cpa*(T2i-T1)) #Workdone in compressor in kcal/kg of air
Wt = ((no/100)*q)+Wc #Turbine work output in kcal/kg of air
T4i = (T3-(Wt/Cpg)) #Temperature of air at the end of actual expansion in K
T4 = (T3/rp**((g1-1)/g1)) #Temperature of air at the end of adiabatic expansion in K
nt = ((T3-T4i)/(T3-T4))*100 #Isentropic efficiency of turbine in percent
#Output
print 'Isentropic efficiency of turbine is %3.1f percent'%(nt)
```

In [18]:

```
import math
#Input data
p1 = 1.03 #Inlet air pressure in kg/cm**2
T1 = 15.+273 #Inlet temperature of air in K
rp = 5. #Pressure ratio
nc = 85. #Isentropic efficiency of the compressor in percent
T3 = 540.+273 #Temperature of the gas entering the turbine in K
nt = 80. #Isentropic efficiency of the turbine in percent
NHP = 2000. #Net horse power in H.P
fp = 0.1 #Fall of pressure through the combustion system in kg/cm**2
g = 1.4 #Ratio of specific heats for both air and gas
Cp = 0.25 #Specific heat at constant pressure in kJ/kg.K for both air and gas
#Calculations
T2i = (T1*rp**((g-1)/g)) #Temperature of air at the end of adiabatic compression in K
dt = (T2i-T1) #Isentropic temperature rise in K
adt = (dt/(nc/100)) #Actual temperature rise in K
Wc = (Cp*adt) #Workdone in compressor in kcal/kg of air
e = ((rp*p1-fp)/p1) #Expansion ratio
T4i = (T3/e**((g-1)/g)) #Temperature of air at the end of adiabatic expansion in K
dt1 = (T3-T4i) #Isentropic temperature rise in K
adt1 = (dt1/(nt/100)) #Actual temperature rise in K
Wt = (Cp*adt1) #Workdone in turbine in kcal/kg of air
N = (Wt-Wc) #Net workdone in kcal/kg of air
w = (NHP*75)/(427*9.8) #Flow rate in kg of air per sec
#Output
print 'Flow rate is %3.2f kg of air per sec'%(w)
```

In [19]:

```
import math
#Input data
nc = 75. #Isentropic efficiency of the compressor in percent
nt = 85. #Isentropic efficiency of the turbine in percent
nm = 98. #Mechanical efficiency in percent
rp = 6. #Pressure ratio
T3 = 727.+273 #Temperature of the gas entering the turbine in K
p1 = 1. #Inlet air pressure in kg/cm**2
T1 = 15.5+273 #Inlet temperature of air in K
m = 2.2 #Mass flow rate in kg/sec
Cpa = 0.24 #Specific heat of air at constant pressure in kJ/kg.K
Cpg = 0.276 #Specific heat of gas at constant pressure in kJ/kg.K
g = 1.4 #Ratio of specific heats for air
g1 = 1.33 #Ratio of specific heats for gas
#Calculations
T2 = (T1*rp**((g-1)/g)) #Temperature of air at the end of adiabatic compression in K
T2i = (T1+((T2-T1)/(nc/100))) #Temperature of air at the end of actual compression in K
T4 = (T3/rp**((g1-1)/g1)) #Temperature of air at the end of adiabatic compression in K
T4i = (T3-((T3-T4)*(nt/100))) #Temperature of air at the end of actual compression in K
Wt = (Cpg*(T3-T4i)) #Workdone in turbine in kcal/kg of air
Wc = (Cpa*(T2i-T1)) #Workdone in compressor in kcal/kg of air
N = (Wt-Wc) #Net workdone in kcal/kg of air
P = (N*m*427)/(75*(nm/100)) #Power output of the plant in H.P
#Output
print 'Power output of the plant is %3.0f H.P'%(P)
```

In [20]:

```
import math
#Input data
T1 = 15.+273 #Inlet temperature of air in K
rp = 4. #Pressure ratio
T4 = 560.+273 #Maximum temperature of the cycle in K
nc = 83. #Isentropic efficiency of the compressor in percent
nt = 86. #Isentropic efficiency of the turbine in percent
x = 75. #Heat exchanger making use of heat available in percent
g = 1.4 #Ratio of specific heats
#Calculations
T5i = (T4*(1/rp)**((g-1)/g)) #Temperature in K
dt = (T4-T5i) #Isometric temperature drop through turbine in degree C
ta = ((nt/100)*dt) #Actual temperature drop in degree C
T5 = (T4-ta) #Temperature in K
T2i = (T1*rp**((g-1)/g)) #Temperature in K
tc = (T2i-T1) #Temperature change in degree C
T2 = (tc/(nc/100))+T1 #Temperature in K
q = (T5-T2) #Available heat in exchanger in kcal per kg *Cp
T3 = ((q*(x/100))+T2) #Temperature in K
#Without heat exchanger
qw = (T4-T2) #Heat supplied *Cp in kcal/kg
tw = (T4-T5) #Turbine work *Cp in kcal/kg
cw = (T2-T1) #Compressor work *Cp in kcal/kg
nw = (tw-cw) #Net workdone *Cp in kcal/kg
no = (nw/qw)*100 #Overall efficiency in percent
#With heat exchanger
qs = (T4-T3) #Heat supplied *Cp in kcal/kg
no1 = (nw/qs)*100 #Overall efficiency in percent
#Output
print 'The overall efficiency \
\na) without heat exchanger is %3.1f percent \
\nb) with heat exchanger making use of %i percent of heat available is %3.1f percent'%(no,x,no1)
```

In [22]:

```
import math
#Input data
p1 = 1. #Initial pressure in kg/cm**2
T1 = 15.+273 #Initial temperature in K
p2 = 5.5 #Pressure after compression in kg/cm**2
T3 = 750.+273 #Temperature at the entrance of turbine in K
v = 225. #Speed in m/s
x = 70. #Percentage
in1 = 75. #Isentropic efficiency of compressor in percent
Cp = 0.24 #Specific heat at constant pressure in kJ/kg.K
g = 1.4 #Ratio of specific heats
#Calculations
T2 = (T1*(p2/p1)**((g-1)/g)) #Temperature in K
at = (T2-T1)/(in1/100) #Actual temperature rise in the compressor in K
T2i = (T1+at) #Temperature in K
T4 = (T3/(p2/p1)**((g-1)/g)) #Temperature in K
to = (Cp*(T3-T4)) #Theoritical turbine output in kcal/kg of air
ci = (Cp*(T2i-T1)) #Actual compressor input in kcal/kg of air
ke = (v**2/(2*9.81*427)) #Kinetic energy in gas leaving the exhaust annulus in kcal/kg
dT34 = (ci+ke)/((x/100)*Cp) #Change in temperature in K
r = 1/(1-(dT34/T3))**(g/(g-1)) #Ratio of pressures
p4 = (r/p2) #Pressure in kg/cm**2
#Output
print 'The pressure of the gases in the turbine exhaust annulus is %3.1f kg/cm**2'%(p4)
```

In [23]:

```
import math
#Input data
p = [1.,5] #Pressures in atm
T1 = 288 #Temperature in K
T3 = 650+273 #Temperature in K
er = 0.85 #Efficiency ratio
x = 0.72 #Effectiveness of heat exchanger
Cp = 0.24 #Specific heat at constant pressure in kJ/kg.K
g = 1.4 #Ratio of specific heats
#Calculations
T2 = (T1*(p[1]/p[0])**((g-1)/g)) #Temperature in K
T2i = (T1+((T2-T1)/er)) #Temperature in K
T4 = (T3/(p[1]/p[0])**((g-1)/g)) #Temperature in K
T4i = (T3-(er*(T3-T4))) #Temperature in K
Tc = ((x*(T4i-T2i))+T2i) #Temperature in K
W = ((Cp*((T3-T4i)-(T2i-T1)))) #Workdone in kcal/kg
q = (Cp*(T3-Tc)) #Heat supplied in kcal/kg
n = (W/q)*100 #Efficiency in percent
#Output
print 'The heat efficiency of the plant is %3.1f percent'%(n)
```

In [24]:

```
import math
#Input data
T1 = 15.+273 #Inlet temperature of air in K
p1 = 1.03 #Inlet pressure of air in kg/cm**2
rp = 5. #Pressure ratio
T3 = 815.+273 #Temperature of air entering the turbine in K
nc = 0.83 #Adiabatic efficiency of the compressor
nt = 0.92 #Internal engine efficiency of the turbine
nr = 0.65 #Effectiveness of regenerator
p2 = 2.45 #Pressure in kg/cm**2
T6 = T1 #Temperature in K
T9 = T3 #Temperature in K
Cp = 0.24 #Specific heat at constant pressure in kJ/kg.K
g = 1.4 #Ratio of specific heat
#Calculations
T2 = (T1*rp**((g-1)/g)) #Temperature in K
T4 = (T3/rp**((g-1)/g)) #Temperature in K
Wt = (Cp*(T3-T4)) #Isentropic work done in the turbine in kcal/kg of air
Wc = (Cp*(T2-T1)) #Isentropic work done in the compressor in kcal/kg of air
Wr = (Wt/Wc) #Work ratio
qa = (Cp*(T3-T2)) #Heat added in kcal/kg of air
nth = ((Wt-Wc)/qa)*100 #Thermal efficiency in percent
T2i = (T1+((T2-T1)/nc)) #Temperature in K
T4i = (T3-(nt*(T3-T4))) #Temperature in K
Wti = (Cp*(T3-T4i)) #work done in the turbine in kcal/kg of air
Wci = (Cp*(T2i-T1)) #work done in the compressor in kcal/kg of air
Wri = (Wti/Wci) #Work ratio
qai = (Cp*(T3-T2i)) #Heat added in kcal/kg of air
nthi = ((Wti-Wci)/qai)*100 #Thermal efficiency in percent
T2ii = (T2i+((T4i-T2i)*nr)) #Temperature in K
qaii = (Cp*(T3-T2ii)) #Heat added in kcal/kg of air
nthii = ((Wti-Wci)/qaii)*100 #Thermal efficiency in percent
T5 = (T1*(p2/p1)**((g-1)/g)) #Temperature in K
T5i = (T1+((T5-T1)/nc)) #Temperature in K
T7 = (T1*((rp*p1)/p2)**((g-1)/g)) #Temperature in K
T7i = (T6+((T7-T6)/nc)) #Temperature in K
T7ii = (T7i+((T4i-T7i)*nr)) #Temperature in K
Wcomp = (Cp*((T5i-T1)+(T7i-T6))) #Compressor work in kcal/kg of air
Wratio = (Wti/Wcomp) #Work ratio
qaa = (Cp*(T3-T7ii)) #Heat added in kcal/kg of air
nthe = ((Wti-Wcomp)/qaa)*100 #Thermal efficiency in percent
T8 = (T3*(p2/(rp*p1))**((g-1)/g)) #Temperature in K
T8i = (T3-((T3-T8)*nt)) #Temperature in K
T10 = (T9/(p2/p1)**((g-1)/g)) #Temperature in K
T10i = (T9-((T9-T10)*nt)) #Temperature in K
T2iii = (T2i+((T10i-T2i)*nr)) #Temperature in K
Wturb = (Cp*((T3-T8i)+(T3-T10i))) #Compressor work in kcal/kg of air
Wratioi = (Wturb/Wci) #Work ratio
qaai = (Cp*((T3-T2iii)+(T9-T8i))) #Heat added in kcal/kg of air
nthei = ((Wturb-Wci)/qaai)*100 #Thermal efficiency in percent
T7iii = (T7i+((T10i-T7i)*nr)) #Temperature in K
Wratioii = (Wturb/Wcomp) #Work ratio
qaaii = (Cp*((T3-T7iii)+(T9-T8i))) #Heat added in kcal/kg of air
ntheii = ((Wturb-Wcomp)/qaaii)*100 #Thermal efficiency in percent
#Output
print 'Condition Work ratio Thermal efficiencyin percent) \
\na) %3.3f %3.1f \
\nb) %3.2f %3.1f \
\nc) %3.2f %3.1f \
\nd) %3.2f %3.1f \
\ne) %3.3f %3.1f \
\nf) %3.3f %3.1f'%(Wr,nth,Wri,nthi,Wri,nthii,Wratio,nthe,Wratioi,nthei,Wratioii,ntheii)
```

In [25]:

```
import math
#Input data
p = [1.,9.] #Pressures in ata
T = [25.+273,1250.+273] #Minimum and maximum temperatures in K
n = 0.83 #Compressor and turbine efficiencies
Cp = 0.24 #Specific heat at constant pressure in kJ/kg.K
g = 1.4 #Ratio of specific heats
x = 0.65 #Cycle with 65% regeneration
#Calculations
#(a)Without regeneration
ip = math.sqrt(p[0]*p[1]) #Intermediate pressure in ata
T2 = (T[0]*(ip/p[0])**((g-1)/g)) #Temperature in K
T3 = (T[0]+((T2-T[0])/n)) #Temperature in K
T4 = T[0] #Temperature in K
T5 = T2 #Temperature in K
T6 = T3 #Temperature in K
T7 = T[1] #Temperature in K
T8 = T7/(ip/p[0])**((g-1)/g) #Temperature in K
T9 = (T7-((T7-T8)*n)) #Temperature in K
T10 = T7 #Temperature in K
T11 = T8 #Temperature in K
T12 = T9 #Temperature in K
Wc = (2*Cp*(T3-T[0])) #Work of compression in kcal/kg of air
We = (2*Cp*(T7-T8)) #Work of expansion in kcal/kg of air
NW = (We-Wc) #Net output in kcal/kg of air
qi = (Cp*((T7-T6)+(T10-T9))) #Heat input in kcal/kg of air
nth = (NW/qi)*100 #Thermal efficiency in percent
#(b)Cycle efficiency with 65% regeneration
Tg = (T6+(x*(T12-T6))) #Temperature in K
q = (Cp*((T7-Tg)+(T10-T9))) #Heat input in kcal/kg of air
nthi = (NW/q)*100 #Thermal efficiency in percent
#(c)Cycle efficiency with ideal regeneration
Eg = T12 #Temperature in K
qa = (2*Cp*(T7-Eg)) #Heat added in kcal/kg of air
nthii = (NW/qa)*100 #Thermal efficiency in percent
#Output
print 'a)Cycle efficiency without regeneration is %3.1f percent \
\nb)Cycle efficiency with 65 percent regeneration is %3.1f percent \
\nc)Cycle efficiency with ideal regeneration is %3.0f percent'%(nth,nthi,nthii)
```

In [26]:

```
import math
#Input data
p1 = 1. #Inlet pressure of compressor in atm
T1 = 27.+273 #Inle temperature of compressor in K
ic = 0.8 #Isentropic efficiency of compressor
ma = 20.5 #Mass flow rate of air in kg/sec
T3 = 650.+273 #Inlet temperatures of both turbines in K
p2 = 5. #Inlet pressure of turbine in atm
it = 0.92 #Internal engine efficiency for both the turbines
CV = 10000. #Calorific value in kcal/kg
Cpa = 0.24 #Specific heat at constant pressure of air in kJ/kg.K
ga = 1.4 #Ratio of specific heats for air
Cpg = 0.276 #Specific heat at constant pressure of gas in kJ/kg.K
gs = 1.33 #Ratio of specific heats for gas
#Calculations
T2 = (T1*(p2/p1)**((ga-1)/ga)) #Temperature in K
T2i = (T1+((T2-T1)/ic)) #Temperature in K
T4 = (T3/(p2/p1)**((gs-1)/gs)) #Temperature in K
T4i = (T3-((T3-T4)*it)) #Temperature in K
Wc = (Cpa*(T2i-T1)) #Work of compression in kcal/kg of air
We = (Cpg*(T3-T4i)) #Work of expansion in kcal/kg of air
mx = (Wc/We) #Gas required per kg of air compressed in kg
F = ((Cpa*T2i)-(Cpg*T3))/(Cpg*T3-CV) #Amount of fuel supplied per kg of air in kg
Wg = 1+F #Weight of gases per kg of air in kg
Wt = (Wg-mx) #Gases supplied to turbine in kg
Ot = ((Wt*ma*427*We)/75)
#Output of turbine in H.P
nth = ((Wt*We)/(CV*F))*100 #Thermal efficiency in percent
#Output
print 'Output is %3.0f H.P \
\nThermal efficiency is %3.2f percent'%(Ot,nth)
```

In [27]:

```
import math
#Input data
q = 2250. #Heat supplied per sec in kcal
#Input data from Fig. 25.34 from page no. 652
T1 = 200. #Temperature in K
T2 = 100. #Temperature in K
T3 = 625. #Temperature in K
T4 = 550. #Temperature in K
Cp = 0.24 #Specific heat at constant pressure in kJ/kg.K
g = 1.4 #Ratio of specific heats
#Calculations
Wc = (2*Cp*(T1-T2)) #Work of compression in kcal/kg of air
We = (2*Cp*(T3-T4)) #Work of expansion in kcal/kg of air
NW = (Wc-We) #Net output in kcal/kg of air
qi = (2*Cp*(T3-T4)) #Heat input in kcal/kg of air
nth = (NW/qi)*100 #Thermal efficiency in percent
rf = (q/qi) #Rate of flow of working substance in kg/sec
O = (NW*rf*427)/75 #Total output in H.P
#Output
print 'Output is %3.0f H.P \
\nThermal efficiency is %3.1f percent'%(O,nth)
```

In [29]:

```
import math
#Input data
p = [5.,20.] #Pressure limits in atm
T3 = 650.+273 #Temperature in K
T1 = 60.+273 #Temperature in K
T2 = T1 #Temperature in K
Cp = 0.24 #Specific heat at constant pressure in kJ/kg.K
g = 1.4 #Ratio of specific heats
R = 29.27 #Characteristic gas constant in kg.m/kg.K
J = 427. #Mechanical equivalent of heat in kg.m/kcal
#Calculations
T4 = T3/(p[1]/p[0])**((g-1)/g) #Temperature in K
Wc = ((R*T1)/J)*math.log(p[1]/p[0]) #Compression work in kcal/kg
qs = (Cp*(T3-T2)) #Heat supplied at constant pressure in kcal/kg
qre = (Cp*(T4-T1)) #Heat ejected during process 4-1 in kcal/kg
nth = ((qs-Wc-qre)/(qs-qre))*100 #Thermal efficiency in percent
nc = ((T3-T1)/T3)*100 #Carnot efficiency in percent
r = (nth/nc)*100 #Ratio of air standard efficiency to carnot efficiency in percent
#Output
print 'a) air standard efficiency of the cycle is %3.1f percent \
\nb) carnot efficiency is %3.0f percent \
\nc) Ratio of air standard efficiency to carnot efficiency is %3.1f percent'%(nth,nc,r)
```