In [1]:

```
import math
# Variables:
NBA = 120. #rpm
AB = 40./1000
CD = 80./1000 #m
#Solution:
#Refer Fig. 7.7
#Calculating the angular velocity of the crank AB
omegaBA = 2*math.pi*NBA/60 #rad/s
#Calculating the velocity of B with respect to A
vBA = omegaBA*AB #m/s
vB = vBA
#By measurement from the velocity diagram Fig. 7.7(b)
vCD = 0.385 #m/s
vC = vCD
#Calculating the angular velocity of link CD
omegaCD = vCD/CD #rad/s
#Results:
print " The angular velocity of link CD omegaCD = %.1f rad/s clockwise about D."%(omegaCD)
```

In [2]:

```
import math
# Variables:
NBO = 180. #rpm
OB = 0.5
PB = 2.
dO = 50./1000
dB = 60./1000
dC = 30./1000 #m
#Solution:
#Refer Fig. 7.8
#Calculating the angular velocity of the crank BO
omegaBO = 2*math.pi*NBO/60 #rad/s
#Calculating the linear velocity of B with respect to O
vBO = omegaBO*OB #m/s
vB = vBO
#By measurement from the velocity diagram Fig. 7.8(b)
vP = 8.15
vPB = 6.8
vE = 8.5
bg = 5.
bp = vPB
vG = 8. #m/s
#Calculating the angular velocity of the connecting rod PB
omegaPB = vPB/PB #rad/s
#Calculating the velocity of rubbing at the pin of crank-shaft
vCS = dO/2*omegaBO #Velocity of rubbing at the pin of crank-shaft m/s
#Calculating the velocity of rubbing at the pin of crank
vC = dB/2*(omegaBO+omegaPB) #Velocity of rubbing at the pin of crank m/s
#Calculating the velocity of rubbing at the pin of cross-head
vPCH = dC/2*omegaPB #Velocity of rubbing at the pin of cross-head m/s
#Calculating the position of point G on the connecting rod
BG = bg/bp*PB #m
#Results:
print " The velocity of piston P vP = %.2f m/s."%(vP)
print " The angular velocity of connecting rod omegaPB = %.1f rad/s anticlockwise."%(omegaPB)
print " The velocity of point E on the connecting rod vE = %.1f m/s."%(vE)
print " The velocity of rubbing at the pin of crank-shaft is %.2f m/s."%(vCS)
print " The velocity of rubbing at the pin of crank is %.4f m/s."%(vC)
print " The velocity of rubbing at the pin of cross-head is %.3f m/s."%(vPCH)
print " The position of point G on the connecting rod BG = %.2f m."%(BG)
print " The linear velocity of point G vG = %d m/s."%(vG)
```

In [3]:

```
import math
# Variables:
NAO = 600. #rpm
OA = 28./1000 #m
BD = 46./1000 #m
#Solution:
#Refer Fig. 7.10
#Calculating the angular velocity of crank AO
omegaAO = 2*math.pi*NAO/60 #rad/s
#Calculating the velocity of A with respect to O
vAO = omegaAO*OA #m/s
vA = vAO
#By measurement from the velocity diagram Fig. 7.10(b)
vD = 1.6
vDB = 1.7 #m/s
#Calculating the angular velocity of D with respect to B
omegaBD = vDB/BD #rad/s
#Results:
print " The velocity of the slider D vD = %.1f m/s."%(vD)
print " The angular velocity of the link BD omegaBD = %.2f rad/s clockwise sbout B."%(omegaBD)
```

In [4]:

```
import math
# Variables:
NBA = 120. #rpm
AB = 150./1000 #mm
DC = 450./1000 #mm
BC = 450./1000 #mm
dC = 50./1000
rC = dC/2 #m
#Solution:
#Refer Fig. 7.12
#Calculating the angular velocity of the crank AB
omegaBA = 2*math.pi*NBA/60 #rad/s
#Calculating the linear velocity of B with respect to A
vBA = omegaBA*AB #m/s
vB = vBA
#By measurement from the velocity diagram Fig. 7.12(b)
vF = 0.7
vCD = 2.25
vCB = 2.25 #m/s
#Calculating the angular velocity of DC
omegaDC = vCD/DC #rad/s
#Calculating the angular velocity of BC
omegaCB = vCB/BC #rad/s
#Calculating the rubbing speed at the pin C
vr = (omegaCB-omegaDC)*rC #The rubbing speed at the pin C m/s
#Results:
print " The velocity of block F vF = %.1f m/s."%(vF)
print " The angular velocity of DC omegaDC = %d rad/s anticlockwise about D."%(omegaDC)
print " The rubbing speed at the pin C is %d m/s."%(vr)
```

In [5]:

```
import math
# Variables:
NAO = 120. #rpm
OA = 100./1000
CE = 350./1000 #m
#Solution:
#Refer Fig. 7.13
#Calculating the angular speed of the crank OA
omegaAO = 2*math.pi*NAO/60 #rad/s
#Calculating the velocity of A with respect to O
vAO = omegaAO*OA #m/s
vA = vAO
#By measurement from the velocity diagram Fig. 7.14(b)
vF = 0.53
od = 1.08
vCE = 0.44 #m/s
#Calculating the angular velocity of CE
omegaCE = vCE/CE #rad/s
#Results:
print " The velocity of F vF = %.2f m/s."%(vF)
print " The velocity of sliding of CE in the trunnion is %.2f m/s."%(od)
print " The angular velocity of CE omegaCE = %.2f rad/s clockwise about E."%(omegaCE)
```

In [7]:

```
import math
# Variables:
NCO = 120. #rpm
OC = 125./1000 #m
#Solution:
#Refer Fig. 7.15
#Calculating the angular velocity of the crank CO
omegaCO = 2*math.pi*NCO/60 #rad/s
#Calculating the linear velocity of C with respect to O
vCO = omegaCO*OC #m/s
vC = vCO
#By measurement from the velocity diagram Fig. 7.16(b)
vCO = 1.57
vE = 0.7 #m/s
#Results:
print " The absolute velocity of point E of the lever vE = %.1f m/s."%(vE)
```

In [8]:

```
import math
# Variables:
NBO1 = 40. #rpm
O1O2 = 800./1000
O1B = 300./1000
O2D = 1300./1000
DR = 400./1000 #m
#Solution:
#Refer Fig. 7.18
#Calculating the angular speed of the crank BO
omegaBO1 = 2*math.pi*NBO1/60 #rad/s
#Calculating the velocity of B with respect to O1
vBO1 = omegaBO1*O1B #m/s
vB = vBO1
#By measurement from the velocity diagram Fig. 7.18(b)
vR = 1.44
vDO2 = 1.32 #m/s
vD = vDO2
#Calculating the angular velocity of the link O2D
omegaDO2 = vDO2/O2D #rad/s
#Results:
print " The velocity of the ram R vR = %.2f m/s."%(vR)
print " The angular velocity of the link O2D omegaDO2 = %.3f rad/s anticlockwise about O2."%(omegaDO2)
```

In [9]:

```
import math
# Variables:
NAO1 = 60. #rpm
O1A = 85.
rQ = 50. #mm
#Solution:
#Refer Fig. 7.20 and Fig. 7.21
#Calculating the angular velocity of AO1
omegaAO1 = 2*math.pi*NAO1/60 #rad/s
#Calculating the velocity of A with respect to O1
vAO1 = omegaAO1*O1A #mm/s
vA = vAO1
#By measurement from the velocity diagram Fig. 7.20(b)
vDO2 = 410. #mm/s
O2D = 264. #mm
angleB1O2B2 = 60*math.pi/180 #rad
#To vary the Scilab function 'beta'
alpha = 120
beta = 240 #degrees
#Calculating the angular velocity of the quadant Q
omegaQ = vDO2/O2D #rad/s
#Calculating the linear speed of the rack
vR = omegaQ*rQ #mm/s
#Calculating the ratio of times of lowering and raimath.sing the rack
r = beta/alpha
#Calculating the length of stroke of the rack
L = rQ*angleB1O2B2 #mm
#Results:
print " The linear speed of the rack vR = %.1f mm/s."%(vR)
print " The ratio of times of lowering and raising the rack is %d."%(r)
print " The length of the stroke of the rack is %.2f mm."%(L)
```

In [2]:

```
import math
# Variables:
NPO = 120. #rpm
OQ = 100./1000 #mm
OP = 200./1000 #mm
RQ = 150./1000 #mm
RS = 500./1000 #m
#Solution:
#Refer Fig. 7.22
#Calculating the angular speed of the crank PO
omegaPO = 2*math.pi*NPO/60 #rad/s
#Calculating the velocity of P with respect to O
vPO = omegaPO*OP #m/s
vP = vPO
#By measurement from the velocity diagram Fig. 7.23(b)
vS = 0.8
vSR = 0.96
vTP = 0.85 #m/s
#Calculating the angular velocity of link RS
omegaRS = vSR/RS #rad/s
#Results:
print " The velocity of the slider S cutting tool vS = %.1f m/s."%(vS)
print " The angular velocity of the link RS omegaRS = %.2f rad/s clockwise about R."%(omegaRS)
print " The velocity of the sliding block T on the slotted lever QT vTP = %.2f m/s."%(vTP)
# note : answer in book is wrong
```

In [11]:

```
import math
# Variables:
NAD = 100. #rpm
TA = 50. #N-m
DA = 300./1000
CB = 360./1000
AB = CB
DC = 600./1000 #m
eta = 70./100 #%
#Solution:
#Refer Fig. 7.25
#Calculating the angular velocity of the crank AD
omegaAD = 2*math.pi*NAD/60 #rad/s
#Calculating the velocity of A with respect to D
vAD = omegaAD*DA #m/s
vA = vAD
#By measurement from the velocity diagram Fig. 7.25(b)
vBC = 2.25 #m/s
vB = vBC
#Calculating the angular velocity of the driven link CB
omegaBC = vBC/CB #rad/s
#Calculating the actual mechanical advantage
omegaA = omegaAD
omegaB = omegaBC
MAactual = eta*omegaA/omegaB
#Calculating the resisting torque
TB = eta*TA*omegaA/omegaB #N-m
#Results:
print " The velocity of the point B. vB = %.2f m/s."%(vB)
print " The angular velocity of the driven link CB. omegaBC = %.2f rad/s."%(omegaBC)
print " The actual mechanical advantage. M.A.actual) = %.2f."%(MAactual)
print " The resisting torque. TB = %.1f N-m."%(TB)
```

In [12]:

```
import math
# Variables:
WC = 2.5*1000
WD = 4.*1000 #N
OA = 175./1000 #mm
AB = 180./1000 #mm
AD = 500./1000 #mm
BC = 325./1000 #m
#Solution:
#Refer Fig. 7.26
#Assuming the speed of crank OA to be 'N'
#Calculating the angular velocity of crank OA
#Assume the vector oa (i.e. velocity of A) as 20 m/s
N = 20/(2*math.pi/60*OA) #mm
#By measurement from the velocity diagram Fig. 7.27(b)
vC = 35.
vD = 21. #mm
#Calculating the velocity ratio between C and the ram D
r = vC/vD #The velocity ratio between C and the ram D
#Calculating the efficiency of the machine
eta = (WD*vD)/(WC*vC)*100 #%
#Results:
print " The velocity ratio between C and the ram D is %.2f."%(r)
print " The efficiency of the machine eta = n %d %%."%(eta)
```

In [15]:

```
import math
# Variables:
NAO = 180. #rpm
OA = 180./1000 #mm
CB = 240./1000 #mm
AB = 360./1000 #mm
BD = 540./1000 #mm
FD = 2.*1000 #N
DA = 30./1000
DD = DA
rA = DA/2
rD = DD/2 #m
#Solution:
#Refer Fig. 7.28
#Calculating the angular velocity of the crank OA
omegaAO = 2*math.pi*NAO/60 #rad/s
#Calculating the velocity of A with respect to O
vAO = omegaAO*OA
vA = vAO
#By measurement fro the velocity diagram Fig. 7.29(b)
vD = 2.05
vBA = 0.9
vBC = 2.8
vDB = 2.4 #m/s
#Calculating the angular velocity of the link AB
omegaAB = vBA/AB #rad/s
#Calculating the angular velocity of the link CB
omegaCB = vBC/CB #rad/s
#Calculating the angular velocity of the link BD
omegaBD = vDB/BD #rad/s
#Calculating the relative angular velocity at A
rvA = omegaCB-omegaAB+omegaBD #The relative angular velocity at A rad/s
#Calculating the relative angular velocity at D
rvD = omegaBD #The relative angular velocity at D rad/s
#Calculating the velocity of rubbing on the pin A
vrA = rvA*rA*1000 #The velocity of rubbing on the pin A mm/s
#Calculating the velocity of rubbing on the pin D
vrD = rvD*rD*1000 #The velocity of rubbing on the pin D mm/s
#Calculating the torque applied to crank OA
TA = FD*vD/omegaAO #N-m
#Results:
print " The velocity of slider D vD = %.2f m/s."%(vD)
print " The angular velocity of the link AB, omegaAB = %.1f rad/s, anticlockwise about A."%(omegaAB)
print " The angular velocity of the link CB, omegaCB = %.2f rad/s, anticlockwise about C."%(omegaCB)
print " The angular velocity of the link BD, omegaBD = %.2f rad/s, clockwise about B."%(omegaBD)
print " The velocity of rubbing on the pin A is %d mm/s."%(vrA)
print " The velocity of rubbing on the pin D is %d mm/s."%(vrD)
print " The torque applied to the crank OA, TA = %.1f N-m."%(TA)
```

In [16]:

```
import math
# Variables:
NBA = 180 #rpm
AB = 0.45 #m
BD = 1.5 #m
BC = 0.9 #m
CE = BC #m
FD = 500.
FE = 750. #N
#Solution:
#Refer Fig. 7.31
#Calculating the angular velocity of the crank AB
omegaBA = 2*math.pi*NBA/60 #rad/s
#Calculating the velocity of B with respect to A
vBA = omegaBA*AB #m/s
vB = vBA
#By measurement from the velocity diagram Fig. 7.31(b)
vD = 9.5
vE = 1.7 #m/s
#Calculating the power input
Pi = FD*vD-FE*vE #N-m/s
#Calculating the turning moment at A
TA = Pi/omegaBA #N-m
#Results:
print " The velocity of slider D, vD = %.1f m/s."%(vD)
print " The velocity of slider E, vE = %.1f m/s."%(vE)
print " The turning moment at A, TA = %.1f N-m."%(TA)
```