In [2]:

```
import math
#Input data
r = 7.5 #Compression ratio
#Data from combustion chart
p = [1,15.1,26.95,1.95] #Pressure of air fuel mixture in kg/cm**2
T = [60,460,1150,435] #Temperature of air fuel mixture in K
V = [16.98,2.264,2.264,16.98] #Volume in m**3/kg
U = [17,78.8,212,80] #Internal energy in kcal/kg
S = [0.07,0.07,0.22,0.22] #Entropy in kcal/kg.degree C
g = 1.4 #Ratio of specific heats
#Calculations
n = (((U[2]-U[3])-(U[1]-U[0]))/(U[2]-U[1]))*100 #Thermal efficiency in percent
na = (1-(1/r)**(g-1))*100 #Air standard efficiency in percent
#Output
print 'Thermal efficiency is %3.1f percent \
\nAir standard efficiency is %3.1f percent'%(n,na)
```

In [4]:

```
import math
#Input data
#Data from combustion chart
p = [1,33,33,1] #Pressure of air fuel mixture in kg/cm**2
T = [65,600,1450,725] #Temperature of air fuel mixture in K
V = [16,1.23,3.45,16] #Volume in m**3/kg
U = [11.8,110,295,140] #Internal energy in kcal/kg
H = [22.7,150,395,225] #Enthalpy in kcal/kg
S = [0.068,0.068,0.264,0.264] #Entropy in kcal/kg.degree C
#Calculations
r = (V[0]/V[1]) #Compression ratio
q = (H[2]-H[1]) #Heat supplied in kcal/kg
qre = (U[3]-U[0]) #Heat rejected in kcal/kg
nt = ((q-qre)/q)*100 #Thermal efficiency in percent
#Output
print 'a)Compression ratio is %3.0f \
\nb) Heat supplied to the cycle is %3.0f kcal/kg \
\nc) Heat rejected by the cycle is %3.2f kcal/kg \
\nd) Thermal efficiency is %3.2f percent'%(r,q,qre,nt)
```

In [5]:

```
import math
#Input data
#Data from combustion chart
p = [1,51.5,77.25,77.25,3.75] #Pressure of air fuel mixture in kg/cm**2
T = [16,1,1,1.5,16] #Temperature of air fuel mixture in K
V = [65,745,1400,2200,1030] #Volume in m**3/kg
U = [14.7,135,275,475,197] #Internal energy in kcal/kg
H = [21.9,85,372,625,280] #Enthalpy in kcal/kg
S = [0.068,0.068,0.19,0.32,0.32] #Entropy in kcal/kg.degree C
#Calculations
nth = (((U[2]-U[1])+(H[3]-H[2])-(U[4]-U[0]))/((U[2]-U[1])+(H[3]-H[2])))*100 #Thermal efficiency in percent
#Output
print 'Thermal efficiency is %3.2f percent'%(nth)
```