Previous section-----Next section

Whirligig

Example for Modeler2D Output Functions

Robert Beretta

Whirligig Animation

Discussion

Whirligig Function

This sample notebook analyzes the motion of a five-body mechanism with no known application, except to demonstrate kinematic mechanism analysis. All of the output functions defined by Modeler2D are utilized in this package.

The whirligig mechanism is driven by rotating the crank (body 2). A connecting rod attaches an eccentric point on the crank to a point at the center of the slider (body 3), which is forced to reciprocate on the track (body 4). The translation of the slider on the inclined track causes the rocker (body 5) to rock back and forth via the second connecting rod that ties the slider to the rocker. The last connecting rod ties the rocker to the the end of the track, which is forced to rotate about its pivotal axis on the ground which accentuates the motion of the rocker.

Whirligig Bodies

The whirligig mechanism consists of five bodies.
1. Ground    (black)
2. Crank    (red)
3. Slider    (blue)
4. Track    (green)
5. Rocker    (magenta)

The ground body serves as the stationary reference frame for the entire model. There are three obvious missing parts in this model--the three connecting rods. These parts are modeled by simple kinematic constraints that prescribe a specified distance between two points on two different bodies, which is the function of a connecting rod.

Whirligig Coordinates

The global coordinate system used in this model is a Cartesian coordinate system attached to the ground body. Each mechanism body has its own local coordinate system attached to it, in which each local point is defined.

Kinematic Model

Preparation

This loads the Modeler2D package.

Names are defined for each body number for clarity.

Body Definitions

Body objects are defined for each body in the model. These are assigned to the array variables bd[1], bd[2], and so on.

Ground

Three points need to be defined on the ground (body 1).
P1. The rotational axis of the crank.
P2. The lower pivot point of the track.
P3. The pivot point of the rocker.

Crank

Two points are defined on the crank (body 2).
P1. The axis of the crank (at the local origin).
P2. The attachment point of the first connecting rod.

Slider

Three points are defined on the slider (body 3).
P1 and P2. Two points defining the translation line of the slider.
P3. The attachment point of both the first and second connecting rod.

Track

Two points are defined on the track (body 4).
P1. The point where the track pivots on the ground (at the local origin of the track).
P2. The attachment point of the third connecting rod.
These two points also serve to define the translation line of the slider.

Rocker

Three points are defined on the rocker (body 5).
P1. The point where the rocker pivots on the ground.
P2. The attachment point of the second connecting rod.
P3. The attachment point of the third connecting rod.

Build bodies

SetBodies incorporates the body objects into the current model.

Constraint Definitions

Here are the constraints required to model the whirligig mechanism.

Here is the rotational driving constraint.

Here is the revolute joint at the crank axis.

Here is the translational joint between the slider and the track.

Here is the first connecting rod.

Here is the pivot point of the track.

Here is the third connecting rod.

Here is the pivot point of the rocker.

Here is the second connecting rod.

This incorporates the constraints into the current model.

Initial Guesses

SetGuess is used to set initial guesses for the numerical solution block. The variable guesslist is defined so that SetGuess[guesslist] may be called whenever the current guesses need to be reset to their initial values.

Running the Model

CheckSystem checks the mathematical model for errors. A return value of True is OK.

SolveMech[time] seeks a solution to the mechanism model with a specified value for time, T.

Graphics

Mechanism Images

Animation

Here is a table of 20 solution sets, spaced over a full revolution of the crank. This table is used for generating an animation of the whirligig and other time domain graphics.

The following input will generate the series of 10 graphics in the animation cell at the beginning of this notebook.

Output Functions

Location

Here is a symbolic expression for the global coordinates of the connecting rod pivot on the slider.

Here are the actual global coordinates.

Here is a plot of the X coordinate of the connecting rod pivot on the slider as a function of time.

Direction

Here is the vector from the pivot point of the track to the center of the slider.

Unit

Here is the unit vector pointed in the same direction as the result of the previous call to Direction.

Magnitude

Here is the absolute distance from the pivot point of the track to the center of the slider.

Here is the same unit vector as was returned previously.

Angle

Here is the direction angle of the first connecting rod.

PointToLineDistance

Here is the distance that the rocker axis lies to the left of the line defined by the track.

ProjectOnLine

Here is the location of the center of the rocker, projected on the track.

Here is an X vector on the rocker projected on the track.

IntersectionPoint

Here is the point at which the track and an extension of the first connecting rod intersect.

Vector Algebra Functions

RotationMatrix

Here is a rotation matrix representing a counterclockwise rotation of ang radians.

RotationMatrix is useful for building up other vector algebra output functions.

Here is the definition of the Location function.

RMatrix and IMatrix

PointToLocal

Here are the local coordinates on the track of a point located at the global coordinates {2.0, -1.5}.

Here is the same point converted back to global coordinates with Location.

XYToPolar and PolarToXY

Here are the polar coordinates of the Cartesian point {3, 4}.

This converts the polar coordinates back to Cartesian coordinates.

Velocity and Acceleration Output Functions

Only the most basic velocity and acceleration output functions are defined by Modeler2D. The time derivatives of other functions are produced by differentiation.

Velocity and Acceleration

Here are the velocity and acceleration vectors of the center of the slider.

Here are the absolute velocity and acceleration of the center of the slider.

DDistanceDT and D2DistanceDT2

The speed at which the slider is moving towards the pivot point of the track is only slightly less than the previously calculated absolute velocity of the slider.

Differentiation with Respect to Time

The dependent variables used by Modeler2D, X2, Y4, CapitalTheta5, and so on, have been automatically defined by SetConstraints such that they may be differentiated with respect to time using the Mathematica Dt function.

The DDistanceDT function can be reproduced by differentiating Distance.

Any function of time T, or dependent variables that are recognized as being dependent on T, can be differentiated in this way.

Here, essentially, is the definition of the Acceleration function.

If the application of Dt results in terms of higher than second-order, no symbol is defined to replace those derivatives, so they are returned as derivatives that are explicitly functions of T.

End