#Program 1: KINEMATIC ANALYSIS OF HOOKE'S JOINT
print("SAVITRIBAI PHULE PUNE UNIVERSITY")
print("\n SUBJECT: KINEMATICS OF MACHINERY")
print("\n KINEMATIC ANALYSIS OF HOOKE'S JOINT")
import math #import Math Library
import matplotlib.pyplot as plt #import Library to plot Polar Diagram
print("\n ----------------------------------------------STUDENT DETAILS--------------------------------------
----------------------")
n1=(input("ENTER YOUR NAME::"))
r1=int(input("ENTER YOUR ROLL NUMBER::"))
print("\n ---------------------------------------------INPUT PARAMETERS-----------------------------------
")
w1=float(input("Velocity of input shaft (RPM)::"))
alpha=float(input("shaft angle IN DEGREE::"))
alpha= math.radians(alpha) # Convert angle into radian
ang=[] # Empty Cell to store angle values
velocity=[] # Empty Cell to store velocity Values
print("\n ---------------------------------------------POLAR DIGRAM-----------------------------------")
for i in range(0,361): # plot the velocity of output shaft for angle ranging 0 to 360 with
1 degree inteval
ang.append(i) # Value of i will be stored in Empty ang=[] cell
ang_r = math.radians(i) # value of theta
w2 = (w1 * math.cos(alpha)) / (1 - ((math.cos(ang_r)) ** 2) * ((math.sin(alpha)) ** 2)) #
formula of velocity ratio for hooks joint
w2=round(w2,4) # Round of velocity value upto precision points.
velocity.append(w2) # Value of velocity will be stored in empty Ang_velocity=[] cell
plt.axes(projection='polar') # draw polar plot
for i in range(0,361): # plot the velocity of output shaft for angle ranging 0 to 360 with 1
degree inteval
plt.polar(math.radians(ang[i]), w1, 'r.') # plot polar diagram of input shaft
plt.polar(math.radians(ang[i]), velocity[i], 'g.') # plot polar diagram of output shaft
plt.title("POLAR DIAGRAM") # Title of Diagram
plt.legend(labels=('Input speed', 'Output speed'), loc=1) # Add legend
plt.show() # plot diagram
print("\n ---------------------------------------------------------------------------------------------------------------
--")
print("MAXIMUM VELOCITY: ",velocity[0]) # print Maximum velocity
print("MINIMUM VELOCITY: ",velocity[90]) # print Minimum velocity
for h in range(0,361,60): # print vslus of output speed at an interval of 60
degree
print("for angle ",ang[h],"= ","Angular velocity of output shaft", velocity[h]," RPM")
OUTPUT
SAVITRIBAI PHULE PUNE UNIVERSITY
SUBJECT: KINEMATICS OF MACHINERY
KINEMATIC ANALYSIS OF HOOKE'S JOINT
----------------------------------------------STUDENT DETAILS-------------
-----------------------------------------------
ENTER YOUR NAME::kjhg
ENTER YOUR ROLL NUMBER::10
---------------------------------------------INPUT PARAMETERS-------------
----------------------
Velocity of input shaft (RPM)::1000
shaft angle IN DEGREE::15
---------------------------------------------POLAR DIGRAM-----------------
------------------
MAXIMUM VELOCITY: 1035.2762
MINIMUM VELOCITY: 965.9258
for angle 0 = Angular velocity of output shaft 1035.2762 RPM
for angle 60 = Angular velocity of output shaft 982.3775 RPM
for angle 120 = Angular velocity of output shaft 982.3775 RPM
for angle 180 = Angular velocity of output shaft 1035.2762 RPM
for angle 240 = Angular velocity of output shaft 982.3775 RPM
for angle 300 = Angular velocity of output shaft 982.3775 RPM
for angle 360 = Angular velocity of output shaft 1035.2762 RPM
# Program 2: 3 Position SYNTHESIS OF 4 BAR MECHANISM
import numpy as np
import math
from math import *
print("SAVITRIBAI PHULE PUNE UNIVERSITY")
print("\n SUBJECT: KINEMATICS OF MACHINERY")
print("\n SYNTHESIS OF 4 BAR MECHANISM")
print("\n ----------------------------------------------STUDENT DETAILS--------------------------------------
----------------------")
n1=(input("ENTER YOUR NAME::"))
r1=int(input("ENTER YOUR ROLL NUMBER::"))
print("\n ---------------------------------------------INPUT PARAMETERS-----------------------------------
")
i1 = float(input("FIRST POSITION OF INPUT LINK::"))
i2 = float(input("SECOND POSITION OF INPUT LINK::"))
i3 = float(input("THIRD POSITION OF INPUT LINK::"))
o1 = float(input("FIRST POSITION OF OUTPUT LINK::"))
o2 = float(input("SECOND POSITION OF OUTPUT LINK::"))
o3 = float(input("THIRD POSITION OF OUTPUT LINK::"))
d = float(input("ENTER LENGTH OF FIXED LINK::"))
i1 = math.radians(i1)
i2 = math.radians(i2)
i3 = math.radians(i3)
o1 = math.radians(o1)
o2 = math.radians(o2)
o3 = math.radians(o3)
A = np.array([[math.cos(o1), -math.cos(i1), 1], [math.cos(o2), -math.cos(i2), 1],
[math.cos(o3), -math.cos(i3), 1]])
print(A)
B = np.array([math.cos(i1 - o1), math.cos(i2 - o2), math.cos(i3 - o3)])
print(B)
m1 = np.linalg.inv(A)
m2 = np.dot(m1, B)
print("\n ---------------------------------------------Values of k1 k2 k3-----------------------------------")
print(f'Values of k1 k2 k3 {m2}')
a = d / m2[0] # first link length A
c = d / m2[1] # second link length B
k3 = m2[2]
b = (((a ** 2) + (c** 2) + (d ** 2)) - (2 * a * c * k3))** 0.5
a = round(abs(a), 2)
c = round(abs(c), 2)
b = round(abs(b), 2)
print("\n ---------------------------------------------RESULT-----------------------------------")
print(f'Length Of The Links...\n1) link a={a} mm\n2)link b={b} mm\n3)link c={c} mm\n4)link
d={d} mm')
OUTPUT
SAVITRIBAI PHULE PUNE UNIVERSITY
SUBJECT: KINEMATICS OF MACHINERY
SYNTHESIS OF 4 BAR MECHANISM
----------------------------------------------STUDENT DETAILS---------
---------------------------------------------------
ENTER YOUR NAME::Keshav
ENTER YOUR ROLL NUMBER::0
---------------------------------------------INPUT PARAMETERS---------
--------------------------
FIRST POSITION OF INPUT LINK::30
SECOND POSITION OF INPUT LINK::45
THIRD POSITION OF INPUT LINK::60
FIRST POSITION OF OUTPUT LINK::40
SECOND POSITION OF OUTPUT LINK::30
THIRD POSITION OF OUTPUT LINK::20
ENTER LENGTH OF FIXED LINK::50
[[ 0.76604444 -0.8660254 1. ]
[ 0.8660254 -0.70710678 1. ]
[ 0.93969262 -0.5 1. ]]
[0.98480775 0.96592583 0.76604444]
---------------------------------------------Values of k1 k2 k3-------
----------------------------
Values of k1 k2 k3 [ 3.09504513 -2.06601031 -3.17535178]
---------------------------------------------RESULT-------------------
----------------
Length Of The Links...
1) link a=16.15 mm
2)link b=29.39 mm
3)link c=24.2 mm
4)link d=50.0 mm
#Program 3: KINEMATIC ANALYSIS OF SLIDER CRANK MECHANISM
import math
import matplotlib.pyplot as plt
print("SAVITRIBAI PHULE PUNE UNIVERSITY")
print("\n SUBJECT: KINEMATICS OF MACHINERY")
print("\n KINEMATIC ANALYSIS OF SLIDER CRANK MECHANISM")
print("\n ----------------------------------------------STUDENT DETAILS--------------------------------------
----------------------")
n1=(input("ENTER YOUR NAME::"))
r1=int(input("ENTER YOUR ROLL NUMBER::"))
print("\n ----------------------------------------------INPUT PARAMETER-------------------------------------
-----------------------")
r=float(input("Enter crank radius::"))
n=float(input("Enter Obliquity ratio::"))
w=float(input("Angular Velocity(Rad/Sec)::"))
print("\n ----------------------------------------------VELOCITY AND ACCELERATION PLOT-----------
-------------------------------------------------")
ang=[] #Value of angles store in this list
disp=[] #Value of displacement store in this list
vel=[] #Value of Velocity store in this list
acc=[] #Value of Acceleration store in this list
for i in range(0,360): #change value of angle(i) from 0 to 360
ang.append(i) #Store value of i in "ang" List
a = math.radians(i) #Angele Conversion
d1 = r * ((1- math.cos(a) ) + (math.sin(a))* (math.sin(a)) / (2 * n))
displacement = round(d1, 4)
v1 = w * r * (math.sin(a) + (math.sin(2 * a)) / (2 * n))
velocity = round(v1, 4)
a1 = (w ** 2) * r * (math.cos(a) + ((math.cos(2 * a)) / n))
acclr = round(a1, 4) #round value of acceleration upto 4 Digit
disp.append(displacement) #Store value of displacement in "disp"
List
vel.append(velocity) #Store value of velocity in "vel" List
acc.append(acclr) #Store value of acceleration in "acc" List
fig, axs = plt.subplots(3) #Mention 3 graph
#Displacement Graph
axs[0].plot(ang, disp)
axs[0].set_title('Displacement')
#Velocity Graph
print("----------")
axs[1].plot(ang, vel)
axs[1].set_title('Velocity')
#Acceleration Graph
axs[2].plot(ang, acc)
axs[2].set_title('Acceleration')
plt.show()
print("\n ----------------------------------------------RESULT------------------------------------------------------
------")
for h in range(0,360,45):
print("for angle ",ang[h], "= "," dispalcement ", disp[h]," velocity ", vel[h], " Acceleration ",
acc[h])
OUTPUT
SAVITRIBAI PHULE PUNE UNIVERSITY
SUBJECT: KINEMATICS OF MACHINERY
KINEMATIC ANALYSIS OF SLIDER CRANK MECHANISM
----------------------------------------------STUDENT DETAILS---------
---------------------------------------------------
ENTER YOUR NAME::Keshav
ENTER YOUR ROLL NUMBER::01
----------------------------------------------INPUT PARAMETER---------
---------------------------------------------------
Enter crank radius::40
Enter Obliquity ratio::4
Angular Velocity(Rad/Sec)::60
----------------------------------------------VELOCITY AND ACCELERATIO
N PLOT-----------------------------------------------
----------------------------------------------RESULT-------------------
-----------------------------------------
for angle 0 = dispalcement 0.0 velocity 0.0 Acceleration 180000
.0
for angle 45 = dispalcement 14.2157 velocity 1997.0563 Accelerat
ion 101823.3765
for angle 90 = dispalcement 45.0 velocity 2400.0 Acceleration -
36000.0
for angle 135 = dispalcement 70.7843 velocity 1397.0563 Accelera
tion -101823.3765
for angle 180 = dispalcement 80.0 velocity 0.0 Acceleration -10
8000.0
for angle 225 = dispalcement 70.7843 velocity -1397.0563 Acceler
ation -101823.3765
for angle 270 = dispalcement 45.0 velocity -2400.0 Acceleration
-36000.0
for angle 315 = dispalcement 14.2157 velocity -1997.0563 Acceler
ation 101823.3765