DYNAMIC BALANCING OF SEVERAL MASSES ROTATING IN A SINGLE PLANE BY A SINGLE COUNTER MASS, USING PYTHON PROGRAMMING LANGUAGE.
AIM:
- Dynamic balancing of several masses rotating in single planes by a single counter mass, using python programming language.
OBJECTIVE:
- The four masses with its position and its radii is taken as the input (Dynamic) and also the radii of the counter mass is also taken as the input (Dynamic). Using these data, the value of counter mass that balances the all the four masses and its angle from the ‘+ve x’-axis, is found using Analytical method.
- The force polygon is drawn using the values from analytical method and also the force polygon is drawn using the graphical method is compared for accuracy check.
GOVERNING EQUATION:
- Reslove the centrifugal forces Horizontally and vertically and thier to find their sum
`sumFh = (m1xxr1xxcos theta1)+(m2xxr2xxcos theta2)+(m3xxr3xxcos theta3)+(m4xxr4xxcos theta4)`
`sumFv = (m1xxr1xxsin theta1)+(m2xxr2xxsin theta2)+(m3xxr3xxsin theta3)+(m4xxr4xxsin theta4)`
- To compute the magnitude of resultant centrifugal force
`Fcr = sqrt((sumFh)^2+(sumFv)^2`
- To calculate the value made by the resultant centrifugal force
`tanthetar=|frac {(sumFv)}{(sumFh)}|`
`thetar = tan^-1 xx|frac {(sumFv)}{(sumFh)}|`
- The balancing centifugal force is equal to the magnitude of the Resultant centifugal force but opposite in direction
`Fcr = Mc xx rc`
Where, 'Mc' is the counter mass im Kg and 'rc' is the radii position of the counter mass in meter
`thetac=180-thetar`
DETAILED CONTENT:
- Consider the number of masses (say four) m1, m2, m3, m4 attached to a shaft at a distance of r1, r2, r3, r4 from the axis of rotation of the shaft.
- The masses are at angular position `theta1, theta2, theta3, theta4` from the '+ve' X asis it is measure in anticlockwise direction.
- Since, `omega^2` is same for all the masses, the magnitude of centrifugal force for each mass is propotional to the product of masses and the radius of rotation.
- Hence in subsequent section the centrifugal force is taken as `mxxr` with unit `kgxxm`. And its couple due to centifugal force is taken as `mxxrxxl` with unit `kgxxm^2`.
- Refer the image, for the detailed view,

- All the four masses m1, m2, m3, m4 in Kg, attached to a shaft at a distance of r1, r2, r3, r4 in meters, from the axis of rotation of the shaft, masses are at angular position `theta1, theta2, theta3, theta4` in degrees from the '+ve' X axis are given as an input (Dynamic input). (Refer the below code)
- The pictorial representation of the masses attached to the shaft and the distance of location of masses from the shaft at the angular position is plotted using matplotlib module.(Refer the below code)
- Then with the input of all four masses, distance of masses from shaft and angulasr position, the sum of centrifugal forces Horizontally and vertically are computed using the above mentioned formulae and the values of both are printed. (Refer the below code)
- Then with the Summation of Horizontal cenrifugal forces and Summation of Vertical centifugal force the Resultant centrifugal force is computed using the above formulae and the value of resultant centrifual force is printed. (Refer the below code)
- The angular position of the resultant force is calculated using the above formulae and printed in degrees. (Refer the below code)
- Using the Resultant centifugal force the counter mass that required to balance all the masses at a particualr distance from the shaft 'rc' (Which is also given as the dynamic input), is computed using the above formulae and the value of the counter mass in Kg is printed. (Refer the below code)
- The Angular position of the counter mass is then calculated and printed. (Refer the below code)
- Thus, using matplotlib module, the force polygon using the analytical value is plotted and it is compared with the force polygon using graphical method. (Refer the below code)
PYTHON CODE WITH EXPLAINATION:
#Dynamic balancing of several masses rotating in same planes using a single counter mass
#Input the required modules /Library for this program
import math
import numpy as np
import matplotlib.pyplot as plt
from tabulate import tabulate
#Dynamic input for the four masses, its position, and its angle
m1 = int (input('Enter the mass-1 in kg, m1 : '))
m2 = int (input('Enter the mass-2 in kg, m2 : '))
m3 = int (input('Enter the mass-3 in kg, m3 : '))
m4 = int (input('Enter the mass-4 in kg, m4 : '))
r1 = float (input('Enter the position (radii) of mass-1 in m, r1 : '))
r2 = float (input('Enter the position (radii) of mass-2 in m, r2 : '))
r3 = float (input('Enter the position (radii) of mass-3 in m, r3 : '))
r4 = float (input('Enter the position (radii) of mass-4 in m, r4 : '))
rc = float (input('Enter the position (radii) of counter_mass in m, rc : '))
theta1 = int (input ('Enter the angle of mass-1, from +ve x-axis, theta1 : '))
theta2 = int (input ('Enter the angle of mass-2, from +ve x-axis, theta2 : '))
theta3 = int (input ('Enter the angle of mass-3, from +ve x-axis, theta3 : '))
theta4 = int (input ('Enter the angle of mass-4, from +ve x-axis, theta4 : '))
theta_1 =math.radians(theta1)
theta_2 =math.radians(theta2)
theta_3 = math.radians(theta3)
theta_4 = math.radians(theta4)
#Horizontal force component (Summation of horizontal force components)
horizontal_force_component =( (m1*r1*math.cos(theta_1)) +(m2*r2*math.cos(theta_2))+(m3*r3*math.cos(theta_3))+(m4*r4*math.cos(theta_4)))
print ('The summation of Horizontal force components in kg-m : ', horizontal_force_component)
#Vertical force component (Summation of horizontal force components)
vertical_force_component =( (m1*r1*math.sin(theta_1)) +(m2*r2*math.sin(theta_2))+(m3*r3*math.sin(theta_3))+(m4*r4*math.sin(theta_4)))
print ('The summation of Vertical force components in kg-m : ', vertical_force_component)
#Resultant force
resultant_force=pow((pow(horizontal_force_component,2)+ pow(vertical_force_component,2)),0.5)
print ('Resultant force in kg-m : ', resultant_force)
#Angle of resultant force
x= abs(vertical_force_component / horizontal_force_component)
thetar = math.atan(x)
print('The Resultant angle in degree : ', math.degrees(thetar))
#Counter mass
counter_mass = resultant_force/rc
print ('Counter mass in kg :', counter_mass)
#Angle of the position of counter mass
thetac = 180-math.degrees(thetar)
print ('Angular position of Counter mass in degrees :',thetac)
theta_c = math.radians(thetac)
#PLOTTING THE RESULTANT
x0=0
y0=0
x1=m1*r1*math.cos(theta_1)
y1=m1*r1*math.sin(theta_1)
x2=m2*r2*math.cos(theta_2)
y2=m2*r2*math.sin(theta_2)
x3=m3*r3*math.cos(theta_3)
y3=m3*r3*math.sin(theta_3)
x3=m3*r3*math.cos(theta_3)
y3=m3*r3*math.sin(theta_3)
x4=m4*r4*math.cos(theta_4)
y4=m4*r4*math.sin(theta_4)
xc=counter_mass*rc*math.cos(theta_c)
yc=counter_mass*rc*math.sin(theta_c)
#Pictorial Representation of position of all the four masses
plt.figure(1)
plt.plot ((-100,100),(0,0),'b--')
plt.plot((0,0),(-100,100), 'b--')
plt.plot (x0,y0,'o',markersize = 25)
plt.plot ((x0,x1),(y0,y1), label ='Position of mass-1 in a shaft')
plt. plot (x1,y1, 'o', markersize = 15, color = 'r')
plt.plot ((x0,x2), (y0,y2), label ='Position of mass-2 in a shaft')
plt. plot (x2,y2, 'o', markersize = 15, color = 'r')
plt.plot ((x0,x3),(y0,y3), label ='Position of mass-3 in a shaft')
plt. plot (x3,y3, 'o', markersize = 15, color = 'r')
plt.plot ((x0,x4), (y0,y4), label ='Position mass-4 in a shaft')
plt. plot (x4,y4, 'o', markersize = 15, color = 'r')
plt.title('Visualizing the position of all for masses in the shaft (Side view)')
plt.legend (loc='best')
plt.savefig('Visualize')
#The Plot of Force polygon using values from Analytical method
plt.figure(2)
plt.plot ((x0,x1),(y0,y1), label ='centrifugal force of mass-1')
plt.plot ((x1,x2), (y1,y2), label ='centrifugal force of mass-2')
plt.plot ((x2,x3),(y2,y3), label ='centrifugal force of mass-3')
plt.plot ((x3,x4), (y3,y4), label ='centrifugal force of mass-4')
plt.plot ((x4,xc), (y4,yc), label ='centrifugal force of counter_mass')
plt.title('Force Polygon using Analytical Method')
plt.legend (loc='best')
plt.savefig('Force Polygon (By Analytical Method)')
#The Plot of Force polygon using Graphical method
plt.figure (3)
plt.plot ((x0,x1),(y0,y1), label ='centrifugal force of mass-1')
plt.plot ((x1,x2), (y1,y2), label ='centrifugal force of mass-2')
plt.plot ((x2,x3),(y2,y3), label ='centrifugal force of mass-3')
plt.plot ((x3,x4), (y3,y4), label ='centrifugal force of mass-4')
plt.plot ((x4,x0), (y4,y0), label ='centrifugal force of counter_mass')
plt.legend (loc='best')
plt.title('Force Polygon (By Graphical Method)')
plt.savefig('Force Polygon (By Graphical Method)')
OUTPUT AND RESULT:
- Based on the Dynamic input, value of the resultant centifugal force and its angular position, counter mass that balances the all the four masses and its angle position are shown in the output image below,

- Based on the Dynamic input, plotted image gives the pictorial representation of masses attached to the shaft and the distance of location of masses from the shaft at the angular position is shown below,
- The force polygon plotted using the values from the Analytical method for finding the counter mass for balancing all four masses is shown below,

- The force polygon plotted using the values from the graphical method for finding the counter mass for balancing all four masses is shown below,

CONCLUSION:
- Thus the Counter mass and its angular postion that required to balance the other four rotating masses connected to the shaft is computed using analytical method and the Force polygon using the values obtained from the analytical method is plotted and the Force polygon obtained from the graphical method is also plotted.
- By comparing the force polygen, we can conclude that the force polygon obtained using the values from the analytical method, doesn't form a closed ploygon and has a minor error, may be in the angular position of the counter mass.
- In graphical method, the polygon is closed first and using that the plot, the counter mass and the angular position can be calcuated. So, I'll conclude that there can be minor error in position of angle while computing in analytical method.