Kinematic simulations of planar mechanisms

Kinematic simulations of planar mechanisms

Advances in Engineering Software 16 (1993) 209-217 Kinematic simulations of planar mechanisms Ray P.S. Han Department of Mechanical & Industrial Engi...

2MB Sizes 8 Downloads 151 Views

Advances in Engineering Software 16 (1993) 209-217

Kinematic simulations of planar mechanisms Ray P.S. Han Department of Mechanical & Industrial Engineering, University of Manitoba, Winnipeg, Manitoba, Canada R3T 2N2, USA

&

Richard Tsuyuki Department of Mechanical Engineering, California Institute of Technology, Pasadena, CA 91125, USA (Received 2 April 1992; revised version received and accepted 13 November 1992) Kinematic analysis and simulation of mechanisms are basic tasks in machine design and can be easily automated using microcomputers. Such programs can free a user of tedious calculations and be instructive in the kinematics of linkages; however, the quality of user interface in such programs can prove discouraging to their general use. A well-designed program should have minimum-keystroke, selfguiding data input, useful and concise output, and descriptive error-trapping. KPLAn (Kinematic Planar Linkage Analysis) is a state-of-the-art program, developed for the kinematic analysis of planar mechanisms using the vector loopclosure method. Interactive pop-up windows, cursor-selectable menus are used to create an eye-pleasing, uncomplicated format and graphical displays are emphasized for immediate visual impact. The result is a program that is very user-friendly and yet sufficiently sophisticated to guide a user informatively. KPLAn produces output in three formats: animated motion simulation; graphed curves of displacements, velocities and accelerations; and numerical tabulation of these quantities. To demonstrate and assess the utility of KPLAn, two examples are presented.

Key words: kinematic analysis, planar mechanisms, mechanism simulation, animation and user-friendliness. INTRODUCTION

particular linkage, the inline slider linkage. In many of these packages, the time and care taken in the development of such simple programming applications tends to be minimal, and the resulting quality of their user interface often proves a barrier to general use. Too often, an essentially rudimentary task becomes frustratingly complicated in dealing with poor or insufficient documentation, time-consuming or awkward data entry, incomprehensible output formats, and cryptic errors resulting in loss of valuable time and/or user interest. As mechanism kinematic analysis is a simple task, a mechanism analysis program must accordingly be easy to use, in order to be convenient and efficient for the student as well as for the design engineer. Such a program should have minimum-keystroke, self-guiding data input, useful and concise output, and descriptive error-trapping. K P L A n was developed at the University of Manitoba for the kinematic analysis of single-degree-of-freedom planar mechanisms using the vector loop-closure

The kinematic analysis of mechanisms is a fundamental task in machine design. A number of techniques for mechanism analysis have been developed; however, the calculations tend to be tedious and time-consuming if attempted by hand. If such techniques are programmed on microcomputers, students can use the programs to develop both analytical and intuitive understanding of mechanism kinematics and kinematic analysis techniques. Fortunately, such programs are not unduly difficult to develop, the computations involved being relatively straight forward. Some software packages such as L I N C A G E S , LINKS, A D A M S and IMP are available, l L I N C A G E S and L I N K S can handle both the analysis and synthesis of a linkage for three or more precision points but without animation. S I M U L 2 is another program developed for the animation of a

Advances in Engineering Software 0965-9978/93/$06.00 © 1993 Elsevier Science Publishers Ltd. 209

R.P.S. Hun, R. Tsuyuki

210

method. The primary focus was a second-year mechanics of machines course, 3 where assignments using the program would be intended to develop the students' understanding of kinematics. Also, using this program would provide vital initial exposure to microcomputer usage that some students were clearly lacking. An earlier, preliminary effort in this area 4 had been observed by previous classes to be computationally efficient but somewhat 'user-unfriendly'. The decision was made to re-implement the basic algorithms in a totally revised, user-friendly manner. Due to the ready availability of DOS-based microcomputers in practice, K P L A n was developed on a PC-AT compatible and may be run on most IBM-compatible microcomputers (XT, AT, 386, etc.). KPLAn was written in F77L F O R T R A N , a versatile version of FORTRAN-77, and utilizes a math co-processor if present (though not required) for optimum speed. Interactive windows with cursor- or single-keystroke-selectable menus are used to create an eye-pleasing, uncluttered environment for ease of data entry, and graphical display of results is emphasized for immediate visual impact. The menus and inputs are sufficiently self-explanatory that no documentation should be necessary; however, an online user's manual is present to explain program operation in detail if desired. The resulting program is simple to use, yet possesses the sophistication to guide a user informatively and without ambiguity.

MECHANISM MODELLING In KPLAn, mechanisms are modelled using vector loops. Vectors or combinations of vectors are used to represent mechanism links, and are joined together to form loops. A loop is said to be closed when its vectors form an unbroken circuit, such that when the vectors are added (or subtracted, depending on their orientation), their sum is zero. That is, the general vector loop summation is given by: n

rj=0

(l)

j=l

where n refers to the number of vectors. Thus the task of mechanism kinematic analysis can be seen as one of solving for the closure of the vector loops at different mechanism positions. In order to facilitate explanation, a simple example will be considered. Figure l(a) shows a typical mechanism; Fig. l(b) shows its vector representation, which is composed of two loops. Closure of the first loop, depicted in Fig. l(c), requires

(a)

(b)

4

8

(c)

(d)

Fig. 1. A typical linkage: (a) model and (b)-(d) vector

representations. component of vector 1 is termed as the input variable, and entered as an 'A'. If the input link was, say, a slider or piston, its length ('L') component would be designated as the input variable. In the first loop, it is evident that while the lengths of vectors 1, 2, 3, and 4 and the angle of vector 4 retain fixed values, the angles of vectors 2 and 3 change as the mechanism is driven by the angular motion of vector 1, the input variable. Therefore the angles of vectors 2 and 3 are termed as dependent variables. In the second loop, the dependent variables are the angle of vector 6 and the length of vector 8. Loop closure is accomplished by solving for the values of the dependent variables. To connect the two loops, it is necessary to define 3 and 5 as common vectors, with 3 as the primary vector and 5 as the secondary. Thus, in solving for a mechanism position, the first loop is closed at the current value of the input variable, and the second loop is closed at the current position of vector 5, which is forced to remain always at a constant angular separation from vector 3, as depicted in Fig. l(b) by the angle a. For completeness, the loop closure equation for the second loop, shown in Fig. l(d), is r5 + r6 - r7 - r 8 = 0

rl + r2 - r 3 - r 4 = 0

(3)

(2)

The input or driver crank of the mechanism is vector 1, and its motion is rotary; therefore, the angular

Any mechanism configuration can be represented by appropriate arrangements of vectors and loops, and appropriate choices of dependent variables and common

Kinematic simulations of planar mechanisms vector pairs. For purposes of computer memory conservation and display format choices, some arbitrary limits were placed on mechanism specifications: a maximum of six vectors per loop, a maximum of four loops, and a maximum of six common vector pairs. These limitations are based upon the requirements of common mechanism types, and were seen as appropriate from the viewpoint of an educational tool, as KPLAn has been implemented thus far. However, it would be a trivial modification to allow larger-scale mechanisms if the need arises.

211

B

rj sin 0j = 0

(9)

j=l n

~--~(~j cos

Oj - rjOj sin Oj) = 0

(10)

Oj- rjOj cos Oj) = 0

(11)

j=l n

~~(#j sin j=l

n

~-~[(~j - rj.~) cos Oj - (2t:jOj + rjOy) sin

Oj] = 0 (12)

MATHEMATICAL FORMULATION

j=l

For a single loop, the loop-closure equation for position analysis is given by eqn (1). To solve this nonlinear equation, the numerical procedure presented in Shigley & Uicker 5 is adopted. Basically, it is an iterative technique employing the Newton-Raphson solution scheme. To describe the method, it is convenient to use the complex number notation for vectorial representation, that is

~--~[(fj - r j ~ ) sin 0j + (2~j.0j + rj0j) cos 0j] = 0

n

rj = rj e i0j

(4)

where i = ~ and 0j is the direction angle of the j t h vector. The loop closure equation becomes, n

:

= o

(5)

j=l

Observe that an error ~ is introduced in eqn (5). This error is reduced at each Newton-Raphson iteration and convergence is attained when the error satisfies a userprescribed tolerance, usually between 10 -3 and 10 -5 . Time differentiating eqn (5) yields the corresponding equations for velocity and acceleration analysis. These error equations are: n

= E ( / ' j ei°J +

iOjrjei°0 = 0

(6)

j=l

n

= E[(/:j j=l

rj~j)ei°J

+ i(2i'yOy+ rjOj)e i°i1 = 0

(7)

Note that eqns (5)-(7) are vector equations, each containing two unknowns in two equations. This can be easily seen when these equations are resolved into their real and imaginary pairs for position, velocity and acceleration analyses respectively:

The iteration equations for each analysis type are obtained via a Taylor series expansion of their respective loop closure equations. Since these equations are identical in form, only the equation for position analysis is derived. The Taylor series expansion of eqn (5), ignoring quadratic and higher-order terms, is

~ ei°JArj + irjei°JAOj = --e (14) j=l in which A rj and A Oj are corrections for the kinematical quantities (or dependent variables) of r and 0. Note that all A rj and A Oj are zero except those associated with the unknown r k and 0k to be solved. The solutions of Ark and A0 k are easy, as eqn (14) is linear with respect to these terms. These quantities are updated at every iteration. For the mth iteration, the updates are: r~k+I = r~k + Ark

(15)

0 kn + l = 0 kn + A 0 k

(16)

Once the position analysis is completed for the current configuration, the. velocity and acceleration analyses for the unknown #k, 0k, ~k and 0k are performed next. Since the forms of the iteration equations are identical, the same algorithm can be used. Also, to avoid problemdependent coding, the method outlined in Wengert 6 for estimating i and ~ is used. When the loops for position, velocity and acceleration analyses are closed, the next position is evaluated, with the kinematical quantities of the previously solved configuration as starting values. Due to the quadratic convergence rate of the Newton-Raphson method, very fast convergence is obtained; usually 3 to 4 iterations will suffice for a typical execution run.

COMPUTER IMPLEMENTATION

n

rj cos 0j = 0 j=l

(13)

j=l

(8)

KPLAn was developed over the duration of one year,

212

R.P.S. Han, R. Tsuyuki

during which many different alternatives to a user interface were tried and tested. A mechanical engineering class was given K P L A n as a learning tool in a second-year mechanics of machines course, and asked to assess the program for ease of use and usefulness. Their feedback was used to iteratively modify and then retest the program to optimize its user-friendliness and utility. A flowchart.of the major subroutines of K P L A n is shown in Fig. 2. Creating a mechanism model

K P L A n is linked with libraries of F O R T R A N subroutines for windowing and for the various input/output functions. These subroutines are utilized to create a user interface which allows a user to enter responses through pop-up menu windows with cursor- and/or singlekeystroke-selectable options. Pop-up menus save display space and thus, prevent confusing screen clutter. For most input requests, a menu of choices appears in a window at the upper right of the display, with a cursor bar highlighting what is likely the most appropriate choice. A user may use the arrow and 'enter' keys to move the cursor bar to highlight and select the desired option, or, in many cases, simply press the first letter of

the desired choice. The opening menu presents a user with three options: creating a new mechanism, conducting file operations to either scan directories or load a previously created mechanism file, or viewing the operation manual. During mechanism creation, a menu window appears at the upper right for each required entry and, as each query is answered, the response is recorded at the left. The response to an incorrect entry is a warning beep and a flashing message briefly describing the nature of the error, after which a user may re-enter the information. For certain entries, such as the table of initial values, interactive cursor-based editing was implemented to allow a user to input the data in any desired order, and to change the values any number of times as desired. After a mechanism has been created, the loop-closure routines are called once, to determine the exact initial vector component values. This is necessary because, frequently, a user will not have calculated precise values of the dependent variables and will have entered approximations only. If the program is unable to close the mechanism, a user is informed that the mechanism is faulty and given the choices of saving the current configuration, modifying the mechanism, restarting the

preproces~entsy

processing:

computations

postprocessing: Jdisplayof

results

J Fig. 2. Flowchart for KPLAn.

Kinematic simulations of planar mechanisms program, or ending the session. On the other hand, if the initial configuration is closed without difficulty, a static diagram of the mechanism, with vector arrows and labels, is presented. This allows a user to visually verify that the mechanism model has been created as intended, before proceeding with the analysis. A user is queried for verification, and, if the reply is negative, once again given the choice to save or modify the mechanism, or restart or end the program. If the program and a user are both satisfied with the initial configuration, the program proceeds to the kinematic analysis. The execution parameters enable a user to specify the proposed mechanism motion. The input variable can be chosen to change at a specified constant velocity or constant acceleration. An iteration tolerance must be chosen, and the incrementation and range of motion can be specified either in the units of the displacement of the input variable, (e.g. degrees for a crank-type input), or in time units. After these data are requested and entered, the computational module then proceeds with the complete kinematic analysis. While a user awaits the completion of the calculations, the time (not real time, but the simulation time upon which the kinematics are based) and value of the input variable at the mechanism position currently being evaluated are indicated at the upper left, keeping a user apprised of the current status of the program's calculations. If an error occurs, a user is informed that the analysis has been discontinued and advised to view the animation to determine the cause of error; usually the specification of motion past a point beyond which the mechanism cannot physically move or the mechanism being at a dead-center position.

(~)

213

Clarity of presentation and attractiveness of format are both enhanced by the use of color text and graphics. Text color is used to draw attention to windows and highlight the first letter of keyboaxd-selectable menu items. Color in the graphics screens is used to avoid confusion in complicated mechanisms by distinguishing between vectors and their labels, and also to distinguish kinematic quantities in the graphs. Mouse support was not implemented, since the cursor-bar window-driven menus are already well suited to mouse use and could easily be implemented using GKS device interface routines. This would render the program even more user-friendly and bring it into the class of some of the powerful workstation design software now coming into widespread use. Simulation and analysis

K P L A n produces three output formats: motion simulation, kinematic quantities in the form of graphs, and kinematic quantities in tabular format. The graphics software chosen for this application was GSS*GKS, a full implementation of the graphical kernel system graphics standard. Because the GKS standard is universal, the source code of the graphics routines can Table 1. Input data for Example 1

Mechaaism model Number of loops

3

Vector loops (Loop #" loop circuit)

1: 1 2:4 3:9

Dependent variables (Vector #: [A]ngle/[L]ength)

2: 3: 6: 7: 10: 12:

Common vector pairs (vectors: difference0

1, 2, 3, 7,

(b)

2 -3 5 6 -7 10 11 -12

A L A A A L

4: 0.00 5: 20.00 8: 0"00 9: 0"00

Initial vector values 11

12

4/" 3 (c)

8

(d)

(e)

Fig. 3. Example h (a) Linkage Model and (b)-(e) Vector Representations.

Vector number

Length

Angle

I 2 3 4 5 6 7 8 9 10 11 12

50 100 130 50 45 50 100 175 150 100 25 180

45 -20 0 * * 45 130 * * 45 0 90

*value need not be given.

214

R.P.S. Han, R. Tsuyuki

(a)

(~)

16

6

(b)

2

1

3

(d)

(c)

(b) Fig. 5. Example 2: (a) front-end loader, (b) & (c) loader mechanism and (d) vector representation.

Table 2. Input data for example 2

Mechanism model Number of loops

4

Vector loops (loop #: loop circuit)

1: 2: 3: 4:

Dependent variables (vector #: [A]ngle/[L]ength)

1: 2: 5: 6: 9: 10: 13: 14:

Common vector pairs (vectors: difference)

2, 2, 7, 9, 6,

Fig. 4. Example 1: (a) a typical input screen in KPLAn and (b) accumulated simulation plot. be easily deciphered and transported to other computers or modified for use with other compilers. Motion simulation provides an animated view of the linkage motion. Arguably the most useful of mechanism analysis tasks, this option provides an immediate visual insight into the mechanism operation, giving a realistic 'feel' for the motion and developing the students' intuitive understanding of the kinematics. Several viewing options can be selected, including 'stop action', which pauses after each frame to allow examination of individual steps over the range of motion, and accumulation (superimposition) of positions, for a single overall image depicting the complete range of motion. Vector arrowheads and labels are shown; labels m a y be removed if desired. A user may also choose to remove a vector (or vectors) from the display if its visual presence is unnecessary or clutters the screen. Another feature of interest is the ability of the program to display the traced-out paths of motion of selected vector heads or tails. This can be used to generate so-called 'coupler curves', for instance. Graphs of kinematic functions provide the student or designer with an insight into the displacement, velocity,

-3 1 -2 5 -6 -7 4 9 -10 -11 8 14 -15 12 13 A A A A A A A A 4: 0.00 7: -4.00 8: 0.00 12: 55.00 15: 0.00

Initial vector values Vector number

Length

Angle

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

3"70 4"20 l'00 4"20 1"90 2'00 4"50 4"50 0"90 4'40 0"60 0"90 2"30 0'50 2-00

180 192 65 * 240 255 * * 65 185 65 * 260 310 *

Kinematic simulations of planar mechanisms

EXECUTION DATA

r.Anversion 1.4

-

September 05, 1990

215

09:l

The final input value: 5 The increment for the input: .l

1 execution

screen

INote:

the two

DOD-UD

and acceleration behavior of the dependent variables, with respect to time, over the entire range of motion. The combined effect of viewing the motion simulation and then consulting the graphs is to coordinate the ability to visualize mechanism mechanics with an understanding of change in kinematic quantities. Colors and line types (dotted, dashed, etc.), are used to clearly differentiate between the three graphs, so that they can be shown together. To avoid confusing scale changes, the values are normalized with a vertical scale from -1.0 to 1.0 by dividing each quantity by the absolute value of its respective maximum. The values of these maxima are displayed on the screen with the graph. The third output option is simply the tabulation of the displacements, velocities, and accelerations of the dependent variables, providing the same information as the graphs present, but in precise numerical format. In class, this option is used to verify short hand calculations which further the students’ familiarity with the analysis procedure. File handling KPLAn is capable of storing and loading mechanism data in unformatted DOS files. A user may peruse disk or diskette directories, and if files with the filename extension ‘.KPL’ are found, the user may select a file by using the arrow keys to move a highlighting cursor bar. When the ‘enter’ key is pressed, the highlighted tile is loaded. A file can also be loaded by manually typing its name. When a file is saved, the program saves the mechanism model, as well as the kinematic analysis data if it has been generated. When the file is reloaded at a

menus do not annear simultaneouslv in the actual screen). future time, a user is shown a static diagram of the model, and asked if it represents the intended mechanism. If so, the kinematic analysis proceeds, and if the analysis information was saved with the model, the menu for selection of output displays is presented. If the mechanism is incorrect, the choices to save, modify, restart or end the session are given. Terminating KPLAn The ‘escape’ key is available at most points in the program to perform an appropriate abortive function; i.e. depending on the circumstances it may cause a return to a previous menu level, cancel the current action, restart the program, or end the session. A user is also given the option to terminate the program immediately at any time by pressing the ‘break’ key. At convenient points throughout the program, a user is given the choices of saving the current data and/or restarting the program. Finally, when a user attempts to exit, he is asked for verification, thereby preventing ‘accidental termination.

EXAMPLES In order to fully assess the convenience and efficiency of KPLAn, two examples were formulated and are presented here. The first example was designed to implement many of the general attributes found in most mechanisms. The second example is a demonstration of the possible practical application of KPLAn, in the analysis of a front-end loader design.

R.P.S. Han, R. Tsuyuki

216

(b)

Fig. 8. (a) path tracing and (b) displacement, velocity and acceleration graphs.

(b) Fig. 7. Example 2: (a) mechanism of interest and (b) accumulated simulation plot.

Example 1 Figure 3(a) shows a generic multi-loop mechanism and its vector loops are displayed in Figs 3(b) to 3(d). Note the use of three vectors for the slider-crank in loop 1, as opposed to the use of four vectors for the offset slidercrank in loop 3. It is necessary to add a vector to represent the offset. Also note that the ternary link is represented by the commonality of vectors 2 and 5, and no vector is therefore needed (in this model) to represent the third side of the triangle. Of course, there are often many different ways to model a given mechanism. The input data are summarized in Table 1, and the input screen during entry of the initial vector values is shown in Fig. 4(a). With the input variable being the angle of vector 1, the execution data are: a) constant angular velocity of 1-0 rad/s, b) iteration tolerance of 0-01 and

c) increment of input by 5° to final position of 90 °. Figure 4(b) shows the accumulated simulation plot over the complete range of motion. Note that all vectors are numbered for easy interpretation and can be turned off if not required. Also, the driver link is shown red for rapid identification. To print, the FIO key is used. It should be pointed out that the instruction depicted in the bottom right corner of the screen will not appear in the hardcopy.

Example 2 To demonstrate the use of KPLAn in a somewhat more practical model, a front-end loader is analysed. Figure 5(a) shows the proposed machine, and Figs 5(b) through 5(d) show how the design has been reduced to its vector loop representation. For this design, the unusual shape of the central rigid link required the addition of loop 2; however, this presented no problem to KPLAn, and the other loops are ordinary four-bar linkages. The input data are given in Table 2. The execution data are:

Kinematic simulations of planar mechanisms a) constant linear velocity o f 1"0 unit/s b) iteration tolerance of 0"01 and c) increment of input by 0.1 units to final length of 5"0 units. Figure 6 is a direct hardcopy of a K P L A n menu screen. Note that this screen has been modified for the two pop-up menus to appear simultaneously, for the purpose of space conservation in this paper. In actual K P L A n operation, no two menus are on-screen at any one time, to avoid confusion. As shown, the execution parameters have been specified and the computations successfully completed. The pop-up menu at bottom-center location allows a user to choose the output format to be viewed, and in this case, motion simulation is selected. The pop-up menu appearing in the top-right corner allows a selection of viewing options, and the execution of the simulation types. Note that K P L A n has been written to run on either color or black and white (b/w) monitors; on a color screen the selected menu item is highlighted with a black cursor bar, and on a b/w monitor, the selected item is signified by a double arrow on the left as depicted. Figure 7 shows various output display options available in KPLAn. A plot of the linkage is given in Fig. 7(a) and the accumulated simulation plot for the entire range of motion is depicted in Fig. 7(b). For clarity, the options to suppress the ground link vectors and vector numbers have been turned on. Figure 8(a) describes the various paths traced out by each vector and Fig. 8(b) shows a plot of vector 6, illustrating the attractive, easy-to-interpret format of the output of KPLAn. The printing instruction as shown on the screen will not appear in the hardcopy.

217

CONCLUSION The vector loop-closure method of analysing mechanisms has been implemented with a sophisticated user interface to facilitate the kinematic analysis of singledegree-of-freedom planar mechanisms. The resulting program was used in teaching mechanism mechanics in a second-year mechanical engineering course. Pop-up menus, descriptive error-trapping and graphical output result in an easy-to-use but reasonably powerful software package. Examples were used to demonstrate and assess the accuracy of KPLAn. It was found to be versatile in its applications and efficient in keystrokes and computation time.

ACKNOWLEDGEMENT This work was supported by a University of Manitoba Research Development Grant.

REFERENCES 1. Sandor, G.N. & Erdman, A.G. Advanced Mechanism Design: Analysis and Synthesis, Vol. 2, Prentice-Hall Inc., Englewood Cliffs, 1984. 2. Boyle, W.P. Mechanism kinematics: Simul TM animation, J. Appl. Engng. Ed. 1990, 6, 361-363. 3. Han, Ray P.S. Course No: 25.212 Mechanics of Machines, Department of Mechanical & Industrial Engineering, University of Manitoba. 4. Podhorodeski, R. Computer aided analysis of generalized mechanisms, B.Sc. Thesis, Department of Mechanical & Industrial Engineering, University of Manitoba, 1983. 5. Shigley, J.E. & Uicker, J.J. Jr. Theory of Machines and Mechanisms, McGraw Hill, New York, 1980. 6. Wengert, R. A Simple automatic derivative evaluation program, Comm. ACM, 1964, 7, 463-464.