Vous êtes sur la page 1sur 7

KULLIYYAH OF ENGINEERING

DEPARTMENT OF MECHATRONICS ENGINEERING

MCT 2110
Mechatronics Lab 1
Theory of Machines and Mechanisms
MATLAB ASSIGNMENT
Group Members:
1. YUSUF KHALID MASOOD
2. IBRAHIM ISMAIL BIN HAFID
3. AHMAD KHAIRUL AZMAN B. MOHD

(0723411)
(0723787)
(0726959)

DETERMINING THE MOMENT OF INERTIA OF A


FLYWHEEL USING MATLAB

CODING
%The given inputs are
storedtheta_2=[];
storedf_12_x=[];
storedf_12_y=[];
storedf_23_x=[];
storedf_23_y=[];
storedf_34_x=[];
storedf_34_y=[];
storedf_14_y=[];
storedm_12=[];
r_2=2.5; r_3=10; b_2=1.25; b_3=6.67;
m_2=2.46; m_3=9.84; m_4=10; ig_3=82;
omega_2=55;
alpha_2=0;
for theta_2=0:pi/72:pi;
theta_2d=theta_2*180/pi;
theta_3d=180-asind(r_2*sind(theta_2d)/r_3);
theta_3=theta_3d*pi/180;
omega_3=r_2*omega_2*cos(theta_2)/(r_3*cos(theta_3));
alpha_3=(-r_2*omega_2^2*sin(theta_2));
r_4=r_2*cos(theta_2)-r_3*cos(theta_3);
v_4=r_2*omega_2*sin(theta_3-theta_2)/cos(theta_3);
a_4=(-r_2*omega_2*cos(theta_3-theta_2)+...
r_2*alpha_2*sin(theta_3-theta_2)+r_3*omega_3^2)/cos(theta_3);
a_33=-r_2*sin(theta_2);
a_34=r_2*cos(theta_2);
a_63=r_3*sin(theta_3)-b_3*sin(theta_3);
a_64=-r_3*cos(theta_3)+b_3*cos(theta_3);
a_65=-b_3*sin(theta_3);
a_66=b_3*cos(theta_3);
A=[-1 0 1 0 0 0 0 0;
0 -1 0 1 0 0 0 0;
0 0 a_33 a_34 0 0 0 1;
0 0 -1 0 -1 0 0 0;
0 0 0 -1 0 -1 0 0;

0 0 a_63 a_64 a_65 a_66 0 0;


0 0 0 0 1 0 0 0;
0 0 0 0 0 1 -1 0];
a_g2_x=-b_2*omega_2^2*cos(theta_2);
a_g2_y=-b_2*omega_2^2*sin(theta_2);
a_g3_x=-r_2*omega_2^2*cos(theta_2)+...
omega_3^2*(r_3*cos(theta_3)-b_3*cos(theta_3))+...
alpha_3*(r_3*sin(theta_3)-b_3*sin(theta_3));
a_g3_y=-r_2*omega_2^2*sin(theta_2)+...
omega_3^2*(r_3*sin(theta_3)-b_3*sin(theta_3))-...
alpha_3*(r_3*cos(theta_3)-b_3*cos(theta_3));
a_g4_x=(-r_2*omega_2^2*cos(theta_3-theta_2)+r_3*omega_3^2)/cos(theta_3);
B=[m_2*a_g2_x;m_2*a_g2_y;0;m_3*a_g3_x;m_3*a_g3_y;ig_3*alpha_3;m_4*a_g4_x;
0];
X=inv(A)*B;
f_12_x=X(1);
f_12_y=X(2);
f_23_x=X(3);
f_23_y=X(4);
f_34_x=X(5);
f_34_y=X(6);
f_14_y=X(7);
m_12=X(8);
storedtheta_2=[storedtheta_2 theta_2];
storedf_12_x=[storedf_12_x f_12_x];
storedf_12_y=[storedf_12_y f_12_y];
storedf_23_x=[storedf_23_x f_23_x];
storedf_23_y=[storedf_23_y f_23_y];
storedf_34_x=[storedf_34_x f_34_x];
storedf_34_y=[storedf_34_y f_34_y];
storedf_14_y=[storedf_14_y f_14_y];
storedm_12=[storedm_12 m_12];
end
for theta_2=pi:pi/72:2*pi;
theta_2d=theta_2*180/pi;
theta_3d=180-asind(r_2*sind(theta_2d)/r_3);
theta_3=theta_3d*pi/180;

omega_3=r_2*omega_2*cos(theta_2)/(r_3*cos(theta_3));
alpha_3=(-r_2*omega_2^2*sin(theta_2));
r_4=r_2*cos(theta_2)-r_3*cos(theta_3);
v_4=r_2*omega_2*sin(theta_3-theta_2)/cos(theta_3);
a_4=(-r_2*omega_2*cos(theta_3-theta_2)+...
r_2*alpha_2*sin(theta_3-theta_2)+r_3*omega_3^2)/cos(theta_3);
a_33=-r_2*sin(theta_2);
a_34=r_2*cos(theta_2);
a_63=r_3*sin(theta_3)-b_3*sin(theta_3);
a_64=-r_3*cos(theta_3)+b_3*cos(theta_3);
a_65=-b_3*sin(theta_3);
a_66=b_3*cos(theta_3);
A=[-1 0 1 0 0 0 0 0;
0 -1 0 1 0 0 0 0;
0 0 a_33 a_34 0 0 0 1;
0 0 -1 0 -1 0 0 0;
0 0 0 -1 0 -1 0 0;
0 0 a_63 a_64 a_65 a_66 0 0;
0 0 0 0 1 0 0 0;
0 0 0 0 0 1 -1 0];
a_g2_x=-b_2*omega_2^2*cos(theta_2);
a_g2_y=-b_2*omega_2^2*sin(theta_2);
a_g3_x=-r_2*omega_2^2*cos(theta_2)+...
omega_3^2*(r_3*cos(theta_3)-b_3*cos(theta_3))+...
alpha_3*(r_3*sin(theta_3)-b_3*sin(theta_3));
a_g3_y=-r_2*omega_2^2*sin(theta_2)+...
omega_3^2*(r_3*sin(theta_3)-b_3*sin(theta_3))-...
alpha_3*(r_3*cos(theta_3)-b_3*cos(theta_3));
a_g4_x=(-r_2*omega_2^2*cos(theta_3-theta_2)+r_3*omega_3^2)/cos(theta_3)+2500;
B=[m_2*a_g2_x;m_2*a_g2_y;0;m_3*a_g3_x;m_3*a_g3_y;ig_3*alpha_3;m_4*a_g4_x;
0];
X=inv(A)*B;
f_12_x=X(1);
f_12_y=X(2);
f_23_x=X(3);
f_23_y=X(4);
f_34_x=X(5);
f_34_y=X(6);
f_14_y=X(7);

m_12=X(8);
f_s=sqrt(f_12_x^2+(f_12_y+f_14_y)^2);
storedtheta_2=[storedtheta_2 theta_2];
storedf_12_x=[storedf_12_x f_12_x];
storedf_12_y=[storedf_12_y f_12_y];
storedf_23_x=[storedf_23_x f_23_x];
storedf_23_y=[storedf_23_y f_23_y];
storedf_34_x=[storedf_34_x f_34_x];
storedf_34_y=[storedf_34_y f_34_y];
storedf_14_y=[storedf_14_y f_14_y];
storedm_12=[storedm_12 m_12];
end
theta_2=storedtheta_2;
torque=storedm_12;
plot(theta_2,torque,'r*-')
xlim([0 2*pi])
grid on
hold on
torque_avg=(-1)*(trapz(torque,theta_2)/(2*pi));
[m,n]=size(theta_2);
torque_avg=torque_avg+zeros(1,n);
plot(theta_2,torque_avg,'bo-')
torque_load=torque-torque_avg;
plot(theta_2,torque_load,'gs-')
% theta_2;
% torque_load;
%for sample
base_1=[0 0.0436 0.0873 0.1309 0.1745 0.2182 0.2618 0.3054];
t_1=[ -1.9891 -1.4046 -0.8217 -0.2421 0.3326 0.9006 1.4603
2.0097]*1.0e+004;
e_1=(-1)*(trapz(t_1,base_1));
base_2=[ 0.3491 0.3927 0.4363 0.4800 0.5236 0.5672 0.6109 0.6545
0.6981 0.7418 0.7854 0.8290 0.8727 0.9163 0.9599 1.0036 1.0472
1.0908 1.1345 1.1781 1.2217 1.2654 1.3090 1.3526 1.3963 1.4399
1.4835 1.5272 1.5708 1.6144 1.6581 1.7017 1.7453 1.7890 1.8326
1.8762 1.9199 1.9635 2.0071 2.0508 2.0944 2.1380 2.1817 2.2253
2.2689 2.3126 2.3562 2.3998 2.4435 2.4871 2.5307 2.5744 2.6180
2.6616 2.7053 2.7489 2.7925];
% t_2=[ -1.9891 -1.4046 -0.8217 -0.2421 0.3326 0.9006 1.4603
2.0097]*1.0e+004

t_2=[ 2.5472 3.0709 3.5790 4.0696 4.5410 4.9915 5.4196 5.8236 6.2024
6.5549 6.8802 7.1778 7.4473 7.6888 7.9025 8.0889 8.2489 8.3836
8.4942 8.5823 8.6492 8.6968 8.7266 8.7404 8.7396 8.7257 8.7000
8.6634 8.6169 8.5610 8.4961 8.4222 8.3392 8.2467 8.1442 8.0310
7.9062 7.7689 7.6182 7.4530 7.2724 7.0756 6.8616 6.6299 6.3799
6.1112 5.8235 5.5167 5.1909 4.8465 4.4838 4.1033 3.7058 3.2921
2.8632 2.4201 1.9641 ]*1.0e+004;
e_2=(-1)*(trapz(t_2,base_2));
e_3=(-1)*(trapz(torque_load,theta_2));
e=[e_1 e_2 e_3];

d_e=max(e)-min(e)
m_i=d_e/(omega_2^2*0.02)
r=0.1
m=2*m_i/r^2

Answer:
d_e =
1.3102e+005
m_i =
2.1655e+003
r=
0.1000
m=
4.3311e+005

PLOT
4

12

x 10

10
8
6
4
2
0
-2
-4
-6
-8

Torque Curves

Vous aimerez peut-être aussi