In [1]:

```
# Variables
D = 0.2; #Cylinder diameter in m
L = 0.3; #Cylinder Stroke in m
P1 = 1.; #Pressure at entry in bar
T1 = 300.; #Temperature at entry in K
P2 = 8.; #Pressure at exit in bar
n = 1.25; #Adiabatic gas constant
N = 100.; #Speed in rpm
R = 287.; #Universal gas constant in J/kg-K
# Calculations
x = (n-1)/n; #Ratio
V1 = (3.147*L*(D**2))/4; #Volume of cylinder in m**3/cycle
W = (P1*(10**5)*V1*(((P2/P1)**x)-1))/x; #Work done in J/cycle
Pc = (W*100)/(60*1000); #Indicated power of compressor in kW
m = (P1*(10**5)*V1)/(R*T1); #Mass of air delivered in kg/cycle
md = m*N; #Mass delivered per minute in kg
T2 = T1*((P2/P1)**x); #Temperature of air delivered in K
# Results
print 'Indicated power of compressor is %3.2f kW \
\nMass of air delivered by compressor per minute is %3.2f kg \
\nTemperature of air delivered is %3.1fK'%(Pc,md,T2)
```

In [2]:

```
import math
# Variables
IP = 37.; #Indicated power in kW
P1 = 0.98; #Pressure at entry in bar
T1 = 288.; #Temperature at entry in K
P2 = 5.8; #Pressure at exit in bar
n = 1.2; #Adiabatic gas constant
N = 100.; #Speed in rpm
Ps = 151.5; #Piston speed in m/min
a = 2.; #For double acting compressor
# Calculations
L = Ps/(2*N); #Stroke length in m
x = (n-1)/n; #Ratio
r = (3.147*L)/4; #Ratio of volume to bore
D = math.sqrt((IP*1000*60*x)/(N*a*r*P1*(10**5)*(((P2/P1)**x)-1))); #Cylinder diameter in m
# Results
print 'Stroke length of cylinder is %3.4f m \
\nCylinder diameter is %3.4f m'%(L,D)
```

In [3]:

```
import math
# Variables
IP = 11.; #Indicated power in kW
P1 = 1.; #Pressure at entry in bar
P2 = 7.; #Pressure at exit in bar
n = 1.2; #Adiabatic gas consmath.tant
Ps = 150.; #Piston speed in m/s
a = 2.; #For double acting compressor
r = 1.5; #Storke to bore ratio
# Calculations
x = (n-1)/n; #Ratio
y = 3.147/(4*(r**2)); #Ratio of volume to the cube of stroke
z = (P1*(10**2)*y*(((P2/P1)**x)-1))/x; #Ratio of workdone to the cube of stroke
L = (math.sqrt(IP/(z*Ps)))*1000; #Stroke in mm
D = (L/r); #Bore in mm
# Results
print 'Stroke length of cylinder is %3.0f mm \
\nBore diameter of cylinder is %3.0f mm'%(L,D)
```

In [2]:

```
# Variables
x = 0.05 # ratio
P1 = 1.; #Pressure at point 1 in bar
T1 = 310.; #Temperature at point 1 in K
n = 1.2; #Adiabatic gas constant
P2 = 7.; #Pressure at point 2 in bar
Pa = 1.01325; #Atmospheric pressure in bar
Ta = 288.; #Atmospheric temperature in K
# Calculations
V1 = 1+x; #Ratio of volume of air sucked to stroke volume
V4 = ((P2/P1)**(1/n))/20; #Ratio of volume delivered to stroke volume
DV = V1-V4; #Difference in volumes
nv1 = DV*100; #Volumetric efficiency
V = (P1*DV*Ta)/(T1*Pa); #Ratio of volumes referred to atmospheric conditions
nv2 = V*100; #Volumetric efficiency referred to atmospheric conditions
W = (n*0.287*T1*((P2/P1)**((n-1)/n)-1))/(n-1); #Work required in kJ/kg
# Results
print 'Volumetric efficiency is %3.1f percent \
\nVolumetric efficiency referred to atmospheric conditions is %3.1f percent \
\nWork required is %3.1f kJ/kg'%(nv1,nv2,W)
```

In [4]:

```
# Variables
D = 0.2; #Bore in m
L = 0.3; #Stroke in m
P1 = 1.; #Pressure at point 1 in bar
P2 = 7.; #Pressure at point 2 in bar
n = 1.25; #Adiabatic gas constant
lc = 0.015
# Calculations
V3 = (3.147*(D**2)*lc)/4.; #Clearance volume in m**3
Vs = (3.147*(D**2)*L)/4.; #Stoke volume in m**3
C = V3/Vs; #Clearance ratio
nv = (1+C-(C*((P2/P1)**(1/n))))*100; #Volumetric efficiency
DV = (nv*Vs)/100.; #Volume of air taken in (m**3)/stroke
# Results
print 'Theoretical volume of air taken in per stroke is %.2e m**3/stroke'%(DV)
```

In [5]:

```
import math
# Variables
D = 0.2; #Bore in m
L = 0.3; #Stroke in m
P1 = 1.; #Pressure at point 1 in bar
r = 0.05 # ratio
T1 = 293.; #Temperature at point 1 in K
P2 = 5.5; #Pressure at point 2 in bar
n = 1.3; #Adiabatic gas constant
N = 500.; #Speed of compressor in rpm
# Calculations
x = (n-1)/n; #Ratio
Vs = (3.147*L*(D**2))/4; #Stroke volume in m**3
Vc = r*Vs; #Clearance volume in m**3
V1 = Vc+Vs; #Volume at point 1 in m**3
V4 = Vc*((P2/P1)**(1/n)); #Volume at point 4 in m**3
EVs = V1-V4; #Effective swept volume in m**3
W = (P1*(10**5)*EVs*(((P2/P1)**x)-1))/x; #Work done in J/cycle
MEP = (W/Vs)/(10**5); #Mean effective pressure in bar
P = (W*N)/(60*1000); #Power required in kW
# Results
print 'Mean effective pressure is %3.2f bar \
\nPower required is %3.2f kW'%(MEP,P)
# rounding off error
```

In [12]:

```
import math
# Variables
D = 0.2; #Bore in m
L = 0.3; #Stroke in m
P1 = 97.; #Pressure at entry in kN/(m**2)
P4 = P1; #Pressure at point 4 in kN/(m**2)
T1 = 293.; #Temperature at point 1 in K
P2 = 550.; #Compression Pressure in kN/(m**2)
P3 = P2; #Pressure at point 3 in kN/(m**2)
n = 1.3; #Adiabatic gas constant
N = 500.; #Speed of compressor in rpm
Pa = 101.325; #Air pressure in kN/(m**2)
Ta = 288.; #Air temperature in K
# Calculations
x = (n-1)/n; #Ratio
DV = (3.147*L*(D**2))/4; #Difference in volumes in m**3
V3 = r*DV; #Clearance volume in m**3
V1 = V3+DV; #Volume at point 1 in m**3
V4 = V3*((P3/P4)**(1/n)); #Volume at point 4 in m**3
Vs = V1-V4; #Effective swept volume in m**3
EVs = Vs*N; #Effective swept volume per min
Va = (P1*EVs*Ta)/(Pa*T1); #Free air delivered in (m**3)/min
nV = ((V1-V4)/(V1-V3))*100; #Volumetric effciency
T2 = T1*((P2/P1)**x); #Air delivery temperature in K
t2 = T2-273; #Air delivery temperature in oC
W = (n*P1*(V1-V4)*(((P2/P1)**x)-1))*N/((n-1)*60); #Cycle power in kW
Wiso = P1*V1*(math.log(P2/P1)); #Isothermal workdone
niso = (Wiso/(4.33*0.493))*100; #Isothermal efficiency
# Results
print 'Free air delivered is %3.3f m**3/min \
\nVolumetric efficiency is %3.0f percent \
\nAir delivery temperature is %3.1f oC \
\nCycle power is %3.0f kW \
\nIsothermal efficiency is %3.1f percent'%(Va,nV,t2,W,round(niso,-1))
# rounding off error
```

In [13]:

```
import math
# Variables
Ve = 30.; #Volume of air entering compressor per hour in m**3
P1 = 1.; #Presure of air entering compressor in bar
N = 450.; #Speed in rpm
P2 = 6.5; #Pressure at point 2 in bar
nm = 0.8; #Mechanical efficiency
nv = 0.75; #Volumetric efficiency
niso = 0.76; #Isothermal efficiency
# Calculations
Vs = Ve/(nv*3600); #Swept volume per sec in (m**3)/s
V = (Vs*60)/N; #Swept volume per cycle in m**3
V1 = (Ve*60)/(3600*N); #Volume at point 1 in m**3
Wiso = P1*100*V1*math.log(P2/P1); #Isothermal workdone per cycle
Wact = Wiso/niso; #Actual workdone per cycle on air
MEP = (Wact/V)/100; #Mean effective pressure in bar
IP = (Wact*N)/60; #Indicated power in kW
BP = IP/nm; #Brake power in kW
# Results
print 'Mean effective pressure is %3.3f bar \
\nBrake power is %3.2f kW'%(MEP,BP)
# rounding off error
```

In [22]:

```
import math
# Variables
Va = 15.; #Volume of air in (m**3)/min
Pa = 1.01325; #Pressure of air in bar
Ta = 302.; #Air temperature in K
P1 = 0.985; #Pressure at point 1 in bar
r = 0.04 # ratio
T1 = 313.; #Temperature at point 1 in K
y = 1.3; #Ratio of stroke to bore diameter
N = 300.; #Speed in rpm
n = 1.3; #Adiabatic gas constant
P2 = 7.5; #Pressure at point 2 in bar
# Calculations
x=((P2/P1)**(1./n))-1;
a = x*r; #Ratio of volume at point 4 to swept volume
nv = 1-a; #Volumetric efficiency
V1 = (Pa*Va*T1)/(Ta*P1); #Volume at point 1 in (m**3)/min
Vs = V1/(nv*N*2); #Swept volume in m**3
D = ((Vs*4)/(math.pi*y))**(1./3); #Bore in m
L = y*D; #Stroke in m
# Results
print 'Cylinder bore in %3.3f m \
\nCylinder stroke %3.3f m'%(D,L)
# rounding off error
```

In [23]:

```
import math
# Variables
P1 = 0.98; #Pressure at point 1 in bar
P4 = P1; #Pressure at point 4 in bar
P2 = 7.; #Pressure at point 2 in bar
P3 = P2; #Pressure at point 3 in bar
n = 1.3; #Adiabatic gas consmath.tant
Ta = 300.; #Air temperature in K
Pa = 1.013; #Air pressure in bar
T1 = 313.; #Temperature at point 1 in K
Va = 15.; #Volume of air delivered in m**3
R = 0.287; #Universal gas constant in kJ/kg-K
c = 0.04
# Calculations
x = (n-1)/n; #Ratio
r = (P2/P1)**(1/n); #Ratio of volumes
a = r*c; #Ratio of volume at point 4 to swept volume
DV = 1+c-a; #Difference in volumes
V = (P1*DV*Ta)/(T1*Pa); #Volume of air delivered per cycle
nv = V*100; #Volumetric efficiency
DV1 = (Pa*Va*T1)/(Ta*P1); #Difference in volumes
T2 = T1*((P2/P1)**x); #Temperature at point 2 in K
ma = (Pa*100*Va)/(R*Ta); #Mass of air delivered in kg/min
IP = (ma*R*(T2-T1))/(x*60); #Indicated power in kW
Piso = (ma*R*T1*math.log(P2/P1))/60; #Isothermal indicated power in kW
niso = (Piso/IP)*100; #Isothermal efficiency
# Results
print 'Volumetric efficiency is %3.1f percent \
\nIndicated power is %3.2f kW \
\nIsothermal efficiency is %3.0f percent'%(nv,IP,niso)
```

In [24]:

```
# Variables
V1 = 7.*(10**-3); #Volume of air in (m**3)/s
P1 = 1.013; #Pressure of air in bar
T1 = 288.; #Air temperature in K
P2 = 14.; #Pressure at point 2 in bar
n = 1.3; #Adiabatic gas constant
nm = 0.82; #Mechanical efficiency
# Calculations
x = (n-1)/n; #Ratio
W = (P1*100*V1*(((P2/P1)**x)-1))/x; #Work done by compressor in kW
P = W/nm; #Power requred to drive compressor in kW
# Results
print 'Power requred to drive compressor is %3.2f kW'%(P)
```

In [26]:

```
# Variables
L = 0.15; #Stroke in mm
D = 0.15; #Bore in mm
N = 8.; #Speed in rps
P1 = 100.; #Pressure at point 1 in kN/(m**2)
P2 = 550.; #Pressure at point 2 in kN/(m**2)
n = 1.32; #Adiabatic gas constant
C = 0.06 # RATIO
# Calculations
x = (n-1)/n; #Ratio
nv = (1+C-(C*((P2/P1)**(1/n))))*100; #Volumetric efficiency
DV = (3.147*(D**2)*L)/4; #Difference in volumes at points 1 and 3
DV1 = (nv*DV)/100; #Difference in volumes at points 1 and 4
V2 = DV1*((P1/P2)**(1/n))*N; #Volume of air delivered per second
W = (P1*DV1*(((P2/P1)**x)-1))*N/x; #Power of compressor in kW
# Results
print 'Theoretical volume efficiency is %3.1f percent \
\nVolume of air delivered is %3.5f m**3/s \
\nPower of compressor is %3.3f kW'%(nv,V2,W)
```

In [1]:

```
import math
# Variables
V = 16.; #Volume of air compresssed in m**3
P1 = 1.; #Pressure at point 1 in bar
P3 = 10.5; #Pressure at point 3 in bar
T1 = 294.; #Temperature at point 1 in K
Tc = 25.; #Temperature of cooling water in oC
n = 1.35; #Adiabatics gas constant
R = 0.287; #Universal gas constant in kJ/kg-K
Cp = 1.005; #Specific heat at constant pressure in kJ/kg-K
Cw = 4.187; #Specific heat of water in kJ/kg-K
# Calculations
x = (n-1)/n; #Ratio
P2 = math.sqrt(P1*P3); #Pressure at point 2 in bar
W1 = (2*P1*100*V*(((P2/P1)**x)-1))/(x*60); #Indicated power of compressor from P1 to P2 in kW
W2 = (P1*100*V*(((P3/P1)**x)-1))/(x*60); #Indicated power of compressor from P1 to P3 in kW
T4 = T1*((P2/P1)**x); #Maximum temperature for two stage compression in K
T2 = T1*((P3/P1)**x); #Maximum temperature for single stage compression in K
m = (P1*100*V)/(R*T1); #Mass of air compressed in kg/min
Q = m*Cp*(T4-T1); #Heat rejected by air in kJ/min
mc = Q/(Cw*Tc); #Mass of cooling water in kg/min
# Results
print 'Minimum indicated power required for 2 stage compression is %3.1f kW \
\nPower required for single stage compression is 18 percent more than that for \
two stage compression with perfect intercooling \
\nMaximum temperature for two stage compression is %3.1f K \
\nMaximum temperature for single stage compression is %3.1f K \
\nHeat rejected by air is %3.1f kJ/min \
\nMass of cooling water required is %3.1f kg/min'%(W1,T4,T2,Q,mc)
```

In [28]:

```
import math
# Variables
V = 0.2; #Air flow rate in (m**3)/s
P1 = 0.1; #Intake pressure in MN/(m**2)
P3 = 0.7; #Final pressure in MN/(m**2)
T1 = 289.; #Intake temperature in K
n = 1.25; #Adiabatic gas constant
N = 10.; #Compressor speed in rps
# Calculations
x = (n-1)/n; #Ratio
P2 = math.sqrt(P1*P3); #Intermediate pressure in MN/(m**2)
V1 = (V/N)*1000; #Total volume of LP cylinder in litres
V2 = ((P1*V1)/P2); #Total volume of HP cylinder in litres
W = ((2*P1*V*(((P2/P1)**x)-1))/x)*1000; #Cycle power in kW
# Results
print 'Intermediate pressure is %3.3f MN/m**2 \
\nTotal volume of LP cylinder is %3.0f litres \
\nTotal volume of HP cylinder is %3.1f litres \
\nCycle power is %3.0f kW'%(P2,V1,V2,W)
```

In [2]:

```
# Variables
P1 = 1.; #Pressure at point 1 in bar
T1 = 290.; #Temperature at point 1 in K
P3 = 60.; #Pressure at point 3 in bar
P2 = 8.; #Pressure at point 2 in bar
T2 = 310.; #Temperature at point 2 in K
L = 0.2; #Stroke in m
D = 0.15; #Bore in m
n = 1.35; #Adiabatic gas constant
N = 200.; #Speed in rpm
# Calculations
x = (n-1)/n; #Ratio
V1 = (3.147*(D**2)*L)/4; #Volume at point 1 in m**3
V2 = (P1*V1*T2)/(T1*P2); #Volume of air entering LP cylinder in m**3
W = ((P1*(10**5)*V1*(((P2/P1)**x)-1))/x)+((P2*(10**5)*V2*(((P3/P2)**x)-1))/x); #Workdone by compressor per cycle in J
P = (W*N)/(60*1000); #Power of compressor in kW
# Results
print 'Power of compressor is %3.2f kW'%(P)
# rounding off error
```

In [8]:

```
import math
# Variables
N = 220.; #Speed of compressor in rpm
P1 = 1.; #Pressure entering LP cylinder in bar
T1 = 300.; #Temperature at point 1 in K
Dlp = 0.36; #Bore of LP cylinder in m
Llp = 0.4; #Stroke of LP cylinder in m
Lhp = 0.4; #Stoke of HP cylinder in m
P2 = 4.; #Pressure leaving LP cylinder in bar
P5 = 3.8; #Pressure entering HP cylinder in bar
T3 = 300.; #Temperature entering HP cylinder in K
P6 = 15.2; #Dicharge pressure in bar
n = 1.3; #Adiabatic gas constant
Cp = 1.0035; #Specific heat at constant pressure in kJ/kg-K
R = 0.287; #Universal gas constant in kJ/kg-K
T5 = T1; #Temperature at point 5 in K
C = 0.04
# Calculations
x = (n-1)/n; #Ratio
Vslp = round((math.pi*(Dlp**2)*Llp*N*2)/4,2); #Swept volume of LP cylinder in m**3/min
nv = round(1+C-(C*((P2/P1)**(1/n))),4); #Volumetric efficiency
V1 = nv*Vslp; #Volume of air drawn at point 1 in (m**3)/min
m = round((P1*100*V1)/(R*T1),2); #Mass of air in kg/min
T2 = round(T1*((P2/P1)**x)); #Temperature at point 2 in K
QR = m*Cp*(T2-T5); #Heat rejected in kJ/min
V5 = (m*R*T5)/(P5*100); #Volume of air drawn in HP cylinder M**3/min
Plp = P2/P1; #Pressure ratio of LP cylinder
Php = P6/P5; #Pressure ratio of HP cylinder
Vshp = V5/nv; #Swept volume of HP cylinder in m**3/min
Dhp = math.sqrt((Vshp*4)/(3.147*Lhp*N*2)); #Bore of HP cylinder in m
P = (m*R*(T2-T1))/(x*60); #Power required for HP cylinder in kW
print V5,Plp,Php,Vshp,Dhp,P
# Results
print 'Heat rejected in intercooler is %3.1f kJ/min \
\nDiameter of HP cylinder is %3.4f m \
\nPower required for HP cylinder is %3.0f kW'%(QR,Dhp,P)
# rounding off error. please check
```

In [41]:

```
import math
# Variables
P1 = 1.; #Pressure at point 1 in bar
P3 = 30.; #Pressure at point 3 in bar
T1 = 300.; #Temperature at point 1 in K
n = 1.3; #Adiabatics gas constant
# Calculations
P2 = math.sqrt(P1*P3); #Intermediate pressure in bar
rD = math.sqrt(P2/P1); #Ratio of cylinder diameters
# Results
print 'Ratio of cylinder diameters is %3.2f'%(rD)
```

In [42]:

```
# Variables
P1 = 1.013; #Pressure at point 1 in bar
T1 = 288.; #Temperaturea at point 1 in K
v1 = 8.4; #free air delivered by compressor in m**3
P4 = 70.; #Pressure at point 4 in bar
n = 1.2; #Adiabatic gas constant
Cp = 1.0035; #Specific heat at constant pressure in kJ/kg-K
# Calculations
x = (n-1)/n; #Ratio
P2 = P1*((P4/P1)**(1./3)); #LP cylinder delivery pressure in bar
P3 = P2*((P4/P1)**(1./3)); #IP cylinder delivery pressure in bar
r = P2/P1; #Ratio of cylinder volumes
r1 = P3/P2; #Ratio of cylinder volumes
r2 = r*r1; #Ratio of cylinder volumes
V3 = 1; #Volume at point 3 in m**3
T4 = T1*((P2/P1)**x); #Three stage outlet temperature in K
QR = Cp*(T4-T1); #Heat rejected in intercooler in kJ/kg of air
W = ((3*P1*100*v1*(((P4/P1)**(x/3))-1))/(x*60)); #Total indiacted power in kW
# Results
print 'LP cylinder delivery pressure is %3.3f bar \
\nIP cylinder delivery pressure is %3.2f bar \
\nRatio of cylinder volumes is %3.2f:%3.1f:%3.0f \
\nTemperature at end of each stage is %3.2f K \
\nHeat rejected in each intercooler is %3.1f kJ/kg of air \
\nTotal indicated power is %3.2f kW'%(P2,P3,r2,r1,V3,T4,QR,W)
```

In [43]:

```
# Variables
D = 0.45; #Bore in m
L = 0.3; #Stroke in m
P1 = 1.; #Pressure at point 1 inn bar
T1 = 291.; #Temperature at point 1 in K
P4 = 15.; #Pressure at point 4 in bar
n = 1.3; #Adiabatic gas constant
R = 0.29; #Universal gas constant in kJ/kg-K
# Calculations
x = (n-1)/n; #Ratio
k = (P4/P1)**(1./3); #Pressure ratio
P2 = k*P1; #Pressure at point 2 in bar
P3 = k*P2; #Pressure at point 1 in bar
Vslp = (3.147*(D**2)*L)/4; #Swept volume of LP cylinder
V7 = C*Vslp; #Volume at point 7 in m**3
V1 = Vslp+V7; #Volume at point 1 in m**3
V8 = V7*(k**(1/n)); #Volume at point 8 in m**3
EVs = (V1-V8)*1000; #Effective swept volume in litres
T4 = T1*(k**x); #Temperature at point 4 in K
t4 = T4-273; #Delivery temperature in oC
DV = ((P1*T4*(V1-V8))/(P4*T1))*1000; #Delivery volume per stroke in litres
W = (3*R*T1*((k**x)-1))/x; #Workdone per kg of air in kJ
# Results
print 'Intermediate pressures are %3.3f bar and %3.3f bar \
\nEffective swept volume of LP cylinder is %3.2f litres \
\nTemperature of air delivered per stroke is %3.1f oC \
\nVolume of air delivered per stroke is %3.2f litres \
\nWork done per kg of air is %3.1f kJ'%(P2,P3,EVs,t4,DV,W)
```

In [51]:

```
import math
# Variables
P1 = 1.; #Pressure at point 1 in bar
Pns = 100.; #Maximum pressure in bar
p = 4.; #Pressure ratio
# Calculations
Ns = math.log(Pns)/math.log(p); #Number of stages
y = math.ceil(Ns); #Rounding off to next higher integer
ps = (Pns/P1)**(1/y); #Exact stage pressure ratio
P2 = ps*P1; #Pressure at point 2 in bar
P3 = ps*P2; #Pressure at point 3 in bar
P4 = ps*P3; #Pressure at point 4 in bar
# Results
print 'Number of stages are %3.2f \
\nExact stage pressure ratio is %3.3f \
\nIntermediate pressures are %3.3f bar, %3.2f bar, %3.2f bar'%(y,ps,P2,P3,P4)
# rounding off error
```