Mechanism analysis with Mathematica

Mechanism analysis with Mathematica
Dan B. Marghitu (corresponding author) and P. K. Raju
Department of Mechanical Engineering Auburn University, AL 36849, USA
E-mail: [email protected]
Abstract In this paper, planar mechanisms with dyads are analyzed using Mathematica. First, a
classification of dyads is introduced and then Mathematica packages for the analysis of the driver link
and dyads are explained. The analysis provides a consistent coding scheme for planar mechanisms.
The advantage of the group classification of a system lies in its simplicity. The solution of the whole
system can then be obtained by composing partial solutions. This approach will eliminate the need to
store complete mechanism information in a large database.
Keywords mechanism; dyad; package; Mathematica
Introduction
The structural synthesis of mechanisms may be accomplished using graph theory
[1, 2] or the system group classification. Tsai [3] applied graph theory, combinatorial analysis, and computer algorithms to study new mechanisms. Belfiore and Pennestri [4] elaborated a method of automatically drawing kinematic chains with
contours using graph theory. Fang and Freudenstein [5] presented a combinatorial
approach based on a standard code method for identifying mechanism uniqueness;
that approach utilized the concept of contracted graph abstraction for computationally efficient mechanism enumeration. The structure synthesis of spatial kinematic
chains has been analyzed by Shujun [6] for kinematic chains with three degrees of
freedom and six links. Shin and Krishnamurty [7] established standard codes for
uniquely identifying mechanisms. Sen and Mruthynjaya [8] studied singularities
in the workspace of planar closed-loop manipulators. The singularities were
determined using the centers of rotation for closed kinematic chains with two
degrees of freedom. Assur groups with multiple joints are described by Jinkui and
Weiqing [9].
Designers have also generated collections of mechanisms classified according to
their functional characteristics [10–16].
Mathematica [17] is a mathematical software package that integrates accurate
symbolic and numerical calculation, graphics, and programming language. Both
Mathematica and Matlab are widely used in engineering departments. Mathematica
software is better for analytical/symbolic math computation.
The advantage of the system group classification lies in the fact that the solution can be obtained by composing partial solutions. Using Mathematica packages
for the system groups, the planar mechanisms can be analyzed in a systematic
way.
This study reflects some of the recent advances in mechanisms, changes in ABET
criteria and the increased importance of both computer analysis and engineering
International Journal of Mechanical Engineering Education 37/2
Downloaded from ijj.sagepub.com by guest on February 16, 2015
ijmee_2436.indd 130
8/14/2009 4:50:10 PM
Mechanism analysis with Mathematica
131
design. The paper encourages students to learn mechanisms in an interactive way,
incorporating Mathematica packages and allowing readers to conduct and explore
mechanisms analysis using dyads.
A feature of this article and its main distinction from other ways of teaching
students about mechanisms is that it presents a different method (the dyad method)
for the kinematic and dynamic force analysis of mechanisms. The other important
feature of the approach used here is the attention given to the solution of the problems using the symbolic software Mathematica.
Dyads
The number of independent coordinates that uniquely determine the relative position
of two constrained links is termed the degree of freedom of a given joint. Alternatively, the term joint class is introduced. A joint is of the jth class if it diminishes
the relative motion of linked bodies by j degrees of freedom; i.e. j scalar constraint
conditions correspond to the given kinematic pair. It follows that such a joint has 6j
independent coordinates.
For the general case of planar mechanisms, the number of degrees of freedom is
calculated with the following formula (Gruebler’s equation or Kutzbach’s equation)
[18]:
M = 3n − 2c5 − c4
(1)
where n is the number of moving links, c5 is the number of full joints (one degree
of freedom), and c4 is the number of half joints (two degrees of freedom).
There is a special significance to kinematic chains which do not change their
degrees of freedom after being connected to an arbitrary system. Kinematic chains
defined in this way are called system groups. Connecting them to or disconnecting
them from a given system enables systems to be modified or structurally new
systems to be created while maintaining the original degrees of freedom. The term
‘system group’ has been introduced for the classification of planar mechanisms used
by Assur and further investigated by Artobolevsky. For planar systems, from equation 1 it follows that:
3n − 2c5 = 0
(2)
according to which the number of system group links, n, is always even. A half joint,
c4, can be substituted with two full joints and an extra link.
The simplest fundamental kinematic chain is the binary group with two links
(n = 2) and three full joints (c5 = 3). The binary group is also called a dyad.
Fig. 1(a) shows the simplest dyad with three rotational joints. This dyad is named
rotation rotation rotation (dyad RRR) or dyad of type one (D10). Fig. 1(b) depicts
a dyad of type two (D20), rotation rotation translation (dyad RRT), and the particular case when L3 = CD = 0. Fig. 1(c) shows a dyad of type three (D30), rotation
translation rotation (dyad RTR) and the particular case when L3 = CD = 0. Fig. 1(d)
depicts a dyad of type four (D40), translation rotation translation (dyad TRT)
International Journal of Mechanical Engineering Education 37/2
Downloaded from ijj.sagepub.com by guest on February 16, 2015
ijmee_2436.indd 131
8/14/2009 4:50:10 PM
132
D. B. Marghitu and P. K. Raju
Fig. 1 Dyads: (a) rotation rotation rotation (dyad RRR), (b) rotation rotation translation
(dyad RRT), (c) rotation translation rotation (dyad RTR), (d) translation rotation
translation (dyad TRT), and (e) rotation translation translation (dyad RTT).
International Journal of Mechanical Engineering Education 37/2
Downloaded from ijj.sagepub.com by guest on February 16, 2015
ijmee_2436.indd 132
8/14/2009 4:50:10 PM
Mechanism analysis with Mathematica
133
and Fig. 1(e) shows a dyad of type five (D50), rotation translation translation
(dyad RTT).
The advantage of the group classification of a system lies in its simplicity.
The solution of the whole system can then be obtained by composing partial
solutions.
One can connect a dyad to a driver link to create a mechanism with one degree
of freedom. The driver link, link 1 (link AB), can have rotational (R) or translational
(T) motion. The driver link is connected to a first dyad, comprising links 2 and 3,
with three joints, at B, C, and D. The driver link (link 1), and the last link (link 3),
are connected to the ground, 0. Fig. 2(a) shows a mechanism, R-D20, where dyad
D20 has length L3 = 0.
Next, mechanisms with one driver link and two dyads are considered. The second
dyad is comprised of links 4 and 5 and three joints, at B′, C′, and D′. Fig. 2(b)
represents the ways in which the second dyad can be connected to the initial
Fig. 2
(a) The R-D20 mechanism and (b) the R-D10-D10 mechanism.
International Journal of Mechanical Engineering Education 37/2
Downloaded from ijj.sagepub.com by guest on February 16, 2015
ijmee_2436.indd 133
8/14/2009 4:50:10 PM
134
D. B. Marghitu and P. K. Raju
mechanism with one driver and one dyad. For simplification, only rotational
joints are considered for the following mechanism examples, R-D10-D10. Fig. 2(b)
shows the first link of the second dyad, link 4, connected to the driver link
(link 1), and the second link of the second dyad, link 5, which is connected to
the ground, 0.
Driver link
A number of bodies linked by joints form a kinematic chain. On the basis of the
presence of loops in a mechanical structure, closed kinematic chains can be distinguished. A kinematic chain is closed if there are one or more loops such that each
link and each joint is contained in at least one of them. A closed kinematic chain
(or mechanism) has no open attachment point. An open kinematic chain contains no
loop. Mechanism design is a vital component of modern machine design practice.
Mechanisms are used to transmit forces and moments, and to manipulate objects. A
knowledge of the kinematic and dynamic properties of these machines is crucial for
their design and control.
Packages can be used to calculate the position, velocity, and acceleration of a
driver link in rotational motion, as shown in Fig. 3(a). For the position analysis, the
input data are the coordinates (xA, yA) of joint A (the joint between the driver link
and the ground) with respect to the reference frame xOyz, the length of the link,
AB, and the angle, ϑ, with the horizontal axis. For the analysis of velocity and
acceleration, the angular velocity, w = j˙, and the angular acceleration, a = j¨,
are considered. The output data are the position, velocity, and acceleration of the
end point, B.
The position equations for the driver link are:
x B = x A + AB cos ϕ
yB = y A + AB sin ϕ
where xB and yB are the coordinates of point B.
The velocity equations for the driver link are:
vBx = − ABω sin ϕ
vBy = ABω cos ϕ
where vBx and vBy are the velocity components of point B on the x- and y-axes.
The acceleration equations for the driver link are:
aBx = − ABω 2 cos ϕ − ABα sin ϕ
aBy = − ABω 2 sin ϕ + ABα cos ϕ
where aBx and aBy are the acceleration components of point B on the x- and y-axes.
In order to compute the position, velocity, and acceleration of joint B using Mathematica, the necessary commands can be can collected in a function. The name of
International Journal of Mechanical Engineering Education 37/2
Downloaded from ijj.sagepub.com by guest on February 16, 2015
ijmee_2436.indd 134
8/14/2009 4:50:10 PM
Mechanism analysis with Mathematica
Fig. 3
135
(a) Driver link in rotational motion, (b) RRR dyad, and (c) RRT dyad.
International Journal of Mechanical Engineering Education 37/2
Downloaded from ijj.sagepub.com by guest on February 16, 2015
ijmee_2436.indd 135
8/14/2009 4:50:10 PM
136
D. B. Marghitu and P. K. Raju
the function is Driver. The input data, the variable parts of the computation, and
the output data are defined as parameters to this function. All the variables local to
Driver[] are declared in the Block[] statement to isolate them from any values
they might have globally. The Mathematica command Block[{x, y, . . .},
expr] specifies that expr is to be evaluated with local values for the symbols x,
y, . . . . In our case, the local variables are xB, yB, vBx, vBy, aBx, and aBy, and
expr is the body of the function.
The Mathematica command Return[expr] returns the value expr from a function. For the driver, expr represents the output data and it is a vector that contains
the elements xB, yB, vBx, vBy, aBx, and aBy.
The mechanism that Mathematica provides for keeping the variables used in a
package different from those used in the main session is called context.
The local variables, xB, yB, vBx, vBy, aBx, and aBy, are now created in
the context Private’, which is not searched when one types a variable name later
on.
The usage message defined for the symbol Driver is there to provide documentation for the function and to make sure that Driver is defined in the current
context. If it had not been defined before entering the context Private’, it would
not be found later on.
The Mathematica command End[] terminates the present context and the
context reverts to the previous one. The functions that the package provides are
put into a separate context, which must be visible if those functions are to be
used later on. This can be done using the pair of Mathematica commands
BeginPackage[] and EndPackage[]. Thus, the following Mathematica
package is introduced:
BeginPackage[“Driver’”]
Driver::usage = “Driver[xA ,yA ,AB ,phi ,omega ,alpha ]
computes the driver position, velocity and acceleration vectors.”
Begin[“‘Private’”]
Driver[xA ,yA ,AB ,phi ,omega ,alpha ]:=
Block[ { xB, yB, vBx, vBy, aBx, aBy },
xB = xA + AB Cos[phi] ;
yB = yA + AB Sin[phi] ;
vBx = -AB omega Sin[phi] ;
vBy = AB omega Cos[phi] ;
aBx = -AB omega^2 Cos[phi] -AB alpha Sin[phi] ;
aBy = -AB omega^2 Sin[phi] + AB alpha Cos[phi] ;
Return[ { xB, yB, vBx, vBy, aBx, aBy } ];
]
End[ ]
EndPackage[ ]
The command BeginPackage[“Driver’ ”] sets Driver’ to be the current
context, and the command EndPackage[] ends the package, prepending Driver’
to the context search path.
International Journal of Mechanical Engineering Education 37/2
Downloaded from ijj.sagepub.com by guest on February 16, 2015
ijmee_2436.indd 136
8/14/2009 4:50:11 PM
Mechanism analysis with Mathematica
137
Note the initial back-quote in the context name inside the command
Begin[‘ “Private” ’]. This establishes ‘Private’ as a subcontext of the
context Driver’ (so its full name is Driver’Private’).
The name of the source file for the Mathematica package Driver is
Driver.m.
Position analysis
RRR dyad
The RRR dyad is shown in Fig. 3(b). The input data for position analysis are
the coordinates of joint M (xM, yM), the coordinates of joint N (xN, yN), and the
lengths of segments MP and NP. The output data are the coordinates of joint
P (xP, yP).
The position equations for the RRR dyad are:
( x M − x P ) + ( yM − yP ) = MP 2
2
2
( x N − x P ) + ( yN − yP ) = NP 2
2
2
where the unknowns are the coordinates xP and yP of joint P, for which there are
two solutions: (xP1, yP1) and (xP2, yP2).
The Mathematica function for the values of xP1, yP1, xP2, yP2 is:
PosRRR::usage = “PosRRR[xM,yM,xN,yN,MP,NP]
Computes the position vectors for RRR dyad”
Begin[“‘Private’”]
PosRRR[xM ,yM ,xN ,yN ,MP ,NP ]:=
Block[
{xPSol,yPSol,xP1,yP1,xP2,yP2,eqRRR1,eqRRR2,solRRR},
eqRRR1 = (xM-xPSol)^2 + (yM-yPSol)^2 == MP^2 ;
eqRRR2 = (xN-xPSol)^2 + (yN-yPSol)^2 == NP^2 ;
solRRR = Solve[{eqRRR1,eqRRR2},{xPSol,yPSol}];
xP1 = xPSol/.solRRR[[1]] ;
yP1 = yPSol/.solRRR[[1]] ;
xP2 = xPSol/.solRRR[[2]] ;
yP2 = yPSol/.solRRR[[2]] ;
Return[xP1, yP1, xP2, yP2] ;
]
End[ ]
RRT dyad
The RRT dyad is shown in Fig. 3(c). The input data are the coordinates of joint M
(xM, yM), the coordinates of point N (xN, yN) in the sliding direction, the length of
segment MP, and the value of the angle q. The output data are the coordinates of
joint P (xP, yP).
International Journal of Mechanical Engineering Education 37/2
Downloaded from ijj.sagepub.com by guest on February 16, 2015
ijmee_2436.indd 137
8/14/2009 4:50:11 PM
138
D. B. Marghitu and P. K. Raju
The position equations for the RRT dyad are:
( x M − x P ) + ( yM − yP ) = MP 2
2
2
tan θ = [ yP − yN ] [ x P − x N ]
where the unknowns are the coordinates, xP and yP, of joint P. There are two solutions for the position of joint P, (xP1, yP1) and (xP2, yP2).
If the value of the angle q is 90º or 180º, then xP = xN and the following equation
is used to find the coordinate, yP, of point P:
( x M − x N ) + ( yM − yP ) = MP 2
2
2
(3)
The Mathematica function for the position analysis is:
PosRRT::usage = “PosRRT[xM,yM,xN,yN,MP,theta]
Computes the position vectors for RRT dyad”
Begin[“‘Private’”]
PosRRT[xM ,yM ,xN ,yN ,MP ,theta ]:=
Block[
{xPSol, yPSol, xP1, yP1,xP2, yP2, eqRRT, solRRT, eqRRT1, eqRRT2 },
If[ (theta==Pi/2)||(theta==3*Pi/2),
xP1 = xP2 = xN ;
eqRRT = (xM-xN)^2 + (yM-yPSol)^2 == MP^2 ;
solRRT = Solve[ eqRRT, yPSol ] ;
yP1 = yPSol/.solRRT[[1]] ;
yP2 = yPSol/.solRRT[[2]] ,
eqRRT1 = (xM-xPSol)^2 + (yM-yPSol)^2 == MP^2 ;
eqRRT2 = Tan[theta] == (yPSol-yN)/(xPSol-xN) ;
solRRT = Solve[{eqRRT1,eqRRT2},{xPSol,yPSol}];
xP1 = xPSol/.solRRT[[1]] ;
yP1 = yPSol/.solRRT[[1]] ;
xP2 = xPSol/.solRRT[[2]] ;
yP2 = yPSol/.solRRT[[2]] ;
];
Return[ { xP1, yP1, xP2, yP2 } ];
]
End[ ]
The functions PosRRR and PosRRT are included in the Mathematica package
Position. The name of the source file for the package is Position.m.
Application: R-RTR-RRT mechanism
The planar R-RTR-RRT mechanism considered is shown in Fig. 4(a). Given the
input data AB = 0.20 m, AD = 0.40 m, CD = 0.70 m, CE = 0.30 m, the angle of the
driver link, AB, with the horizontal axis, j = 45º, and the constant angular velocity,
w = 5 rad/s, the problem is to calculate the positions of the joints. The distance from
the slider, link 5, to the horizontal axis, Ox, is yE = 0.35 m.
International Journal of Mechanical Engineering Education 37/2
Downloaded from ijj.sagepub.com by guest on February 16, 2015
ijmee_2436.indd 138
8/14/2009 4:50:11 PM
Mechanism analysis with Mathematica
Fig. 4
139
(a) R-RTR-RRT mechanism, (b) RTR (BBD) dyad, and RRT (CEE) dyad.
International Journal of Mechanical Engineering Education 37/2
Downloaded from ijj.sagepub.com by guest on February 16, 2015
ijmee_2436.indd 139
8/14/2009 4:50:11 PM
140
D. B. Marghitu and P. K. Raju
A Cartesian reference frame xOyz is chosen with the origin at A ≡ O. The Mathematica packages Driver and Position are loaded in the main program using
the following commands:
<<Driver.m ;
<<Position.m ;
Position of joint B
The coordinates of joint B are obtained using the Mathematica function Driver:
xB = Driver[xA,yA,AB,phi,omega,alpha][[1]] ;
yB = Driver[xA,xB,AB,phi,omega,alpha][[2]] ;
The RTR (BBD) dyad is represented in Fig. 4(b).
Position of joint D
The coordinates of joint D are:
xD = 0
yD = −AD = −0.400 m
and the angle, j3, of link 3 with the horizontal is:
j3 = arctan [yB − yD]/[xB − xD] = 75.36º.
The calculations are simple and there is no need for a package for the RTR
dyad.
The next dyad, RRT (CEE), is represented in Fig. 4(c).
Position of joint C
The coordinates of joint C are:
xC = xD + CDcosj3
yC = yD + CDsinj
Position of joint E
In this mechanism, the coordinate, yE, of joint E is constant:
yE = 0.350 m. The numerical solution for xE is obtained using the Mathematica function PosRRT:
xE1 = PosRRT[xC,yC,0,yE,CE,phi5][[1]] ;
xE2 = PosRRT[xC,yC,0,yE,CE,phi5][[3]] ;
The input data are the coordinates of joint C (xC, yC), the coordinates of point P
(0, yE) located in the sliding direction, the length of link CE, and the angle between
the sliding direction and the horizontal axis, Ox, phi5 = 180º.
International Journal of Mechanical Engineering Education 37/2
Downloaded from ijj.sagepub.com by guest on February 16, 2015
ijmee_2436.indd 140
8/14/2009 4:50:11 PM
Mechanism analysis with Mathematica
Fig. 5
141
Mathematica program and the numerical results.
International Journal of Mechanical Engineering Education 37/2
Downloaded from ijj.sagepub.com by guest on February 16, 2015
ijmee_2436.indd 141
8/14/2009 4:50:11 PM
142
D. B. Marghitu and P. K. Raju
The output data are the first and third elements of the vector returned by the function PosRRT, which are the x-coordinates of joint E. The second and fourth elements
are constant and equal to the y-coordinate of joint E. The correct solution for xE for
the input driver angle is selected using the condition xE < xC.
The Mathematica program and the numerical results are shown in Fig. 5.
Conclusion
The kinematic and dynamic of planar mechanisms with dyads can be studied using
Mathematica packages. An example has been presented for the position analysis of
a mechanism with two dyads. Using this method, new packages for planar mechanisms with one, two, and three dyads can be generated. These results are expected
to play a significant role in the development of automated mechanism design procedures. This paper connects traditional mechanism design, the introduction of
structural analysis, and the use of Mathematica.
References
[1] F. R. E. Crossley, ‘The permutation of kinematic chains of eight members or less from the
graph-theoretic viewpoint’, Developments in Theoretical and Applied Mechanics, 2 (1965), 467–
486.
[2] T. H. Davies, ‘An extension of Manolescu’s classification of planar kinematic chains and
mechanisms of mobility m > 1, using graph theory’, Journal of Mechanisms, 3 (1968), 87–
100.
[3] L. W. Tsai, Mechanism Design: Enumeration of Kinematic Structures According to Function (CRC
Press, Boca Raton, FL, 2001).
[4] N. P. Belfiore and E. Pennestri, ‘Automatic sketching of planar kinematic chains’, Mechanism and
Machine Theory, 29 (1994), 177–193.
[5] W. E. Fang and F. Freudenstein, ‘The stratified representation of mechanisms’, Trends and Developments in Mechanisms, Machines and Robotics – ASME Design Technology Conference, Kissimmee, FL, 15 (1) (1988), 115–123.
[6] L. Shujun, ‘Computer-aided structure synthesis of spatial kinematic chain’, Mechanism and Machine
Theory, 6 (1990), 645–653.
[7] J. K. Shin and S. Krishnamurty, ‘Development of a standard code for colored graphs and its application to kinematic chains’, ASME Journal of Mechanical Design, 116 (1994), 189–196.
[8] D. Sen and T. S. Mruthynjaya, ‘A centro-based characterization of singularities in the
workspace of planar closed-loop manipulators’, Mechanism and Machine Theory, 8 (1998), 1091–
1104.
[9] C. Jinkui and C. Weiqing, ‘Systemics of Assur groups with multiple joints’, Mechanism and
Machine Theory, 8 (1998), 1127–1133.
[10] I. Artobolevsky, Mechanisms in Modern Engineering Design (MIR Publishers, Moscow,
1977).
[11] H. L. Horton, Ingenious Mechanisms for Designers and Inventors (Industrial Press, New York,
1951).
[12] P. W. Jensen, Classical and Modern Mechanisms for Engineers and Inventors (Marcel Dekker,
New York, 1991).
[13] C. C. Lin and L. W. Tsai, ‘The development of an atlas of bevel-gear type spherical wrist mechanisms’, paper no. 89, AMR2A-3, in Proceedings of the First National Conference on Applied
Mechanisms and Robotics (Cincinnati, OH, 1989).
International Journal of Mechanical Engineering Education 37/2
Downloaded from ijj.sagepub.com by guest on February 16, 2015
ijmee_2436.indd 142
8/14/2009 4:50:12 PM
Mechanism analysis with Mathematica
143
[14] J. A. Newell and H. L. Horton, Ingenious Mechanisms for Designers and Inventors (Industrial Press,
New York, 1967).
[15] I. Popescu, Mechanisms (University of Craiova Press, Craiova, Romania, 1989).
[16] D. B. Marghitu, Kinematic Chains and Machine Components Design (Elsevier Academic Press,
San Diego, CA, 2005).
[17] Wolfram Research Inc., www.wolfram.com.
[18] R. L. Norton, Machine Design (Prentice-Hall, Upper Saddle River, NJ, 1966).
International Journal of Mechanical Engineering Education 37/2
Downloaded from ijj.sagepub.com by guest on February 16, 2015
ijmee_2436.indd 143
8/14/2009 4:50:12 PM