FINAL INDEPENDENT PROJECT
AIM : In this project we have to do codding in MATLAB. In a such a way that any value of cam & follower which rise and fall as per SHM (simple harmonic motion ) , should give displacement , velocity, acceleration graph with maximum value and minimum value of velocity,acceleration
Introduction :
A cam is a rotating machine element which gives reciprocating or oscillating motion to another element known as follower. Constitute a higher pair (line contact) The cam normally rotates while the follower may translate or oscillates. Kinematic cam design is mainly concerned with the generation of the cam profile.
Operating the inlet and exhaust valves of IC engines. Automatic attachment of machineries Paper cutting machines Spinning and weaving textile machineries. Feed mechanism of automatic lathes
In mechanics and physics, simple harmonic motion is a special type of periodic motion where the restoring force on the moving object is directly proportional to, and opposite of, the object's displacement vector. It results in an oscillation which, if uninhibited by friction or any other dissipation of energy, continues indefinitely.
Simple harmonic motion can serve as a mathematical model for a variety of motions, but is typified by the oscillation of a mass on a spring when it is subject to the linear elastic restoring force given by Hooke's law. The motion is sinusoidal in time and demonstrates a single resonant frequency. Other phenomena can be modelled by simple harmonic motion, including the motion of a simple pendulum, although for it to be an accurate model, the net force on the object at the end of the pendulum must be proportional to the displacement (and even so, it is only a good approximation when the angle of the swing is small; see small-angle approximation). Simple harmonic motion can also be used to model molecular vibration as well. Simple harmonic motion provides a basis for the characterization of more complicated periodic motion through the techniques of Fourier analysis.
In this codding we have try different way to solve this problem .
- We can take input of “rise , fall ” from user in the form of number
eg :
num=input('input rise(1) dwell(2) fall(3) : ' )
Due to this user will enter rise as 1, dwell as 2 & fall as 3
Suppose user enter “1231”
That means “rise dwell fall dwell”
Now we have to separate “1231” so we divide “1231” by 1000 and store that number in “num” and pass the num data in “floor” command
clear all
clc
num=1231
num=num/1000;
a=floor(num)
num=num-a;
num=num*10;
b=floor(num)
num=num-b;
num=num*10;
c=floor(num)
num=num-c;
d=num*10
After separating it we use a “for loop” , for a==1 inside that we write a code for calculation for rise , BUT THIS TYPE OF STEP TAKE MORE TIME AND ALSO COMPLEX
- Another was their same as the above but we will take “rise fall dwell” in the form of string not as number but this was step is also same as above
In this we have to use strcmp(input, rise) in “for loop” nside that we write a code for calculation for rise, fall etc.BUT THIS TYPE OF STEP TAKE MORE TIME AND ALSO COMPLEX
After so many permutation and combination we done this coding which give proper output.
ACTUALL CODING
clear all
clc
disp('This general coding is for rising in SHAM & falling in SHM' )
disp('Rising - Dwell - Fall - Dwell')
th1=input('enter rise angle : ')
th2=input('enter 1st dwell angle : ')
th3=input('enter fall angle : ')
th4=input('enter 2nd dwell angle : ')
w=input('enter w value in r/s : ')
l=input('enter lengeth or maximum displacement : ')
%___________________ for displacement________________________________
%for displacement rise
th=linspace(0,th1,500);
s=l/2*(1-cosd(180/th1*th));
figure(1)
plot(th,s,'LineWidth',2,'color','k')
title('displacement vs angle')
xlabel('angle')
ylabel('displacement')
grid on
hold on
%displacement dwell 1
td=th2+th1;
th=[th1:td];
yy=s(1,500);
plot([th1 th1+th2],[yy yy],'LineWidth',2,'color','b')
hold on
%displacement fall
tf=td+th3;
th=linspace(td,tf,500);
thp=linspace(0,th3,500);
s=l/2*(1+cosd(180/th3*thp));
plot(th,s,'LineWidth',2,'color','r')
hold on
%displacement dwell 2
td=tf+th4;
th=[th3:td];
yy=s(1,500);
plot([th1+th2+th3 td],[yy yy],'LineWidth',2,'color','b')
hold off
%_____________________for velocity________________________________
% velocity rise
th=linspace(0,th1,500);
v=sin(pi*th/th1)*l*w*90/th1;
max_velocity_in_rise=max(v)
figure(2)
plot(th,v,'LineWidth',2,'color','k')
title('velocity vs angle')
xlabel('angle')
ylabel('velocity')
grid on
hold on
%velocity dwell 1
td=th2+th1;
th=[th1:td];
yy=v(1,500);
yy=floor(yy);
plot([th1 th1+th2],[yy yy],'LineWidth',2,'color','b')
hold on
%velocity fall
tf=td+th3;
th=linspace(td,tf,500);
thp=linspace(0,th3,500);
v=(-1)*sin(pi*thp/th3)*l*w*90/th3;
min_velocity_in_fall=min(v)
plot(th,v,'LineWidth',2,'color','r')
hold on
%velocity dwell 2
td=tf+th4;
th=[th3:td];
yy=v(1,1);
plot([th1+th2+th3 td],[yy yy],'LineWidth',2,'color','b')
hold off
%_____________________for acceleration________________________
%for acceleration rise
th=linspace(0,th1,500);
figure(3)
a=cos(pi*th/th1)*((l*180*180*w*w)/(th1*th1));
plot(th,a,'LineWidth',2,'color','k')
figure(3)
title('acceleration vs angle')
xlabel('angle')
ylabel('acceleration')
grid on
hold on
%acceleration dwell 1
td=th2+th1;
th=[th1:td];
p=a(1,500);
plot([th1 th1],[p 0],'LineWidth',2,'color','b')
plot([th1 th1+th2],[0 0],'LineWidth',2,'color','b')
hold on
%acceleration fall
tf=td+th3;
th=linspace(td,tf,500);
thp=linspace(0,th3,500);
a=(-1)*cos(pi*thp/th3)*((l*180*180*w*w)/(th3*th3));
plot(th,a,'LineWidth',2,'color','r')
hold on
p=a(1,1)
plot([th1+th2 th1+th2],[0 p],'LineWidth',2,'color','b')
%acceleration dwell
td=tf+th4;
th=[th3:td];
yy=a(1,500);
plot([th1+th2+th3 td],[yy yy],'LineWidth',2,'color','b')
hold off
At the starting of the coding we have written “clear all” ,due to his the store vale or data of the previous codding is been clear. Then we right “clc” due to his the command window get clear including the error of the previous codding.
DISPLACEMENT
- Coding will take value of “angular speed, rise angle, first dwell angle, fall angle , second dwell & maximum displacement or diameter of cam ”. and this is store in “w, th1, th2, th3, th5, L” .
- To plot graph in displacement rise. we give different value of angle from o to th1 (rise angle ) by using “ linspace( 0, th1, 500 ) ” and this is store in “th”.
- And “th” value which is 1×500, is pass in displacement rise formula which give displacement value for different value of angle.
- S=L / 2× (1 – cosd (180 / th1×th ) )
- Since we have to plot 3 graph “displacement, velocity, acceleration & in that 3 graph we have to plot 4 graph, i.e rise, dwell, fall, dwell. Thuse we use “ figure (1). Command for displacement .
- After getting displacement & angle value (1 × 500) we make use of “plot” command by passing “th , s” then use label command to give name to x & y axis , “ gride on ” command
- For displacement dwell 1 we just wanted to draw horizontal line from end of rise to start of fall , by passing angle as x axis value & displacement as y axis value , in dwell 1 y axis value is constant ie for different value of angle y is constant , angle pass in this is angle of rise at starting of dwell & angle of rise + angle of dwell.
- For fall we have same formula as of rise because both rise and fall are in SHM , the only change is formula of rise is multiply by “-1” and we get fall formula.
- S=(-1) × L / 2× (1 – cosd (180 / th3×thp ) )
- In this above formula we just have to give different fall angle(thp) to get different displacement value
- Thp is the fall angle , where “ thp=linspace( 0, th3, 500) ”
- Since we have to plot 3 graph “displacement, velocity, acceleration & in that 3 graph we have to plot 4 graph, i.e rise, dwell, fall, dwell. Thuse we use “ hold on . Command for displacement in figure(1)
- After getting displacement & angle value (1 × 500) we make use of “plot” command by passing “th , s”
- For displacement dwell 2 we just wanted to draw horizontal line from end of fall by passing angle as x axis value & displacement as y axis value , in dwell 2 y axis value is constant ie for different value of angle y is constant , angle pass in this is angle of rise at starting of dwell & angle of fall + angle of dwell.
VELOCITY.
- To plot graph in velocity rise. we give different value of angle from o to th1 (rise angle ) by using “ linspace( 0, th1, 500 ) ” and this is store in “th”.
- And “th” value which is 1×500, is pass in displacement rise formula which give displacement value for different value of angle.
- V=sin(pi* th/ th1)* l * w * 90 / th1
- Since we have to plot 3 graph “displacement, velocity, acceleration & in that 3 graph we have to plot 4 graph, i.e rise, dwell, fall, dwell. Thuse we use “ figure (2). Command for velocity .
- After getting velocity & angle value (1 × 500) we make use of “plot” command by passing “th , s” then use label command to give name to x & y axis , “ gride on ” command.
- For displacement dwell 1 we just wanted to draw horizontal line from end of rise to start of fall , by passing angle as x axis value & velocity as y axis value , in dwell 1 y axis value is constant ie for different value of angle y is constant , angle pass in this is angle of rise at starting of dwell & angle of rise + angle of dwell.
- For fall we have same formula as of rise because both rise and fall are in SHM , the only change is formula of rise is multiply by “-1” and we get fall formula.
- V = (-1) * sin ( pi * thp / th3 ) * l * w * 90 / th3;
- In this above formula we just have to give different fall angle(thp) to get different velocity value
- Thp is the fall angle , where “ thp=linspace( 0, th3, 500) ”
- Since we have to plot 3 graph “displacement, velocity, acceleration & in that 3 graph we have to plot 4 graph, i.e rise, dwell, fall, dwell. Thuse we use “ hold on . Command for velocity in figure(2)
- since we wanted minimum velocity during fall we use “ min_velocity_in_fall=min(v)”
- After getting velocity & angle value (1 × 500) we make use of “plot” command by passing “th , v”
- For velocity dwell 2 we just wanted to draw horizontal line from end of fall by passing angle as x axis value & velocity as y axis value , in dwell 2 y axis value is constant ie for different value of angle y is constant , angle pass in this is angle of rise at starting of dwell & angle of fall + angle of dwell.
ACCELERATION
- To plot graph in acceleration rise. we give different value of angle from o to th1 (rise angle ) by using “ linspace( 0, th1, 500 ) ” and this is store in “th”.
- And “th” value which is 1×500, is pass in acceleration rise formula which give acceleration value for different value of angle.
- A = cos ( pi * th / th1 ) * ( ( l * 180 * 180 * w * w ) / ( th1 * th1 ) )
- Since we have to plot 3 graph “displacement, velocity, acceleration & in that 3 graph we have to plot 4 graph, i.e rise, dwell, fall, dwell. Thuse we use “ figure (3). Command for acceleration.
- After getting displacement & angle value (1 × 500) we make use of “plot” command by passing “th , s” then use label command to give name to x & y axis , “ gride on ” command.
- For acceleration dwell 1 we just wanted to draw horizontal line from end of rise to start of fall , by passing angle as x axis value & acceleration as y axis value , in dwell 1 y axis value is constant ie for different value of angle y is constant , angle pass in this is angle of rise at starting of dwell & angle of rise + angle of dwell.
- For fall we have same formula as of rise because both rise and fall are in SHM , the only change is formula of rise is multiply by “-1” and we get fall formula.
- A = ( - 1) * cos ( pi * th / th1 ) * ( ( l * 180 * 180 * w * w ) / ( th1 * th1 ) )
- In this above formula we just have to give different fall angle(thp) to get different acceleration value
- Thp is the fall angle , where “ thp=linspace( 0, th3, 500) ”
- Since we have to plot 3 graph “displacement, velocity, acceleration & in that 3 graph we have to plot 4 graph, i.e rise, dwell, fall, dwell. Thuse we use “ hold on . Command for acceleration in figure(3)
- After getting acceleration & angle value (1 × 500) we make use of “plot” command by passing “th , a”
- For acceleration dwell 2 we just wanted to draw horizontal line from end of fall by passing angle as x axis value & acceleration as y axis value , in dwell 2 y axis value is constant ie for different value of angle y is constant , angle pass in this is angle of rise at starting of dwell & angle of fall + angle of dwell.
ERROR
1). In velocity plot when we were plotting dwell graph , graph was not proper because I have given command to plot dwell 1 till th4
2). In displacement fall tf was not define
3). In displacement rise formula " * " was not given
4).When we give same fall angle and rise angle we don’t get proper graph
thus to correct this we have to make small change in "dwell 1"
Giving input by user
OUTPUT