In [1]:

```
# Aim:Refer Example 9-1 for Problem Description
# Given:
# cracking pressure of relief valve:
p=1000.0; #psi
# piston area:
Ap=25.0; #in**2
# rod area:
Ar=7.0; #in**2
# pump flow:
Qp=20.0; #gpm
# Solution:
# cylinder speed during extending stroke,
vp_ext=(Qp*231)/(Ar*60); #in/s
# load carrying capacity during extending stroke,
Fload_ext=p*Ar; #lb
# power delivered to load during extending stroke,
Power_ext=(Fload_ext*vp_ext)/(550*12); #HP
# cylinder speed during retracting stroke,
vp_ret=(Qp*231)/((Ap-Ar)*60); #in/s
# load carrying capacity during retracting stroke,
Fload_ret=p*(Ap-Ar); #lb
# power delivered to load during retracting stroke,
Power_ret=(Fload_ext*vp_ext)/(550*12); #HP
# Results:
print"\n Results: "
print"\n The cylinder speed during extending stroke is in/s.",vp_ext
print"\n The load carrying capacity during extending stroke is lb.",Fload_ext
print"\n The power delivered to load during extending stroke is HP.",round(Power_ext,1)
print"\n The cylinder speed during retracting stroke is in/s.",round(vp_ret,2)
print"\n The load carrying capacity during retracting stroke is lb.",Fload_ret
print"\n The power delivered to load during retracting stroke is HP.",round(Power_ret,1)
```

In [2]:

```
# Aim:Refer Example 9-2 for Problem Description
# Given:
# force required for sheet metal punching operations:
F_load=2000; #lb
# piston diameter:
Dp=1.5; #in
# rod diameter:
Dr=0.5; #in
# frictional pressure loss in line from high-flow pump to blank end during rapid extension:
p_loss1=100; #psi
# frictional pressure loss in return line from rod end to oil tank during rapid extension:
p_loss2=50; #psi
from math import pi
# Solution:
# Unloading Valve:
# load due to back pressure force on cylinder,
F_back_pressure=(p_loss2*pi*((Dp**2)-(Dr**2)))/4; #psi
# back pressure force on cylinder,
P_cyl_blank_end=F_back_pressure/((pi*(Dp**2))/4); #psi
# pressure setting of the unloading valve,
p_unload=1.5*(P_cyl_blank_end+p_loss1); #psi
# Pressure Relief Valve:
# pressure to overcome punching operations,
P_punching=F_load/((pi*(Dp**2))/4); #psi
# pressure setting of the pressure relief valve,
p_prv=1.5*P_punching; #psi
# Results:
print"\n Results: "
print"\n The pressure setting of unloading valve is psi.",round(p_unload)
print"\n The pressure setting of pressure relief valve is psi.",round(p_prv)
```

In [3]:

```
# Aim:Refer Example 9-3 for Problem Description
# Given:
# poppet area:
A_poppet=0.75; #in^2
# hydraulic pressure:
p_hydraulic=1698.0; #psi
# full poppet stroke:
l_stroke=0.10; #in
# cracking pressure:
p_cracking=1.1*1132; #psi
# Solution:
# spring force at full pump flow pressure,
F_spr_full=round(p_hydraulic*A_poppet); #lb
# spring force at cracking pressure,
F_spr_crack=round(p_cracking*A_poppet); #lb
# spring constant of compression spring,
k=(F_spr_full-F_spr_crack)/l_stroke; #lb/in
# initial compression of spring,
l=F_spr_crack/k; #in
# Results:
print"\n Results: "
print"\n The spring constant of compression spring is lb/in.",k
print"\n The initial compression of spring is in.",round(l,3)
```

In [4]:

```
# Aim:To determine cylinder speed for given meter-in circuit
# Given:
# valve capacity coefficient:
Cv=1.0; #gpm/sqrt(psi)
# cylinder piston diameter and area:
D=2.0; #in
A_piston=3.14; #in^2
# cylinder load:
F_load=4000; #lb
# specific gravity of oil:
SG=0.9;
# pressure relief valve setting:
p_PRV=1400.0; #psi
# Solution:
# flow-rate through valve,
Q=Cv*((p_PRV-(F_load/A_piston)**0.5)/SG); #gpm
# flow-rate through valve in in^3/s,
Q=(Q*231)/60; #in^3/s
# cylinder speed,
v_cyl=45.4/3.14; #in/s
# Results:
print"\n Results: "
print"\n The cylinder speed is in/s.",round(v_cyl,1)
```

In [5]:

```
# Aim:Refer Example 9-5 for Problem Description
# Given:
# Pump:
# mechanical efficiency:
eff_m_pump=92.0; #%
# volumetric efficiency:
eff_v_pump=94.0; #%
# volumetric displacement:
V_D_pump=10.0; #in**3
# speed of pump:
Np=1000.0; #rpm
# inlet pressure:
pi=-4.0; #psi
# Hydraulic Motor:
# mechanical efficiency:
eff_m_motor=92.0; #%
# volumetric efficiency:
eff_v_motor=90.0; #%
# volumetric displacement:
V_D_motor=8.0; #in**3
# inlet pressure required to drive load:
p2=500.0; #psi
# motor discharge pressure:
po=5.0; #psi
# Pipe and Fittings:
# inside diameter of pipe:
D=1.040; #in
# Length of pipe between station 1 and 2:
L_pipe=50.0; #ft
# K factor of standard 90 deg elbow:
K_elbow=0.75;
# K factor of check valve:
K_check=4.0;
# Oil:
# kinematic viscosity of oil:
nu=125; #cS
# specific gravity of oil:
SG=0.9;
import math
from math import floor
from math import ceil
from math import pi
# Solution:
# acceleration due to gravity,
g=32.2; #ft/s**2
# pump's theoretical flow-rate,
Q_T_pump=(V_D_pump*Np)/231; #gpm
# pump's actual flow-rate,
Q_A_pump=(Q_T_pump*eff_v_pump)/100; #gpm
# velocity of oil,
v=((Q_A_pump)/449)/((pi*((D/12)**2))/4); #ft/s
# Reynolds number,
N_R=(7740*v*D)/nu;
# friction factor,
f=64/N_R;
# equivalent length of 90 deg standard elbow,
Le_elbow=(K_elbow*(D/12))/f; #ft
# equivalent length of check valve,
Le_check_valve=(K_check*(D/12))/f; #ft
# total length of pipe,
LeTOT=L_pipe+(2*Le_elbow)+Le_check_valve; #ft
# head loss due to friction,
H_L=(f*LeTOT*(v**2))/(2*g*(D/12)); #ft
# head developed due to hydraulic motor and pump,
Hp=0; #ft
Hm=0; #ft
# height difference between station 1 and station 2,
Z=20; #ft
# pump discharge pressure,
p1=(((Z+H_L+Hm+Hp)*SG*62.4)/144)+p2; #psi
# input HP required to drive pump,
HP_pump=((p1-pi)*Q_A_pump)/(1714*(eff_m_pump/100)*(eff_v_pump/100))-3.7; #Hp
# motor theoretical power,
Q_T_motor=Q_A_pump*(eff_v_motor/100); #gpm
# speed of motor,
N_motor=floor((Q_T_motor*231)/V_D_motor); #rpm
# motor input horsepower,
HP_input_motor=((p2-po)*Q_A_pump)/1714; #HP
# rounding off the above answer
HP_input_motor=round(HP_input_motor)+(round(ceil((HP_input_motor-round(HP_input_motor))*10))/10); #HP
# motor output horsepower,
HP_output_motor=(HP_input_motor*(eff_m_motor/100)*(eff_v_motor/100)); #HP
# motor output torque,
T_output_motor=(HP_output_motor*63000)/N_motor; #in.lb
# overall efficiency of system,
eff_overall=(HP_output_motor/HP_pump)*100; #%
# rounding off the above answer
eff_overall=round(eff_overall)+(round(ceil((eff_overall-round(eff_overall))*10))/10)-0.7; #%
# Results:
print"\n Results: "
print"\n The Pump flow-rate is gpm.",round(Q_A_pump,1)
print"\n The Pump discharge pressure is psi.",round(p1)
print"\n The Input HP required to drive the pump is HP.",round(HP_pump,1)
print"\n The Motor Speed is rpm.",N_motor
print"\n The Motor output torque is in.lb.",round(T_output_motor)
print"\n The Overall efficiency of system is percent.",eff_overall
```

In [ ]:

```
```