Previous section-----Next section

Algebraic Constraints

Example Mechanism for MechanicalSystems Constraint Function

by Robert Beretta

Slider-Follower Animation

Discussion

Slider-Follower Function

This sample notebook analyzes the motion of a slider-follower mechanism using the MechanicalSystems kinematics package. This mechanism is used to demonstrate the use of the Constraint function to apply a general mathematical constraint to a kinematic model.

Slider-Follower Model

The slider-follower model consists of two moving bodies, a slider and a follower, and one stationary body, the ground. The mechanism is driven by causing the slider to translate horizontally, which in turn causes the follower to reciprocate vertically. The three bodies are numbered as follows.
1. Ground    (black)
2. Slider    (red)
3. Follower    (blue)

Kinematic Model

Preparation

The Modeler2D package is loaded into Mathematica.

The following definitions are used throughout the analysis to reference each body by name.

Body Definitions

Ground

Four points must be defined on the ground (body 1).
P1 and P2. The two points that define the horizontal path of the slider.
P3 and P4. The two points that define the vertical path of the follower.

Slider

Two points must be defined on the slider (body 2).
P1 and P2. The two points that define the horizontal axis of the slider.

Follower

Two points must be defined on the follower (body 3).
P1 and P2. The two points that define the vertical axis of the follower.

Build bodies

The body objects are now added to the current model with the SetBodies function.

Constraint Definitions

Three constraints and one driving constraint are required to model the slider-follower mechanism.

Constraint 1 is a translational joint between the slider and the ground that allows the slider's horizontal travel.

Constraint 2 is a translational joint between the follower and the ground that allows the follower's vertical travel.

Constraint 3 is a horizontal driver to push the slider.

This driving constraint causes the horizontal position of the local origin of the slider (point 1 on the slider) to be equal to T.

A general constraint is used to relate the position of the follower to the slider. A general constraint contains an algebraic equation that must have the head Equal. The equation must somehow relate the positions of two or more bodies to each other. All of the Modeler2D constraint functions could be entered as general constraints, with the use of a little vector algebra.

Constraint[equation] or Constraint[{eq1, eq2, ...}] puts an equation or equations into the correct format to be used in place of other Modeler2D constraint functions.

Constraint allows any relationship between a pair of bodies that can be written in algebraic terms to be used as a mechanical constraint.

This constraint effectively acts as a translational cam in which the profile of the follower's motion (as opposed to the physical cam profile) is known as a function of the position of the slider.

SetConstraints builds the mathematical system representing the slider-follower mechanism.

Running the Model

CheckSystem tests for various modeling errors.

This runs the model at time T = 0.1 seconds.

Graphics

Mechanism Image

Here is a graphics object representing the parts of the slider-follower model. The delayed definition contains a reference to LastSolve[], so when graph is evaluated it is automatically placed in the configuration represented by the last solution found.

A bit of manipulation is required to get a plot of this profile to appear located correctly on a mechanism body. Normally, one of Modeler2D's cam type constraints and plotting functions would be used to simplify this operation.

Animation

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

The Constraint Function

In its most general form, Constraint[equations, bnums, extravars] excepts three arguments.
1. A list of constraint equations.
2. A list of the body numbers that are constrained by the equations.
3. A list of other dependent variables (and their initial guesses) that are present in the equations that are to be treated as unknowns and solved for.

In the previous example, it was not necessary to include bnums because the same bodies were already constrained by other constraint functions, so SetConstraints already knew to include the correct set of variables.

By using Constraint with the extravars argument, additional degrees of freedom and matching dependent variables can be added to the model. These variables are solved for along with all of the other dependent variables whenever SolveMech is run.

The extra variable xvar now appears at the end of the solution rule.

End