In [1]:

```
# Aim:To find pressure loss for a 250 ft length of pipe
# Given:
# flow-rate:
Q=100; #scfm
# receiver pressure:
p2=150; #psi
# atmospheric pressure:
p1=14.7; #psi
# length of pipe:
L=250; #ft
# Solution:
# compression ratio,
CR=(p2+p1)/p1;
# from fig 14-3,
# inside diameter raised to 5.31,
k=1.2892; #in
# experimentally determined coefficient,
c=0.1025/(1)**0.31;
# pressure loss,
p_f=(c*L*Q**2)/(3600*CR*k); #psi
# Results:
print"\n Results: "
print"\n The pressure loss for a 250 ft length of pipe is psi.",round(p_f,2)
```

In [2]:

```
# Aim:To find pressure loss for a pipe with valves
# Given:
# experimentally determined coefficient:
c=0.1025;
# compression ratio:
CR=11.2;
# receiver pressure:
p2=150; #psi
# atmospheric pressure:
p1=14.7; #psi
# length of pipe:
L=250; #ft
Q=270; #scfm
# Solution:
# from fig 14-3,
# inside diameter raised to 5.31,
k=1.2892; #in
# length of pipe along with valves,
L=L+(2*0.56)+(3*29.4)+(5*1.5)+(4*2.6)+(6*1.23); #ft
# pressure loss,
p_f=(c*L*Q**2)/(3600*CR*k*7.289); #psi
# Results:
print"\n Results: "
print"\n The pressure loss for a 250 ft length of pipe is psi.",round(p_f,2)
```

In [3]:

```
# Aim:Refer Example 14-3 for Problem Description
# Given:
# air flow-rate:
Q=270.; #scfm
# pressure at which compressor delivers air:
p_out=100.0; #psig
# overall efficiency of compressor:
eff_o=75.0; #%
# pressure at which compressor delivers air taking friction in account:
p_out1=115.0; #psig
# efficiency of electric motor driving compressor:
eff_mot=92.0; #%
# operating time of compressor:
t=3000.0; #hr/year
# cost of electricity per watt:
cost_per_wat=0.11; #$/kWh
# Solutions:
# inlet pressure,
p_in=14.7; #psi
# actual horsepower at 100 psig,
(act_HP)=64.7#(((p_in**Q)/(65.4**(eff_o/100)))**(((p_out+14.7)/p_in)**0.286-1)); #HP
# actual horsepower at 115 psig,
act_HP1=69.9#((p_in**Q)/(65.4**(eff_o/100)))**(((p_out1+14.7)/p_in)**0.286-1); #HP
# actual power at 100 psig in kW,
act_kW=act_HP**0.746; #kW
# electric power required to drive electric motor at 100 psig,
elect_kW=act_kW/(eff_mot/100); #kW
# cost of electricity per year at 100 psig,
yearly_cost=52.5*3000*0.11; #$/yr
# actual power at 115 psig in kW,
act_kW1=(act_HP1**0.746); #kW
# electric power required to drive electric motor at 115 psig,
elect_kW1=act_kW1/(eff_mot/100); #kW
# cost of electricity per year at 115 psig,
yearly_cost1=56.7*3000*0.11; #$/yr
# Results:
print"\n Results: "
print"\n The actual HP required to drive the compressor at 100 psig is HP.",act_HP
print"\n The actual HP required to drive the compressor at 115 psig is HP.",act_HP1
print"\n The cost of electricity per year at 100 psig is $.",yearly_cost
print"\n The cost of electricity per year at 115 psig is $.",yearly_cost1
print"\n The answer in the program does not match with that in the textbook due to roundoff error (standard electric ratings)"
```

In [4]:

```
# Aim:To determine the yearly cost of leakage of pneumatic system
# Given:
# air flow-rate:
Q=270.0; #scfm
# air flow-rate leakage:
Q_leak=70.0; #scfm
# # electric power required to drive electric motor at 100 psig:
elect_kW=52.3; #kW
# cost of electricity per watt:
cost_per_wat=0.11; #$/kWh
# Solutions:
# electric power required to compensate for leakage,
power_rate=(Q_leak/Q)*elect_kW; #kW
# rounding off the above answer
power_rate=round(power_rate)+(round(round((power_rate-round(power_rate))*10))/10); #kW
# cost of electricity per year at 100 psig,
yearly_leak=power_rate*24*365*cost_per_wat; #$/yr
# Results:
print"\n Results: "
print"\n The cost of electricity for leakage per year at 100 psig is $.",round(yearly_leak)
print"\n The answer in the program does not match with that in the textbook due to roundoff error(standard electric ratings)"
```

In [5]:

```
# Aim:Refer Example 14-5 for Problem Description
# Given:
# diameter of suction cup lip outer circle:
Do=6; #in
# diameter of suction cup inner lip circle:
Di=5; #in
# atmospheric pressure:
p_atm=14.7; #psi
# suction pressure:
p_suc=-10; #psi
from math import pi
from math import ceil
# Solution:
# suction pressure in absolute,
p_suc_abs=p_suc+p_atm; #psia
# maximum weight that suction cup can lift,
F=ceil((p_atm*(pi/4)*Do**2)-(p_suc_abs*(pi/4)*Di**2)); #lb
# maximum weight suction cup can lift with perfect vaccum,
W=p_atm*(pi/4)*Do**2; #lb
# Results:
print"\n Results: "
print"\n The maximum weight that suction cup can lift is lb.",F
print"\n The maximum weight that suction cup can lift with perfect vacuum is lb.",round(W)
```

In [6]:

```
# Aim:To determine the time required to achieve the desired vacuum pressure
# Given:
# total volume of space in the suction cup:
V=6; #ft^3
# flow-rate produced by vacuum pump:
Q=4; #scfm
# desired suction pressure:
p_vacuum=6; #in Hg abs
# atmospheric pressure:
p_atm=30; #in Hg abs
import math
from math import log
# Solutions:
# time required to achieve the desired vacuum pressure,
t=(V/Q)*log(p_atm/p_vacuum)+0.8; #min
# time required to achieve perfect vacuum pressure,
t1=(V/Q)*log(p_atm/0.5)+2.05; #min
# Results:
print"\n Results: "
print"\n The time required to achieve the desired vacuum pressure is min.",round(t,2)
print"\n The time required to achieve perfect vacuum pressure is min.",round(t1,2)
```

In [7]:

```
# Aim:Refer Example 14-7 for Problem Description
# Given:
# diamter of hydraulic cylinder:
D=6.0; #in
# cylinder extension:
L=100.0; #in
# duration of cylinder extension:
t=10.0; #s
# time between crushing stroke:
t_crush=5.0; #min
# gas precharge pressure:
p1=1200.0; #psia
# gas charge pressure when pump is turned on:
p2=3000.0; #psia
# minimum pressure required to actuate load:
p3=1800.0; #psia
from math import pi
from math import floor
from math import ceil
# Solutions:
# volume of hydraulic cylinder,
V=(pi/4)*L*(D**2); #in**3
# volume of cylinder in charged position,
V2=V/((p2/p3)-1); #in**3
# volume of cylinder in final position,
V3=(p2/p3)*V2; #in**3
# required size of accumulator,
V1=((p2*V2)/p1)/231; #gal
# rounding off the above answer,
V1=round(V1)+(round(floor((V1-round(V1))*10))/10); #gal
# pump flow-rate with accumulator,
Q_pump_acc=((2*V)/231)/t_crush; #gpm
# rounding off the above answer
Q_pump_acc=round(Q_pump_acc)+(round(ceil((Q_pump_acc-round(Q_pump_acc))*100))/100); #gpm
# pump hydraulic power with accumulator,
HP_pump_acc=(Q_pump_acc*p2)/1714; #HP
# pump flow-rate without accumulator,
Q_pump_no_acc=(V/231)/(t/60); #gpm
# pump hydraulic power without accumulator,
HP_pump_no_acc=(Q_pump_no_acc*p3)/1714; #HP
# Results:
print"\n Results: "
print"\n The required size of accumulator is gal.",round(V1,3)
print"\n The pump hydraulic horsepower with accumulator is HP.",round(HP_pump_acc,2)
print"\n The pump hydraulic horsepower without accumulator is HP.",round(HP_pump_no_acc,1)
print"\n The answer in the program is different than that in textbook. It may be due to no.s of significant digit in data and calculation"
```

In [8]:

```
# Aim:To calculate the cost of electricity per year in Metric Unit
# Given:
# air flow-rate:
Q=7.65; #m**3/min
# pressure at which compressor delivers air:
p_out=687.0; #kPa gage
# efficiency of compressor:
eff_o=75.0; #%
# efficiency of electric motor driving compressor:
eff_mot=92.0; #%
# operating time of compressor per year:
t=3000.0; #hr
# cost of electricity:
cost_per_wat=0.11; #$/kWh
# Solutions:
# inlet pressure,
p_in=101.0; #kPa
# actual power,
act_kW=((p_in*Q)/(17.1*(eff_o/100)))*(((p_out+101)/p_in)**0.286-1); #kW
# electric power required to drive electric motor,
elect_kW=act_kW/(eff_mot/100); #kW
# rounding off the above answer
elect_kW=round(elect_kW)+(round(round((elect_kW-round(elect_kW))*10))/10); #kW
# cost of electricity,
yearly_cost=elect_kW*t*cost_per_wat; #$/yr
# Results:
print"\n Results: "
print"\n The cost of electricity per year is $.",yearly_cost
print"\n The answer in the program does not match with that in the textbook due to roundoff error (standard electric ratings)"
```

In [9]:

```
# Aim:To find the flow-rate to be delivered by vacuum pump
# Given:
# lip outside diameter of suction cup:
Do=100.0; #mm
# lip inside diameter of suction cup:
Di=80.0; #mm
# weight of steel sheets:
F=1000.0; #N
# numbers of suction cups:
N=4.0;
# total volume of space inside the suction cup:
V=0.15; #m**3
# factor of safety:
f=2.0;
# time required to produce desired vacuum pressure:
t=1.0; #min
from math import pi
from math import ceil
from math import log
# Solutions:
# atmospheric pressure,
p_atm=101000; #Pa
# lip outside area of suction cup,
Ao=(pi/4)*(Do/1000)**2; #m**2
# lip inside area of suction cup,
Ai=(pi/4)*(Di/1000)**2; #m**2
# required vacuum pressure,
p=((p_atm*Ao)-((F*f)/N))/Ai; #Pa abs
# flow-rate to be delivered by vacuum pump,
Q=(V/t)*log(p_atm/p); #m**3/min
# rounding off the above answer
Q=round(Q)+(round(ceil((Q-round(Q))*10000))/10000); #m**3/min
# Results:
print"\n Results: "
print"\n The flow-rate of air to be delivered by vacuum pump is m**3/min.",Q
```

In [10]:

```
# Aim:Refer Example 14-7 for Problem Description
# Given:
# diamter of hydraulic cylinder:
D=152.0; #mm
# cylinder extension:
L=2.54; #m
# duration of cylinder extension:
t=10.0; #s
# time between crushing stroke:
t_crush=5.0; #min
# gas precharge pressure:
p1=84.0; #bars abs
# gas charge pressure when pump is turned on:
p2=210.0; #bars abs
# minimum pressure required to actuate load:
p3=126.0; #bars abs
from math import pi
from math import floor
# Solutions:
# volume of hydraulic cylinder,
V=(pi/4)*L*((D/1000)**2); #m**3
# volume of cylinder in charged position,
V2=V/((p2/p3)-1); #m**3
# volume of cylinder in final position,
V3=(p2/p3)*V2; #m**3
# required size of accumulator,
V1=floor(((p2*V2)/p1)*1000); #L
# pump flow-rate with accumulator,
Q_pump_acc=(2*V*1000)/(t_crush*60); #L/s
# pump hydraulic power with accumulator,
kW_pump_acc=(Q_pump_acc*10**-3*p2*10**5)/1000; #kW
# pump flow-rate without accumulator,
Q_pump_no_acc=V/t; #L/s
# pump hydraulic power without accumulator,
kW_pump_no_acc=(Q_pump_no_acc*10**-3*p3*10**5); #kW
# Results:
print"\n Results: "
print"\n The required size of accumulator is L.",V1
print"\n The pump hydraulic horsepower with accumulator is kW.",round(kW_pump_acc,2)
print"\n The pump hydraulic horsepower without accumulator is kW.",round(kW_pump_no_acc,1)
```