by Roberto Lot
Pasquale de Luca - date 20/04/04
> restart: mylib :="LIBS": libname := mylib,libname: with(MBsymba):
Vector loop
definition of the vectors
> AC := make_VECTOR(ground,a4,0,0): show(AC);
> AB := make_VECTOR(rotate('Z',theta),a1,0,0): show(AB);
> CB := make_VECTOR(rotate('Z',q),r,0,0): show(CB);
closing the vector loop: definition of a closure vector
> closure := AC + CB - AB: show(closure);
this expression must be null
>
{Xcomp(closure) , Ycomp(closure)};
we find the solution with respect to the variables
a1
and
theta
which depend on the generalized coordinate
q
(rotation of the crank)
> solution := solve(%,{theta, a1}):
we extract the solutions
> eval([theta, a1], solution):
> theta := %[1];
> a1 := %%[2];
Numerical Solution
numerical solution for specified crank and rod lengths:
frame a4 = 0.4 m
crank length r = 0.1 m
rod length l = 0.6 m
> dataset := [a4=0.4, r=0.1, l=0.6];
> theta := subs(dataset, theta);
> a1 := subs(dataset,a1);
> a4 := subs(dataset,a4);
> 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);
> plot(theta, q=0..2*Pi, labels=[q, "theta"], title="theta vs. q");
> plot(a1, q=0..2*Pi, labels=[q, "a1"], title="location of the slider on the rod vs. q");
Animation of the Mechanism
Substitute in values for problem
> q:=2*Pi*t;
>
with(plots):
with(plottools):
Warning, the name changecoords has been redefined
Warning, the name arrow has been redefined
Warning, the previous bindings of the names project rotate, and translate have been removed and they now have an assigned value
Generate frames for the animation
>
for t from 0 to 29/30 by 1/30 do
crank CB
crank || (30*t) := plot(
{[ [Xcomp(C)+0.01*cos(2*Pi*t),Ycomp(C)+0.01*sin(2*Pi*t)],
[Xcomp(B),Ycomp(B)] ]}, color=black, thickness=3
):
rod AD
rod || (30*t) := plot(
{[ [Xcomp(A)+0.01*cos(theta),Ycomp(A)+0.01*sin(theta)],
[l*cos(theta), l*sin(theta)] ]}, color=blue, thickness=3
):
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=grey
);
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), 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);