1.6 Example: Kinematics of the Slider Crank Mechanism
by Roberto Lot, Pasquale de Luca - date 20/04/04
| > | restart: mylib :="G:\LIBS": libname := mylib,libname: with(MBsymba): |
Vector loop
definition of the vectors
| > | AC := make_VECTOR(ground,c,0,0): show(AC); |
| > | AB := make_VECTOR(rotate('Z',q),r,0,0): show(AB); |
| > | BC := make_VECTOR(rotate('Z',-theta),l,0,0): show(BC); NOTE: theta is clockwise, so it requires the minus (-) sign. |
| > | project(velocity(velocity(AB)),rotate('Z',q(t))): show(%); |
closing the vector loop: definition of a closure vector
| > | closure := AC - BC - AB: show(closure); |
this expression must be null
| > | {Xcomp(closure) , Ycomp(closure)}; we find the solution with respect to the variables c and theta which depend on the generalized coordinate q (rotation of the crank) |
| > | solution := solve(%,{theta,c}); |
we extract the solutions
| > | eval([theta, c], solution): |
| > | theta := %[1]; |
| > | c := %%[2]; |
anothe trick for univocally identify variables from solution set
| > | c := subs(solution,c); |
| > | theta := subs(solution,theta); |
Numerical Solution
numerical solution for specified crank and rod lengths:
crank length r = 0.1 m
rod length l = 0.4 m
| > | dataset := [r=0.1, l=0.4]; |
| > | theta := subs(dataset, theta); |
| > | c := subs(dataset,c);
|
| > | r := subs(dataset,r); |
| > | l := subs(dataset,l); |
Plot of the mechanism
| > | A := origin(ground): #show(A); |
| > | B := A + AB: show(B): show(B); |
| > | C := A + AC: show(C): show(C); |
| > | vertex := [ [Xcomp(A),Ycomp(A)] , [Xcomp(B),Ycomp(B)] , [Xcomp(C),Ycomp(C)] ]; |
| > | plot(theta, q=0..2*Pi, labels=[q, "theta"], title="theta vs. q"); |
| > | plot(c, q=0..2*Pi, labels=[q, "c"], title="location of the slider vs. q"); |
Animation of the Mechanism
Substitute in values for problem
| > | q:=2*Pi*t; vertex; |
| > | with(plots): with(plottools): |
Generate frames for the animation
| > | for t from 0 to 29/30 by 1/30 do crank crank || (30*t) := plot( {[ [Xcomp(A)+0.01*cos(2*Pi*t),Ycomp(A)+0.01*sin(2*Pi*t)], [Xcomp(B)-0.01*cos(2*Pi*t),Ycomp(B)-0.01*sin(2*Pi*t)] ] }, color=black, thickness=3 ): connecting rod rod || (30*t) := plot( {[ [Xcomp(B)+0.01*cos(theta),Ycomp(B)-0.01*sin(theta)], [Xcomp(C)-0.01*cos(theta),Ycomp(C)+0.01*sin(theta)] ] }, color=black, thickness=3 ): the slider slider || (30*t) := rectangle( [Xcomp(C)-0.08/2, Ycomp(C)+0.02], [Xcomp(C)+0.08/2, Ycomp(C)-0.02], color=grey ): pin joints in A: revj_A || (30*t) := disk( [Xcomp(A),Ycomp(A)], 0.01, color=yellow ); in B: revj_B || (30*t) := disk( [Xcomp(B),Ycomp(B)], 0.01, color=yellow ); in C: revj_C || (30*t) := disk( [Xcomp(C),Ycomp(C)], 0.01, color=yellow ); total total || (30*t) := display ( {crank || (30*t), rod || (30*t), slider || (30*t), revj_A || (30*t), revj_B || (30*t), revj_C || (30*t)} ); od: t:='t'; |
Display the animation.
| > | display([total || (0..29)], insequence=true, scaling=constrained); |