In [2]:

```
from __future__ import division
from math import log,pi
#Variable Declaration:
p1 = 1*10**2 #Pressure of air entering(in kPa):
n = 1.2 #Index of compression:
p2 = 12*10**2 #Delivery pressure(in kPa):
N = 240 #Speed(in rpm):
T1 = 20+273 #Initial temperature(in K):
r1 = 1.8 #L/D ratio:
nm = 0.88 #Mechanical efficiency:
V1 = 1 #m**3
R = 0.287#Gas constant(in kJ/kg.K):
#Calculations:
m = p1*V1/(R*T1) Mass of air delivered per minute:
T2 = T1*(p2/p1)**((n-1)/n)#Temperature at the end of compression(in K)
W = (n/(n-1))*m*R*(T2-T1)#Work required during compression process(in kJ/min):
Whp = W/60/0.7457 #Work required during compression process(hp):
C = Whp/nm#Capacity of drive required to run compressor(in hp):
Wiso = m*R*T1*log(p2/p1) #Isothermal work required for same compression(in kJ/min):
niso = Wiso/W*100#Isothermal efficiency:
v = 1/N#Volume of aur entering per cycle:
D = (v*4/(pi*r1))**(1/3)*100#Bore diameter(in cm):
L = r1*D#Stroke length(in cm):
#Results:
print "Isothermal efficiency: ",round(niso,2),"%"
print "Cylinder dimension, D: ",round(D,2),"cm"
print " L: ",round(L,3),"cm"
print "Rating of drive: ",round(C,2),"hp"
```

In [4]:

```
from __future__ import division
from math import pi,log
#Variable Declaration:
r = 7 #Compression ratio:
r1 = 1.2 #L/D ratio:
N = 240 #Speed(in rpm):
p1 = 0.97 #Pressure(in bar):
T1 = 35+273 #Temperature(in K):
V = 20 #Volume(in m**3):
V3 = 0.05
V1 = 1.05
R = 0.287 #Gas constant(in kJ/kg.K):
n = 1.25 #Index of compression:
#Calculations:
p2 = r*p1
m = 10**2*V/(R*300) #Mass of air delivered(in kg/min):
T2 = T1*r**((n-1)/n) #Temperature at state 2(in K):
V4 = V3*r**(1/n) #Volume at state 4(in m**3):
nv = p1*300/T1*(V1-V4)*100 #Volumetric efficiency:
Vs = V/(4*N) #Swept volume(in m**3/cycle):
D = (Vs*4/(pi*r1))**(1/3) #Bore(in m):
L = r1*D #Stroke(in m):
W = n/(n-1)*m*R*(T2-T1)/(60*0.7457) #Work required in reciprocating compressor(in hp):
Wiso = m*R*T1*log(r)/(60*0.7457) #Work done in isothermal process(in hp):
ni = Wiso/W*100 #Isothermal efficiency:
#Results:
print "Volumetric efficiency: ",round(nv,2),"%"
print "Bore: ",round(D*100,2),"cm"
print "Stroke: ",round(L*100,2),"cm"
print "Isothermal efficiency: ",round(ni,2),"%"
```

In [6]:

```
from __future__ import division
from math import sqrt
#Variable Declaration:
p = 10**2 #Atmospheric pressure(in kPa):
p1 = 1
p3 = 8
Ta = 300 #Temperature(in K):
Va = 4
R = 0.287 #Gas constant(in kJ/kg.K):
n = 1.2 #Index of compression:
#Calculations:
T1 = Ta
T2a = 273+30
V1 = Va
m = p*Va/(R*Ta) #Mass of air compressed(in kg/min):
Wi = n/(n-1)*p1*10**2*Va*((p3/p1)**((n-1)/n)-1)/(60*0.7457)#Work input(in hp):
p2 = sqrt(p1*p3) #Optimum intercooling pressure(in bar):
Wii = 2*n/(n-1)*p1*10**2*Va*((p3/p1)**((n-1)/(2*n))-1)/(60*0.7457)#Work input for 2nd stage compression(in hp):
Wii = 20.29
V2a = p1*V1/T1*T2a/p2 #Volume of air inlet of HP cylinder(in m**3/min):
W2 = n/(n-1)*p1*10**2*V1*((p2/p1)**((n-1)/n)-1)/(60*0.7457)+n/(n-1)*p2*10**2*V2a*((p3/p2)**((n-1)/n)-1)/(60*0.7457) #Work required(in hp):
W2 = 20.42
ps = (Wi-Wii)/Wi*100 #Percentage saving in work:
pe = (W2-Wii)/W2*100 #% excess work to be done:
#Results:
print "Percentage saving in work: ",round(ps,2),"%"
print "Percentage excess work to be done: ",round(pe,3),"%"
```

In [9]:

```
from __future__ import division
#Variable Declaration:
m = 2 #Rate at which air is delivered(in m**3/min):
p1 = 1 #Initial pressure(in bar):
T1 = 300 #K
p = 150 #bar
n = 1.25 #Polytropic index of compression:
p2 = 3.5
p3 = 12.25
p4 = 42.87
R = 0.287 #Gas constant(in kJ/kg.K):
#Calculations:
T = T1*(p2/p1)**((n-1)/n) #Temperature at the end of fourth stage(in K):
m = p*10**2*2/(R*T) #Mass of air(in kg):
W = n/(n-1)*m*R*T1*((p2/p1)**((n-1)/n)-1)*4/(60*0.7457) #Work required(in kW):
print "Intermediate pressure: ",round(p2,2),"bar",round(p3,2),"bar",round(p4,2),"bar respectively"
print "Work input: ",round(W,2),"hp"
```

In [11]:

```
from __future__ import division
#Variable Declaration:
p1 = 1 #Pressures(in bar):
p2 = 4
p3 = 16
n = 1.3 #Index of compression:
R = 0.287 #Gas constant(in kJ/kg.K):
T1 = 17+273 #Temperature(in K):
nv = 0.90 #Volumetric efficiency:
Dhp = 0.06 #Bore diameters(in m):
Dlp = 0.12
#Calculations:
W = n/(n-1)*R*T1*((p2/p1)**((n-1)/n)+(p3/p2)**((n-1)/n)-2) #Work required(in kJ/kg):
#Results:
print "Work: ",round(W,2),"kJ/kg"
```

In [15]:

```
from __future__ import division
from math import sqrt,log
#Variable Declaration:
N = 200 #Speed(in rpm):
m = 4 #Mass flow rate(in kg/min):
p1 = 1 #Pressure(in bar):
p6 = 25
T1 = 17+273 #Temperatures(in K):
Clp = 0.04 #Clearance volumes:
Chp = 0.05
n = 1.25 #Index of compression:
R = 0.287 #Gas constant(in kJ/kg.K):
Cp = 1.0032 #Specific heat(in kJ/kg.K):
#Calculations:
T5 = T1
r = sqrt(p6/p1) #Pressure ratio:
T2 = T1*r**((n-1)/n) #Temperature at state 2(in K):
T6 = T5*r**((n-1)/n) #Temperature at state 6(in K):
W = 2*n/(n-1)*m*R*T1*(r**((n-1)/n)-1) #Actual compression work requirement(in kJ/min):
Wi = m*R*T1*log(p6/p1) #Work required if process is isothermal(in kJ/min):
ni = Wi/W #Isothermal efficiency:
Vf = m*R*T1/(p1*10**2)#Free air delivered(in m**3/min):
Q = W/2-m*Cp*(T2-T1) #Heat transferred in HP & LP cylinder(in kJ/min):
nvhp = 1+Chp-Chp*r**(1/n) #Volumetric efficiency of HP cylinder:
nvlp = 1+Clp-Clp*r**(1/n) #Volumetric efficiency of LP cylinder:
Vshp = Vf/(r*N*nvhp) #Stroke volume of HP cylinder(in m**3):
Vchp = Chp*Vshp #Clearance volume Of HP cylinder(in m**3):
Vthp = Vshp+Vchp #Total HP cylinder volume(in m**3):
Vslp = Vf/(N*nvlp) #Stroke volume of LP cylinder(in m**3):
Vclp = Clp*Vslp #Clearance volume of LP cylinder(in m**3):
Vtlp = Vslp+Vclp #Total LP cylinder volume(in m**3):
#Results:
print "Power required: ",round(W/(60*0.7457),2),"hp"
print "Isothermal efficiency: ",round(ni*100,2),"%"
print "Free air delivered: ",round(Vf,2),"m^3/min"
print "Heat transferred in HP & LP cylinder: ",round(Q,2),"kJ/min"
print "HP cylinder volume: ",round(Vthp*10**3,3)," x 10^-3 m^3"
print "LP cylinder volume: ",round(Vtlp,6),"m**3"
```

In [17]:

```
from __future__ import division
from math import sqrt,pi
#Variable Declaration:
N = 200 #Speed(in rpm):
n = 1.2 #Index of compression:
R = 0.287 #Gas constant(in kJ/kg.K):
Cp = 1.0032 #Specific heat(in kJ/kg.K):
D = 0.30 #Bore(in m):
L = 0.40 #Stroke(in m):
C = 0.05 #Clearance volume:
p1 = 1 #Pressure(in bar):
p5 = 2.9
p6 = 9
T1 = 25+273 #Temperatures(in K):
#Calculations:
T5 = T1
p2 = sqrt(p6/p1) #Optimum intercooling pressure(in bar):
Vlp = pi*D**2/4*L*N*2 #Volume of LP cylinder(in m**3/min):
nvlp = 1+C-C*(p2/p1)**(1/n) #Volumetric efficiency:
V1 = Vlp*nvlp #Volume of air inhaled in LP stage(in m**3/min):
m = p1*10**2*V1/(R*T1) #Mass of air per minute(in kg/min):
T2 = T1*(p2/p1)**((n-1)/n) #Temperature after compression(in K):
V5 = m*R*T5/(p5*10**2) #Volume of air going into HP cylinder(in m**3/min):
nvhp = nvlp
Vhp = V5/nvhp #Volume of HP cylinder(in m**3/min):
Dhp = sqrt(Vhp*4/(pi*L*2*N)) #Diameter of bore(in m):
Q = m*Cp*(T2-T5) #Heat rejected in intercooler(in kJ/min):
T6 = T5*(p6/p5)**((n-1)/n) #Temperature at state 6(in K):
Whp = n/(n-1)*m*R*(T6-T5)/(60*0.7457)#Work input required for HP stage(in kJ/min):
#Results:
print "Heat rejected in intercooler: ",round(Q,2),"kJ/min"
print "Bore of HP cylinder: ",round(Dhp*100,2),"cm"
print "Horse power required to drive HP stage: ",round(Whp,2),"hp"
```

In [20]:

```
from __future__ import division
from math import pi, sqrt
#Variable Declaration:
h = 75.6 #Barometer reading(in cm):
d = 0.013591 #Density of mercury(in kg/cm**3):
d1 = 15*10**(-3) #Diameter of orifice(in m):
r1 = 0.65 #Coefficient of discharge:
g = 9.81 #Acceleration due to gravity(in m/s**2):
T = 25+273 #Atmospheric temperature(in K):
h1 = 13 #Manometer reading(in cm):
R = 0.287
#Calculations:
A = pi*d1**2/4 #Cross-sectional area of orifice(in m**2):
p = h*d*g*10 #Atmospheric pressure(in kPa):
v = (R*T)/p #Specific volume at atmospheric conditions(in m**3/kg):
da = 1/v #Density of air(in kg/m**3):
pd = h1*d*g*10 #Pressure difference across orifice(in kPa):
ha = pd*10**3/(da*g) #Height of air column(in m):
f = r1*A*sqrt(2*g*ha)*60 #Free air delivery(in m**3/min):
#Results:
print "Free air delivery: ",round(f,3),"m**3/min"
```

In [22]:

```
from __future__ import division
from math import pi
#Variable Declaration:
D = 0.10 #Bore(in m):
L = 0.08 #Stroke(in m):
N = 500 #Speed(in rpm):
g = 9.81 #Acceleration due to gravity(in m/s**2):
T = 27+273 #Atmospheric temperature(in K):
r = 0.30 #Radius of arm of spring balance(in m):
nm = 0.90 #Mechanical efficiency:
f = 15/60 #Free air delivery(in m**3/min):
#Calculations:
V = pi*D**2*L/4 #Volume of cylinder(in m**3):
nv = f/(V*N)*100 #Volumetric efficiency:
W = 2*pi*N*100*g*r*10**(-3)/(60*0.7457) #Shaft output(in hp):
W1 = W/f #Shaft output per m**3 of free air per min:
#Results:
print "Volumetric efficiency: ",round(nv,2),"%"
print "Shaft output per m**3 of free air: ",round(W1,2),"hp per m**3 of free air per minute"
```

In [24]:

```
from __future__ import division
from math import log
#Variable Declaration:
p2 = 180 #Pressures(in bar):
p1 = 1
T1 = 300 #Temperatures(in K):
T2 = 273+150
n = 1.25 #Index of polytropic compression:
#Calculations:
i = (n-1)/n*log(p2/p1)/log(T2/T1) #Number of stages:
#Results:
print "Number of stages: ",round(i)
```

In [27]:

```
from __future__ import division
from math import pi
#Variable Declaration:
p1 = 1 #Pressures(in bar):
p10 = 20
T1 = 300 #Temperatures(in K):
C = 0.04 #Clearance:
D = 0.30 #Bore(in m):
L = 0.20 #Stroke(in m):
n = 1.25 #Index of compression:
R = 0.287 #Gas constant(in kJ/kg.K):
#Calculations:
T5 = T1
T9 = T1
p2 = p1*(20)**(1/3) #Pressure at stage 2(in bar):
p6 = p10/(20**(1/3))
nvlp = 1+C-C*(p2/p1)**(1/n) #Volumetric efficiency of LP stage:
Vs = pi*D**2/4*L #LP swept volume(in m**3):
Vsa = nvlp*Vs #Effective swept volume(in m**3):
T10 = T9*(p10/p6)**((n-1)/n) #Temperature of air delivered(in K):
Vd = p1/p10*Vsa*T10/T1 #Volume of air delivered(in m**3):
W = 3*(n/(n-1))*R*T1*((p2/p1)**((n-1)/n)-1) #Total work done(in kJ/kg of air):
#Results:
print "Intermediate pressure: ",round(p2,3),"bar",round(p6,3),"bar"
print "Effective swept volume of LP cylinder: ",round(Vsa,5),"m**3"
print "Temperature of air delivered: ",round(T10,2),"K"
print "Volume of air delivered: ",round(Vd*10**4,4)," x 10^-4 m**3"
print "Work done: ",round(W,2),"kJ/kg of air"
```

In [29]:

```
from __future__ import division
from math import log
#Variable Declaration:
p1 = 1 #Pressures(in bar):
p2 = 6
p6 = 30
T6 = 273+150 #Temperatures(in K):
T5 = 273+35
T1 = 300
Clp = 0.05 #Clearance volumes:
Chp = 0.07
m = 2 #Mass flow rate(in kg/s):
R = 0.287 #Gas constant(in kJ/kg.K):
Cp = 1.0032 #Specific heat(in kJ/kg.K):
Cv = 0.72
r = 1.4 #Adiabatic index of compression:
#Calculations:
p5 = p2
n = 1/(1-log(T6/T5)/log(p6/p5)) #Index of compression:
nvlp = 1+Clp-Clp*(p2/p1)**(1/n) #Volumetric efficiency of LP cylinder:
nvhp = 1+Chp-Chp*(p6/p5)**(1/n) #Volumetric efficiency of HP cylinder:
Vslp = m*R*T1*60/(p1*10**2*nvlp) #Swept volume of LP cylinder(in m**3/min):
Vshp = m*R*T5*60/(p2*10**2*nvhp) #Swept volume of HP cylinder(in m**3/min):
T2 = T1*(p2/p1)**((n-1)/n) #Temperature at state 2(in K):
Q = m*Cp*(T2-T5)#Cooling required in intercooler(in kW):
W = n/(n-1)*m*R*((T1*((p2/p1)**((n-1)/n)-1))+(T5*((p6/p5)**((n-1)/n)-1)))#Work input required(in kW):
Qlp = m*(r-n)/(n-1)*Cv*(T2-T1)#Heat transferred in LP cylinder(in kW):
Qhp = m*(r-n)/(n-1)*Cv*(T6-T5) #Heat transferred in HP cylinder(in kW):
#Results:
print "Swept volume of LP cylinder: ",round(Vslp,2),"m**3/min"
print "Swept volume of HP cylinder: ",round(Vshp,2),"m**3/min"
print "Heat picked up in the intercooler: ",round(Q,2),"kW"
print "Total work required: ",round(W,2),"kW"
print "Amount of cooling required in LP cylinder: ",round(Qlp,2),"kW"
print "Amount of cooling required in HP cylinder: ",round(Qhp,2),"kW"
```

In [31]:

```
from __future__ import division
#Variable Declaration:
p2 = 2 #Pressures(in bar):
p1 = 1
V1 = 0.5 #Volume(in m**3):
r = 1.4 #Adiabatic index of compression:
#Calculations:
Wr = (p2-p1)*10**2*V1 #IP required(in kW):
Wi = r/(r-1)*p1*10**2*V1*((p2/p1)**((r-1)/r)-1)#IP when isentropic compression occurs(in kW):
ni = Wi/Wr*100 #Isentropic efficiency:
#Results:
print "Indicated power of roots blower: ",round(Wr/0.7457,2),"hp"
print "Isentropic efficiency: ",round(ni,2),"%"
```

In [34]:

```
from __future__ import division
#Variable Declaration:
V1 = 0.6 #Volume flow rate(in m**3/kg):
p1 = 1 #Pressures(in bar):
p2a = 2.3
r = 1.4
r1 = 0.7#Ratio of V1/V2:
#Calculations:
p2 = p1*(1/r1)**r #Pressure at state 2(in bar):
Wv = (r/(r-1)*p1*10**2*V1*((p2/p1)**((r-1)/r)-1)+(p2a-p2)*10**2*V1*r1)/0.7457#IP required for vaned compressor(in hp):
Wi = (r/(r-1)*p1*10**2*V1*((p2a/p1)**((r-1)/r)-1))/0.7457 #Power requirement when compression occurs isentropically(in hp):
ni = Wi/Wv*100 #Isentropic efficiency:
#Results:
print "Indicated power required: ",round(Wv,3),"hp"
print "Isentropic efficiency: ",round(ni,2),"%"
```

In [36]:

```
from __future__ import division
#Variable Declaration:
T0 = 300 #Temperature(in K):
V1 = 50 #Velocity(in m/s):
m = 18 #Mass flow rate(in kg/min):
Cp = 1.0032 #Specifc heat(in kJ/kg.K):
nm = 0.90 #Mechanical efficiency:
ni = 0.75 #Isentropic efficiency:
r1 = 4 #Pressure ratio:
r = 1.4 #Adiabatic index of compression:
#Calculations:
T1 = T0+V1**2/(2*Cp*10**3) #Stagnation temperature(in K):
T2a = T1*r1**((r-1)/r)
T2 = (T2a-T1)/ni+T1
BP = m*Cp*(T2-T1)/(60*nm*0.7457) #Brake power required(in hp):
#Results:
print "Total head temperature at exit: ",round(T2,2),"K"
print "Brake power required: ",round(BP,2),"hp"
```

In [39]:

```
from __future__ import division
#Variable Declaration:
V = 0.015 #Piston printlacement per revolution(in m**3/rev):
N = 500 #Speed(in rpm):
C = 0.05 #Clearance:
p2 = 6 #Pressures(in bar):
n = 1.3 #Index of compression:
R = 0.287 #Gas constant(in kJ/kg.K):
T1 = 20+273 #Temperature(in K):
r = 1.4 #Adiabatic index of compression:
Cv = 0.718 #Value of Cv(in kJ/kg.K):
#Calculations:
p1 = 1
nv = 1+C-C*(p2/p1)**(1/n) #Volumetric efficiency:
Vs = V*2*N #Swept volume(in m**3/min):
V1 = Vs*0.85 #Actual air inhaled(in m**3/min):
m = p1*10**2*V1/(R*T1) #Mass of air entering(in kg/min):
P = n/(n-1)*p1*10**2*V1*((p2/p1)**((n-1)/n)-1)#Power required(in kJ/min):
T2 = 298*(p2/p1)**((n-1)/n) #Temperature at state 2(in K):
Q = m*Cv*(r-n)/(n-1)*(T2-T1) #Heat transferred during compression(in kJ/min):
#Results:
print "Volumetric efficiency: ",round(nv*100,2),"%"
print "Power required: ",round(P,2),"kJ/min"
print "Heat rejected during compression: ",round(Q,2),"kJ/min"
```