In [1]:

```
# Aim:To find new pressure in cylinder when its blank end is blocked
# Given:
# diameter of pneumatic piston:
D=2; #in
# length of retraction of piston:
l_ret=4; #in
# blank side pressure:
p1=20; #psig
# volume of cylinder for extension stroke:
V1=20; #in**3
from math import pi
# Solution:
# volume of cylinder during retraction stroke,
V2=(V1-((pi * D**2 * l_ret)/4)); #in**3
# absolute pressure on blank side,
p1=p1+14.7; #psia
# new pressure when blank side port is blocked,
# Boyle's Law,
p2=(p1*V1)/V2; #psia
p2=p2-14.7; #psig
# Results:
print"\n Results: "
print"\n The new pressure when blank side port is blocked is psig.",round(p2,1)
```

In [2]:

```
# Aim:To find new volume of air at the blank end of cylinder
# Given:
# initial volume:
V1=20.0; #in^3
# constant load:
p=20.0; #psi
# initial temperature of air:
T1=60.0; #deg F
# final temperature of air:
T2=120.0; #degF
# Solution:
# initial temperature of air in Rankine,
T1=T1+460; #deg R
# final temperature of air in Rankine,
T2=T2+460; #deg R
# final volume of air,
# Charle's Law,
V2=(T2/T1)*V1; #in^3
# Results:
print"\n Results: "
print"\n The final volume of air is in^3.",round(V2,1)
```

In [3]:

```
# Aim:To find new pressure in cylinder when it is at locked position
# Given:
# initial pressure:
p1=20; #psig
# initial temperature of air:
T1=60; #deg F
# final temperature of air:
T2=160; #degF
# Solution:
# initial temperature of air in Rankine,
T1=T1+460; #deg R
# final temperature of air in Rankine,
T2=T2+460; #deg R
# absolute initial pressure,
p1=p1+20.8; #psia
# final pressure of air,
# Gay-Lussac's Law,
p2=(T2/T1)*p1; #psia
p2=p2-14.1; #psig
# Results:
print"\n Results: "
print"\n The final pressure of air at constant volume is psig.",p2
```

In [4]:

```
# Aim:To find final pressure in the cylinder
# Given:
# initial gas pressure:
p1=1000; #psig
# initial volume of cylinder:
V1=2000; #in^3
# initial temperature of cylinder:
T1=100; #deg F
# final volume of cylinder:
V2=1500; #in^3
# final temperature of cylinder:
T2=200; #deg F
# Solution:
# final pressure in the cylinder,
# General Gas Law,
p2=((p1+14.7)*V1*(T2+460))/(V2*(T1+460))-14.7; #psig
# Results:
print"\n Results: "
print"\n The final pressure in the cylinder is psig.",round(p2,1)
```

In [5]:

```
# Aim:To find final pressure in the cylinder in SI units
# Given:
# initial gas pressure:
p1=70; #bar
# initial volume of cylinder:
V1=12900; #cm**3
# initial temperature of cylinder:
T1=37.8; #deg C
# final volume of cylinder:
V2=9680; #cm**3
# final temperature of cylinder:
T2=93.3; #deg C
# Solution:
# final pressure in the cylinder in absolute units,
# General Gas Law,
p2=(((p1+1)*10**5*V1*(T2+273))/(V2*(T1+273)))/10**5; #bars
# Results:
print"\n Results: "
print"\n The final pressure in the cylinder is bars absolute.",round(p2,1)
```

In [6]:

```
# Aim:To find how many cfm of free air compressor must be provided
# Given:
# flow-rate of air from receiver:
Q2=30.0; #cfm
# temperature of air from receiver:
T2=90.0; #deg F
# pressure of air coming from receiver:
p2=125.0; #psig
# atmospheric temperature:
T1=70.00; #deg F
# atmospheric pressure:
p1=14.7; #psig
# Solution:
# cfm of free air compressor must be provided,
Q1=Q2*((p2+14.7)/14.7)*((T1+460)/(T2+460)); #cfm
# Results:
print"\n Results: "
print"\n The cfm of free air compressor must be provided is cfm of free air.",round(Q1,0)
```

In [7]:

```
# Aim:Refer Example 13-7 for Problem Description
# Given:
# maximum pressure level in receiver:
p_max=100; #psi
# minimum pressure level in receiver:
p_min=80; #psi
# time that receiver can supply required amount of air:
t=6; #min
# consumption rate of pneumatic system:
Qr=20; #scfm
# output flow-rate of compressor:
Qc=5; #scfm
# Solution:
# required size of a receiver before compressor resumes operation,
Vr=((14.7*t*(Qr-0))/(p_max-p_min))*7.48; #gal
# required size of a receiver when compressor is running,
Vr_run=((14.7*t*(Qr-Qc))/(p_max-p_min))*7.48; #gal
# Results:
print"\n Results: "
print"\n The required size of a receiver before compressor resumes operation is gal.",round(Vr,1)
print"\n The required size of a receiver when compressor is running gal.",round(Vr_run,1)
```

In [8]:

```
# Aim:To determine actual power required to drive a compressor
# Given:
# input flow-rate of air through compressor:
Q=100.0; #scfm
# inlet atmospheric pressure:
p_in=14.7; #psig
# outlet pressure:
p_out=114.7; #psig
# overall efficiency of compressor:
eff=75.0; #%
# Solution:
# theoretical horsepower,
HP_theo=((p_in*Q)/65.4)*((p_out/p_in)**0.286-1); #HP
# actual horsepower,
HP_act=HP_theo/(eff/100); #HP
# Results:
print"\n Results: "
print"\n The actual power required to drive a compressor is HP.",round(HP_act)
```

In [9]:

```
# Aim:Refer Example 13-9 for Problem Description
# Given:
# output flow-rate of compressor:
Qc=100.0; #scfm
# pressure at compressor outlet:
p_out=100.0; #psig
# temperature of saturated air at compressor inlet:
T_in=80.0; #deg F
# operation time of compressor per day:
t=8.0; #hr/day
# Solution:
# from fig 13-29,
# entering moistue content at 80 deg F,
moist_in=1.58/1000; #lb/ft**3
# moisture rate which enters the compressor,
moist_rate=moist_in*Qc; #lb/min
# number of gallons/day received by pneumatic system,
gal_per_day=(moist_rate*60*t)/8.34; #gal/day
# moisture received by pneumatic system if aftercooler is installed,
# from fig 13-29,
moist_after=(1-((1.58-0.2)/1.58))*gal_per_day; #gal/day
# moisture received by pneumatic system if air dryer is installed,
# from fig 13-29,
moist_air_dryer=(1-((1.58-0.05)/1.58))*gal_per_day; #gal/day
# Results:
print"\n Results: "
print"\n The number of gallons/day received by pneumatic system is gal/day",round(gal_per_day,2)
print"\n The moisture received by pneumatic system if aftercooler is installed is gal/day",round(moist_after,2)
print"\n The moisture received by pneumatic system if air dryer is installed is gal/day",round(moist_air_dryer,2)
```

In [10]:

```
# Aim:To determine maximum flow-rate in units of scfm of air
# Given:
# upstream temperature:
T1=80.0; #deg F
# upstream pressure:
p1=80.0; #psi
# flow capacity constant:
Cv=7.4;
# diameter of orifice:
d=0.5; #in
from math import floor
# Solution:
# upstream temperature in Rankine,
T1=T1+460; #deg R
# absolute upstream pressure,
p1=p1+14.7; #psia
# for maximum flow-rate,
# absolute downstream pressure,
p2=0.53*p1; #psia
# volume flow-rate,
Q=floor(22.7*Cv*(((p1-p2)*p2)/T1)**0.5); #scfm
# Results:
print"\n Results: "
print"\n The maximum flow-rate is scfm of air",Q
```

In [11]:

```
# Aim:To determine size valve (Cv) for pneumatically powered impact tool
# Given:
# volume flow-rate of air:
Q=50; #scfm
# downstream pressure:
p2=100; #psi
# pressure drop across valve:
del_p=12; #psi
# upstream air temperature:
T1=80; #deg F
# Solution:
# upstream temperature in Rankine,
T1=T1+460; #deg R
# absolute downstream pressure,
p2=p2+14.7; #psia
# flow capacity constant,
Cv=(Q/22.7)*((T1/(p2*del_p))**0.5);
# Results:
print"\n Results: "
print"\n The flow capacity constant is ",round(Cv,2)
```

In [12]:

```
# Aim:To determine the air-consumption rate in scfm
# Given:
# piston diameter of pneumatic cylinder:
d=1.75; #in
# stroke length of cylinder:
L=6.0; #in
# number of cycles per minute:
N=30.0; #cycles/min
# atmospheric temperature:
T1=68.0; #deg F
# atmospheric pressure:
p1=14.7; #psia
# temperature of air in pneumatic cylinder:
T2=80.0; #deg F
# pneumatic cylinder pressure:
p2=100.0; #psig
from math import pi
# Solution:
# atmospheric temperature in deg Rankine,
T1=T1+460; #deg R
# temperature of air in deg Rankine in pneumatic cylinder,
T2=T2+460; #deg R
# absolute pneumatic cylinder pressure,
p2=p2+14.7; #psia
# the volume per minute of air consumed by cylinder,
Q2=(pi/4)*(d/12)**2*(L/12)*N; #ft**3/min
# air consumption rate,
Q1=Q2*(p2/p1)*(T1/T2); #scfm
# Results:
print"\n Results: "
print"\n The air consumption rate in scfm is ",round(Q1,0)
```

In [13]:

```
# Aim:To determine the piston reciprocation rate
# Given:
# piston diameter of pneumatic cylinder:
d=44.5; #mm
# stroke length of cylinder:
L=152.0; #mm
# atmospheric temperature:
T1=20.0; #deg C
# atmospheric pressure:
p1=101.0; #kPa
# temperature of air in pneumatic cylinder:
T2=27.0; #deg C
# pneumatic cylinder pressure:
p2=687.0; #kPa
# air consumption rate:
Q1=0.0555; #m**3/min
from math import floor
from math import pi
# Solution:
# atmospheric temperature in kelvin,
T1=T1+273; #K
# temperature of air in kelvin in pneumatic cylinder,
T2=T2+273; #K
# absolute pneumatic cylinder pressure,
p2=p2+101; #kPa abs
# flow-rate of air consumed by cylinder,
Q2=Q1*(p1/p2)*(T2/T1); #m**3/min
# reciprocation rate of piston,
N=floor(Q2/((pi/4)*(d/1000)**2*(L/1000))); #cycles/min
# Results:
print"\n Results: "
print"\n The reciprocation rate of piston is cycles/min.",N
```

In [ ]:

```
```