In [2]:

```
# Aim:Refer Example 6-1 for Problem Description
# Given:
# Flow rate of pump:
Q_in=20.0; #gpm
# Bore diameter of Cylinder:
D=2.0; #in
# Load during extending and retracting:
F_ext=1000.0; #lb
F_ret=1000.0; #lb
# Rod diameter of cylinder:
d=1.0; #in
import math
from math import pi
from math import floor
from math import ceil
# Solution:
# Area of blank end of piston,
Ap=(pi/4)*(D**2); #in**2
# Area of rod end of piston,
Ar=(pi/4)*(d**2); #in**2
# hydraulic pressure during the extending stroke,
p_ext=F_ext/Ap; #psi
# piston velocity during the extending stroke,
v_ext=(Q_in/449)/(Ap/144); #ft/s
# rounding off the above answer
v_ext=round(v_ext)+(round(ceil((v_ext-round(v_ext))*100))/100); #ft/s
# cylinder horsepower during the extending stroke,
HP_ext=(v_ext*F_ext)/550; #HP
# rounding off the above answer
HP_ext=round(HP_ext)+(round(floor((HP_ext-round(HP_ext))*100))/100); #HP
# hydraulic pressure during the retraction stroke,
p_ret=ceil(F_ret/(Ap-Ar)); #psi
# piston velocity during the retraction stroke,
v_ret=(Q_in/449)/((Ap-Ar)/144); #ft/s;
# rounding off the above answer
v_ret=round(v_ret)+(round(ceil((v_ret-round(v_ret))*100))/100); #ft/s
# cylinder horsepower during the retraction stroke,
HP_ret=(v_ret*F_ret)/550; #HP
# Results:
print"\n Results: "
print"\n The hydraulic pressure during the extending stroke is psi.",round(p_ext)
print"\n The piston velocity during the extending stroke is ft/s.",v_ext
print"\n The cylinder horsepower during the extending stroke is HP.",HP_ext
print"\n The hydraulic pressure during the retraction stroke is psi.",p_ret
print"\n The piston velocity during the retraction stroke is ft/s.",v_ret
print"\n The cylinder horsepower during the retraction stroke is HP.",round(HP_ret,2)
```

In [3]:

```
# Aim:Refer Example 6-2 for Problem Description
# Given:
# Weight of Body:
W=6000; #lb
# coefficient of friction between weight and horizontal support:
CF=0.14;
# Solution:
# Cylinder Force,
F=CF*W; #lb
# Results:
print"\n Results: "
print"\n The Cylinder Force at constant velocity is lb.",F
```

In [4]:

```
# Aim:Refer Example 6-3 for Problem Description
# Given:
# Weight of Body:
W=6000; #lb
# Inclination of Weight:
theta=30; #deg
import math
from math import pi
from math import sin
# Solution:
# Inclination of Weight,
theta=(theta*pi)/180; #rad
# Cylinder Force,
F=W*sin(theta); #lb
# Results:
print"\n Results: "
print"\n The Cylinder Force at constant velocity is lb.",F
```

In [5]:

```
# Aim:Refer Example 6-4 for Problem Description
# Given:
# Weight of Body:
W=6000.0; #lb
# initial velocity:
u=0; #ft/s
# final velocity:
v=8.0; #ft/s
# Time taken:
t=0.5; #s
# Solution:
# For constant velocity,Cylinder Force,
F=W; #lb
# Rate of change of velocity,
a=(v-u)/t; #ft/s^2
# Force required to accelerate the weight,
F_acc=(F/32.2)*a; #lb
# Therefore, Cylinder Force,
F_cyl=(F+F_acc); #lb
# Results:
print"\n Results: "
print"\n The Cylinder Force at constant velocity is lb.",F
print"\n The Cylinder Force required to accelerate the Body is lb.",round(F_cyl)
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 [6]:

```
# Aim:Refer Example 6-5 for Problem Description
# Given:
L1=10; #in
L2=10; #in
# Inclination of cylinder axis with vertical axis:
phi=0; #deg
# cylinder load:
F_load=1000; #lb
import math
from math import pi
from math import cos
# Solution:
# Inclination of cylinder axis with vertical axis,
phi=(phi*pi)/180; #rad
# cylinder force required to overcome load using First Class Lever Sytem,
F_cyl_1=(L2*F_load)/(L1*cos(phi)); #lb
# cylinder force required to overcome load using Second Class Lever Sytem,
F_cyl_2=(L2*F_load)/((L1+L2)*cos(phi)); #lb
# cylinder force required to overcome load using Third Class Lever Sytem,
F_cyl_3=((L1+L2)*F_load)/(L2*cos(phi)); #lb
# Results:
print"\n Results: "
print"\n The Cylinder Force using First Class lever System is lb.",F_cyl_1
print"\n The Cylinder Force using Second Class lever System is lb.",F_cyl_2
print"\n The Cylinder Force using Third Class lever System is lb.",F_cyl_3
```

In [7]:

```
# Aim:Refer Example 6-6 for Problem Description
# Given:
# Flow rate of pump:
Q_pump=18.2; #gpm
# Diameter of blank end of piston:
D=3.0; #in
# Diameter of cushion plunger:
D_cush=1.0; #in
# Stroke of cushion plunger:
L_cush=0.75; #in
# Distance Piston decelerates at the end of extending stroke:
L=0.75; #in
# Weight of Body:
W=1500.0; #lb
# coefficient of friction:
CF=0.12;
# Pressure relief valve settings:
p_relf=750.0; #psi
# maximum pressure at the Blank end:
p1=750.0; #psi
from math import pi
# Solution:
# Area of blank end of piston,
A_piston=(pi/4)*(D**2); #in**2
# piston velocity prior to deceleration,
v=(Q_pump/449)/(A_piston/144); #ft/s
# deceleration of piston at the end of extending stroke,
a=(v**2)/(2*(L/12)); #ft/s**2
# Area of cushion plunger,
A_cush=(pi/4)*(D_cush**2); #in**2
# maximum pressure developed by the cushion,
p2=(((W*a)/32.2)+(p1*A_piston)-(CF*W))/(A_piston-A_cush); #psi
# Results:
print"\n Results: "
print"\n The maximum pressure developed by the cushion is psi.",round(p2)
```

In [ ]:

```
```