ME352 Flywheel Assignment

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

ME352

Theory of Mechanisms and Machines


Flywheel Assignment

Name: Avi
Roll No: 180164
Code
function dydt=sol3(t,y)
%Constants
M = 10; k = 1000; c = 20; mf = 4; J = 1; L = 0.25; mA1 = 0.15; mB = 0.06;
ms = 0.3; r = 0.1; mA2 = 0.1; g2=(mB*L)/(mA1+mB);
mC = 3; Lc = 2; %0.02<mc<3 0.001<Lc<2
g1=(r*mA2-Lc*mC)/(mf+mA2+mC);I1=mA2*(r-
g1)^2+mC*(g1+Lc)^2+J+mf*g1^2;
%independent variables
th=y(1); thd=y(2); x=y(3);xd=y(4);
%angular velocity and velocity
th2=asin(-r*sin(th)/L);
xs=x+r*exp(i*th)+L*exp(i*th2);
c1=i*r*exp(i*th);c2=i*L*exp(i*th2);
P=[-c2,1];
Q=xd+c1*thd;
P=[real(P);imag(P)];
Q=[real(Q);imag(Q)];
R=P\Q;
th2d=R(1);
xsd=R(2);

ag1=-(thd^2)*g1*exp(i*th);
Mt1=mf+mA2+mC;
Mt2=mA1+mB;
ag2=-(thd^2)*r*exp(i*th)-(th2d^2)*g2*exp(i*th2); %CHANGE
I2=(mA1*g2*g2 + mB*(L-g2)*(L-g2));
P1=[M,0,0,0,1,0,0,0,0,0;
-Mt1,-Mt1*real(i*g1*exp(i*th)),0,0,1,0,1,0,0,0;
0,-Mt1*imag(i*g1*exp(i*th)),0,0,0,1,0,1,0,0;
-Mt2,-Mt2*real(i*r*exp(1i*th)),-Mt2*real(i*g2*exp(i*th2)),0,0,0,-1,0,1,0;
0,-Mt2*imag(i*r*exp(i*th)),-Mt2*imag(i*g2*exp(i*th2)),0,0,0,0,-1,0,1;
0,0,0,ms,0,0,0,0,1,0;
1,real(c1),real(c2),-1,0,0,0,0,0,0;
0,imag(c1),imag(c2),0,0,0,0,0,0,0;
0,-I1,0,0,g1*sin(th),-g1*cos(th),-(r-g1)*sin(th),(r-g1)*cos(th),0,0;
0,0,-I2,0,0,0,g2*sin(-th2),g2*cos(th2),(L-g2)*sin(-th2),(L-g2)*cos(th2)];

Q1=[-k*x-c*xd;
real(Mt1*ag1);
imag(Mt1*ag1);
real(Mt2*ag2);
imag(Mt2*ag2);
0;
real((thd^2)*c1/i+(th2d^2)*c2/i);
imag((thd^2)*c1/i+(th2d^2)*c2/i);
0;
0];
R1 = P1\Q1;
dydt = [y(2);
R1(2);
y(4);
R1(1)];
In command Window

op = odeset('reltol',1e-7,'abstol',1e-7)
[t,y] = ode45('sol3',[0 t], [1;20;0;0], op)
Theta dot vs time graph for different values of mC and LC used :
1st figure is the required figure and the 2nd has other graphs I made which
were good enough but not optimal and the 3rd graph is a closeup of 2. In our
first try I started with mc*lc=ma2*r And then tried to reduce the moment of
inertia. Doing this I found a good solution mc=3 lc=1/300 and to verify this I
went out of bounds and found a similar solution with less Moment of Inertia
which was better. But as I couldn’t find a particular reason for this, I tried using
iterative methods. I drew a mean curve for theta dot and then selected one
with the least slope. But I couldn’t do this iteratively (ode 45 doesn’t accept
other arguments) so ultimately, I manually did the iterations and found the
above answer.
Theta Dot vs time graph for optimal value of Lc and mC, varied over J.

Observations -
1. It can be seen from the graph that the amplitude of oscillations is more
for J = 0.2 when compared to J = 1.
2. It can be seen that the value of theta dot decreases more rapidly for
J = 0.2 when compared to J = 1.
It seems as J*alpha is a term in the torque equation. If J increases alpha
decreases in magnitude and resultant theta dot variation also decreases.

You might also like