AC 007-190: ANALYTICAL SYNTHESIS AND ANALYSIS OF MECHANISMS USING MATLAB AND SIMULINK Ali Mhammadzadeh, Grand Valley State University ALI R. MOHAMMADZADEH is currently assistant prfessr f engineering at Padns Schl f Engineering at Grand Valley State University. He received his B.S. in Mechanical Engineering frm Sharif University f Technlgy And his M.S. and Ph.D. bth in Mechanical Engineering frm the University f Michigan at Ann Arbr. His research area f interest is fluid-structure interactin. American Sciety fr Engineering Educatin, 007
Analytical Synthesis and Analysis f Mechanisms Using MATLAB and SIMULINK Alireza Mhammadzadeh Grand Valley State University Abstract The apprach adpted in this wrk is an attempt t intrduce students, in kinematics and dynamics f machinery curse, t a cmplete design and analysis f functin generatin mechanisms via analytical methds. Althugh the apprach implemented in this wrk is fr functin generatin type f mechanisms, the cncept is indeed extendable t the ther types f mechanisms as well. As a prject in the kinematics and dynamics f machinery class, students designed, and analyzed a fur bar quick-return mechanism using MATLAB and SIMULINK as the primary sftware tls. One f the aims f this prject was t abandn the traditinal graphical synthesis and graphical analysis, cvered in all the mechanisms textbks, and t use the pwerful cmbinatin f MATLAB and SIMULINK t implement the entire design and analysis prcess. The prject, given t an undergraduate class, serves als as a prlgue t future advanced curses in mechanical engineering, such as multi-bdy dynamics. In implementing the dimensinal synthesis prtin f the prject, students emplyed cmplex number arithmetic t realize the design specificatins. Once the design specificatins were met, a knwn mtr trque was applied t the crank t drive the mechanism. With the knwn gemetric and inertial prperties f each link, Lagrange s equatins fr cnstraint mtin were then utilized t arrive at the secnd rder differential equatins f mtin. SIMULINK, as a user friendly graphical interface, was used t carry ut the integratin t btain angular psitin, velcity, and acceleratin f the designed mechanism. The prject, thugh rigrus, is an excellent way t frce students t practice their knwledge f dynamics and numerical methds. The prject, certainly, meets the ABET criteria fr implementing design in mechanical engineering curriculum. The authr received psitive feedbacks frm his students with regard t this prject. Prblem Statement Students in kinematics and dynamics f machinery class were, first, asked t design a fur bar quick-return mechanism t meet a certain design specificatins. Once the mechanism was realized, students were then asked t analyze the synthesized mechanism- using Lagrange s equatins and Lagrange s multipliers methd fr
cnstraint mtin- t arrive at the psitins, velcities and acceleratins f the links. The apprach, instructed t the students and utilized by them in implementing this prject, is based n the methds presented by Erdman 1 and Cresp da Silva in their respective bks. The authr believes that the emplyed apprach is an excellent way t prepare students fr future curses in multi-bdy dynamics and cmputatinal dynamics. It als makes students practice their knwledge f dynamics, numerical methds, and prgramming. Students feedback regarding this prject was verwhelmingly psitive. The prject required students t design a, fur bar, quick-return mechanism with a time rati f 1.5 and a fllwer sweep angle f 50. T check their wrk, students were asked t trace the paths f pints n the crank, the cupler and the fllwer f their respective designs. A mtr trque M mtr = 1+sin (1.5t) N.m was then assumed t be applied t the crank, and students were asked t find the angular psitins, velcities, and acceleratins f each link using MATLAB and SIMULINK. Students als built their mdel in the shp. Mechanism Synthesis The cmplex number apprach f Standard Dyad Frm,, 5 is used t perfrm the dimensinal synthesis. This wuld render the size and starting cnfiguratin f the fur bar functin generatin mechanism. Figure 1 is a depictin f a typical functin generatin fur bar mechanism. By applying the Lp-clsure methd t the vectrs representing the links, in successive psitins, a standard dyad frm is resulted. Slutin f the resulted vectr equatins then renders the size f each link f the mechanism and its starting cnfiguratin. Z j Z j Z Z 1 j Figure 1 Figure 1 depicts the cmplex number vectrs, Z 1, Z, Z, Z, representing, the grund, the crank, the cupler and the fllwer links respectively, in the starting psitin. The red lines in the diagram are the depictin f the links in a different psitin as a result f the mtin. The lp clsure apprach fr psitin 1 (dark Vectr lines) is: Z Z Z Z1 (1)
The lp clsure equatin written again fr the psitin (red lines), in terms f the riginal psitin vectrs, results in: Z ij i j i j e Z e Z e Z1 () Subtracting Equatin (1) frm Equatin () renders: i i i j j j Z ( e 1) Z ( e 1) Z ( e 1) () Equatin () represents a Standard Dyad Frm. This equatin is used t implement the design specificatins described in this prject. Given the fllwer sweep angle f 50, ne realizes that, at the tw extreme range f the fllwer mtin, the mechanism is in tggle cnditin. That is the crank is lined up with the cupler. Since this is the nly given in the prblem, ne has a tw precisin pints descriptin f the mechanism. This translates itself int adpting sme free chices in rder t slve equatin () fr the desired links dimensins and rientatins. Realizing that angle j fr the fllwer in its sweeping mtin is j = 50 and j and j angles are prescribed, nce the applied time rati (1.5) fr the mechanism is implemented, ne chses vectrs Z and Z freely t reduce the number f unknwns in equatin () t ne link nly. The unknwn (cmplex number) Z is btained frm equatin (). If the rtatin angle f the crank in the frward mtin f the fllwer is taken as and in the backward mtin f the fllwer is taken as we have: 60 () The prescribed time rati results in: 1.5 (5) Slutin f () and (5) results in: 00 and 160 (6) It can be easily shwn that the angle, thrugh which the cupler rtates when the mechanism mves frm the first tggle cnditin t the next tggle cnditin is: This is achieved thrugh crank rtatin f: j 0 (7) (8) j 00
With j, j, and j knwn as described in the abve, ne chses vectrs Z and Z in rder t reduce the number f unknwns t ne cmplex value fr Z in equatin (). Chsing: 65 6. i i 1e, Z 1. e (9) Z Equatin () after substitutins f the values renders: i00 i6. i0 i65 i50 Z ( e 1) 1.e ( e 1) 1e ( e 1) (10) Slutin f the abve equatin results in: 0 Z = 0.6 m at 6. With Z, Z, Z, knwn, equatin (1) is used t find the grund link Z 1 t be: Z 1 = 1.178 m A CAD drawing f the mechanism is shwn in Figure : Figure Once the mechanism was realized students were asked t find the psitin f each link and trace the crank curve, the curve fr a pint n the cupler, and the fllwer rcking
curve. This was dne numerically, thrugh the applicatin f Newtn-Raphsn methd 6 t the scalar frm f the lp-clsure equatin (1). The scalar frm f equatin (1) is: r r sin sin sin 0 1 0 (11) Where r stands fr length f each link and,, and are the angles f links,, and respectively. Given fr the increments f mtin f the crank shaft, nnlinear equatins (11) are slved fr the cupler and the fllwer angles. Appendix A includes the MATLAB prgram t fulfill this task. Figure is the trace f the crank-tip, a cupler pint (pint C), and the fllwer tip f the mechanism. The prgram als cnfirms that the design meets the required specificatin and indicates that the fllwer sweeps a 50 angle in its ensuing mtin. Figure The next task was t find the angular velcities and acceleratins f each link as part f the kinematics analysis f the mechanism. Differentiating equatins (11) with respect t time renders equatins fr angular velcities f links and, given the angular velcity f the link. These equatins are:
sin sin sin 0 r 0 (1) Where,, are angular velcities f links,, and respectively. Slving equatins (1) fr, in terms f ne btains: r sin r sin sin (1) Equatin (1) is slved fr angular velcities f links and, given the angular psitin f link and its angular velcity. This is accmplished in the MATLAB functin f the SIMULINK mdel, presented later in the text. T arrive at angular acceleratin f the links when the mtr trque is applied t the crank, ne adpts Lagrange s apprach t Figure () as fllw: C r B r r D Figure The Kinetic energy f the mtin is btained as: A r 1 r 1 T 1 I 1 1 1 I ID mvcm (1) A Where I A is the mment f inertia f link abut pint A, I D is the mment f inertia f link abut pint D, and I is the mment f inertia f link abut the center f mass f the link. V cm is the velcity f the center f mass fr link. In the Cartesian crdinates V cm is: v cm r r r sin sin ) i ( r cs ) j (15) ( The virtual wrk n the system is simply: W Mmtr (16)
Where M mtr is the trque applied t the crank by the mtr. The generalized crdinates,, and are cnstrained by the lp clsure equatins (11). Fr the ease f fllwing thse equatins are rewritten here: f f 1 sin sin sin 0 1 0 (16) Defining the Lagrangian as L = T V, where T is the kinetic energy and V is the ptential energy fr the system. Neglecting the weight f the links in cmparisn with their respective inertia frces, the ptential energy f the system is set t zer. With that in mind, the Lagrange s equatin fr each generalized crdinate is then written as fllws: d dt d dt d dt T T ( ) T T ( ) T T ( ) M mtr f1 f 1 f1 f 1 f1 f 1 (17) Where 1, and are Lagrange multipliers, due t the cnstraint mtin. Substituting the links mments f inertia in terms f their lengths and masses (I A = (1/)m r, I D = (1/)m r, I = (1/1)m r ) int the expressin fr the kinetic energy, perfrming the partial derivatives f the cnstraint equatins (16) with respect t,, and, and plugging the results int equatins (17); ne arrives at the expressins fr the angular acceleratins f links,, and, namely,, and. The utcme f these mathematical peratins wuld be equatins f (17) in terms f the 5 unknwns,,,, and. 1, In rder t slve fr the angular acceleratins f the links,, and, ne needs t supplement the reduced frm f the equatins (17) with tw mre equatins. This is dne by differentiating the equatins f cnstraints, equatins (16), twice with respect t time. The result f which is: r sin sin sin r sin sin sin 0 0 (18) One shuld nte that equatins (18) are nnlinear and carry the angular psitins and velcities f the links,, and in them. This means that the angular psitins and velcities f the links, and need t be knwn prir t the slutin fr the angular acceleratins f all the links. Slutin f these equatins (reduced frm f equatins (17) and (18)) wuld be implemented by SIMULINK as shwn belw.
The MATLAB functins with fregrund clrs, blue, range and red, seen in the SIMULINK mdel, are MATLAB.m files fr finding psitins, velcities and acceleratins f the links respectively. The prgram als animates the mechanism. A snapsht f such an animatin is shwn belw:
Appendix B cntains the three MATLAB Functins used in the SIMULINK mdel. Figure 5 is the Aut-Scale Graph f the SIMULINK mdel, which is the plt f the angular psitin f link ( ) vs. time. Figure 5 cnfirms the rcking mtin f the fllwer. It als shws that the fllwer sweeps an angle f 50 in its rcking mtin. Cnclusin Figure 5 The prject significantly helped students understand the abstract cncepts in dynamics. This was reflected in the result f the fllw up exam. Majrity f the students exhibited a very thrugh understanding f Lagrange s equatins. Students enjyed the animatin part f the prject and built their mdels in the shp. The authr received psitive feedback frm the students regarding this exercise. Bibligraphy 1. Erdman, Arthur G., Sanders, Gerge N., Mechanism Design Analysis and Synthesis Prentice Hall, 001.. Cresp da Silva, M. R.M., Intermediate Dynamics, McGraw Hills, 00.. Erdman, Arthur G, Three and Fur Precisin Pint Kinematics Synthesis f Planar Linkages, Mechanism and Machine Thery, 16, pp. 7-5.. Erdman, Arthur G, Three Psitin Synthesis by Cmplex Numbers, In Mngraph n Mechanical Design, Paper N. 9, 1977. 5. Erdman, Arthur G, and Carlsn, W. L., Teaching Unit n Cmplex Numbers as Applied t Linkage Mdeling, In Mngraph n Mechanical Design, NSF reprt N. GK66, Paper N. 1, 1977. 6. Mre, Hlly MATLAB fr Engineers, Prentice Hall, 007.
Appendix A **************** Path Generatin Prgram Using Lp Clsure Methd **************** FILENAME: path_lp_clsure.m CREATE MATRICES TO STORE X AND iy COMPONENTS OF POSITION OF PTS. A, B, AND C AND THETA AND ESTIMATES Xa=[]; Ya=[]; Xb=[]; Yb=[]; Xc=[]; Yc=[]; thetabars=[]; DEFINE CONSTANTS (LENGTHS IN INCHES, ANGLES IN RADIANS) r1=1.178; "G" Grund Link Length, AB r=0.6; "U" Input Link Length, AA r=1.; "Z" Cupler Link Length, AB r=1; "W" Fllwer Link Length, BB r5=1.5; Length AC theta1=0; Angle f Grund Link psic=0.6*(pi/180); Angle BAC mu=-1; Cnfiguratin f linkage Grashf (s+l<p+q since r+r1<r+r) and input is the shrtest link => Crank Rcker (Cranks can rtate 60 degrees) thetamin=0; Smallest input angle thetamax=*pi; Largest input angle range=thetamax-thetamin; Range f input mtin steps=100; Number f psitins that will be calculated CALCULATE INITIAL POSITION OF C WITH COMPLEX NUMBERS theta=thetamin; Initial theta rv=r*exp(i*theta); Psitin vectr AA r1v=r1*exp(i*theta1); Psitin vectr AB r7v=rv-r1v; Psitin vectr BA r7=abs(r7v); Magnitude BA psi=acs((r^+r7^-r^)/(*r*r7)); Angle ABB theta=imag(lg(r7v/abs(r7v)))+mu*psi; Current theta rv=r*exp(i*theta); Psitin vectr BB rv=r1v-rv+rv; Psitin vectr AB theta=imag(lg(rv/abs(rv))); Angle f AA t X axis CALCULATE POSITION OF C AT ALL STEPS fr q=1:(steps+1)
theta=thetamin+(q-1)*(range)/steps; Current theta CALL FUNCTION TO GET ESTIMATES OF THETAS AND thetabars=thetas(theta1,theta,theta,theta,r1,r,r,r); theta=thetabars(1); Set current theta t Newtn-Raphsn estimate theta=thetabars(); Set current theta t Newtn-Raphsn estimate thth(q)=theta; Xc(q)=r*cs(theta)+r5*cs(theta+psic); Put current Xc in matrix Yc(q)=r*sin(theta)+r5*sin(theta+psic); Put current iyc in matrix Xb(q)=r1*cs(theta1)+r*cs(theta); Put current Xb in matrix Yb(q)=r1*sin(theta1)+r*sin(theta); Put current iyb in matrix Xa(q)=r*cs(theta); Put current Xa in matrix Ya(q)=r*sin(theta); Put current iya in matrix end thetamax=max(thth); thetamin=min(thth); range1=(thetamax-thetamin)*180/pi PLOT THE POSITIONS OF C, B, AND A plt(xc,yc,xb,yb,xa,ya); title('plt f Psitins Using Lp Clsure and Newtn-Raphsn'); axis([-,,-,]); xlabel('x Crdinates'); ylabel('iy Crdinates'); legend('pt. C','Fllwer- range = 50 degree','input (Crank)'); animate_nbar
**************** Functin fr Path Generatin Prgram Using Lp Clsure Methd -1-06 **************** FILENAME: thetas.m FUNCTION FINDS NEWTON-RAPHSON APPROXIMATION OF THETAS AND BASED ON PREVIOUS ANGLES AND BASED ON LINK MAGNITUDES functin y=thetas(th1,th,th,th,m1,m,m,m) SET ESTIMATES EQUAL TO LAST THETAS AND thetabar=th; thetabar=th; INITIALIZE MATRIX TO STORE X AND Y SUMS F=[1;1]; LOOP UNTIL MAGNITUDE OF X AND Y SUMS IS VERY SMALL -- NEAR ZERO while nrm(f)>=1.0e-010 if eps, prgram lped frever X COMPONENTS AT CURRENT ESTIMATE (MUST ADD UP TO ZERO) f1=m*cs(th)+m*cs(thetabar)-m*cs(thetabar)-m1*cs(th1); Y COMPONENTS AT CURRENT ESTIMATE (MUST ADD UP TO ZERO) f=m*sin(th)+m*sin(thetabar)-m*sin(thetabar)-m1*sin(th1); JACOBIAN DETERMINATE IS CALCULATED A=[(-m*sin(thetabar)) (m*sin(thetabar));(m*cs(thetabar)) (-m*cs(thetabar))]; THE X AND Y AT CURRENT ESTIMATE b=[(-(f1));(-(f))]; MATRIX "DIVISION" -- EQUIVALENT TO A^-1*b, BUT FASTER EXECUTION x=a\b; NEW ESTIMATE OF THETAS AND thetabar=thetabar+x(1,1); thetabar=thetabar+x(,1); NEW SUM OF X AND Y COMPONENTS f1=m*cs(th)+m*cs(thetabar)-m*cs(thetabar)-m1*cs(th1); f=m*sin(th)+m*sin(thetabar)-m*sin(thetabar)-m1*sin(th1); PUT X AND Y SUMS IN MATRIX SO NORM CAN BE COMPUTED F=[f1;f]; end end FINAL ESTIMATES ARE RETURNED AS A VECTOR y=[thetabar thetabar];
Appendix B The Blue MATLAB Functin in the SIMULINK Mdel This Functin is the blue MATLAB Functin in the SIMULINK mdel t calculate the angular psitin f the links. It is based n the Newtn-Raphsn methd fr slving system f nnlinear equatins functin [th]=newtn(u) factr=pi/180; theta=u(5); theta=5*factr; theta=15*factr; f=[u()*cs(theta)-u()*cs(theta)+u()*cs(theta)-u(1); u()*sin(theta)-u()*sin(theta)+u()*sin(theta)]; while nrm(f)>1.0e-6 Jacbian=[-u()*sin(theta) u()*sin(theta); u()*cs(theta) - u()*cs(theta)]; delta= inv(jacbian)*-1*f; theta=theta+delta(1); theta=theta+delta(); f=[u()*cs(theta)-u()*cs(theta)+u()*cs(theta)-u(1); u()*sin(theta)-u()*sin(theta)+u()*sin(theta)]; nrm(f); end; th(1)=theta; th()=theta; The Orange MATLAB Functin in the SIMULINK Mdel Given the Angular Velcity f the Link, this Functin Calculates the Angular Velcities f the Other Links
The Red MATLAB Functin in the SIMULINK Mdel This Functin is the red MATLAB Functin in the SIMULINK mdel, used t find the angular acceleratins f the links functin [acc] = accel(u) A =[1/*u(9)*u()^ 0 0 u()*sin(u(5)) -u()*cs(u(5));0 1/*u(10)*u()^ -1/*u(10)*u()*u()*cs(u(7)-u(6)) u()*sin(u(6)) - u()*cs(u(6)); 0-1/*u(10)*u()*u()*cs(u(7)-u(6)) (1/*u(11)+u(10))*u()^ - u()*sin(u(7)) u()*cs(u(7)); u()*sin(u(5)) u()*sin(u(6)) -u()*sin(u(7)) 0 0; u()*cs(u(5)) u()*cs(u(6)) -u()*cs(u(7)) 0 0] B = [u(1); -1/*u(10)*u()*u()*u(1)^*sin(u(7)-u(6)); 1/*u(10)*u()*u()*u(1)^*sin(u(7)-u(6)); u()*u(1)^*cs(u(7))-u()*u(1)^*cs(u(6))- u()*u(8)^*cs(u(5)); - u()*u(1)^*sin(u(7))+u()*u(1)^*sin(u(6))+u()*u(8)^*sin(u(5))] acc = (A^-1)*B