Previous section-----Next section

2.1 Body Objects

A SysBody object is a Mech data object that is used to define the points and properties of a mechanism body. It is not necessary to use body objects in Mech kinematic models, as demonstrated in Sections 1.2 and 1.3, but the use of body objects allows points to be defined once, inside the body object, and then to be referenced throughout the Mech model. This can reduce the likelihood of error due to changing the definition of a point at one place on the model, while failing to change it elsewhere.

2.1.1 Body

Mech SysBody objects are created by the Body function, and used to define specific properties of a body in a mechanism model.

A function to define body objects.

Body accepts three options for defining inertia properties of a body: Mass, Inertia, and Centroid. These options will be discussed further in Section 8.1. The options for Body that are relevant in the kinematic phase of analysis are the PointList and InitialGuess options.

2D

2D options for Body.

3D

3D options for Body.

2D/3D

Default option settings for Body.

Executing the Body function does not, in itself, have any affect on the current Mech model. The returned body objects must be added to the model with the SetBodies command, which is discussed in Section 2.1.2.
Initial guesses specified with a body object are referred to as the permanent initial guesses. These initial guesses are used the first time that a solution is sought with SolveMech. Each subsequent solution attempt uses the previous solution as its initial guess. When the initial guesses are set with SetGuess, they may be explicitly set to user-specified values, or reset to the stored values of the permanent initial guesses.

Example

This loads the Modeler2D package.

The 2D example mechanism of Section 1.2 can be modified to use three body objects instead of repeatedly calling out the several local point coordinates on the ground, crankshaft, and piston bodies. These body objects store the local point definitions for future reference, through their integer point numbers, by other Mech functions.

Here are the crankshaft-piston mechanism bodies.

  • The ground body object uses three local point definitions.
    P1 is a point at the global origin that is the rotational axis of the crankshaft.
    P2 and P3 are two points that define the vertical line upon which the piston translates.
  • This defines a body object for the ground body.

  • The crankshaft uses two local point definitions.
    P1 is a point at the local origin that is the rotational axis of the crankshaft.
    P2 is a point on the local x axis that is the attachment point of the connecting rod.
  • This defines a body object for the piston.

  • The piston also uses two local point definitions.
    P1 is a point on the local y axis that is the attachment point of the connecting rod.
    P2 is a point on the local y axis that is the upper end of the translation line of the piston.
  • This defines a body object for the piston.

    InitialGuess

    Alternately, the piston could have been defined with the local origin at the attachment point of the connecting rod. This would suggest that a different initial guess be used than the default of X3 = 0, Y3 = 0, CapitalTheta3 = 0.

    Here is a body object for the piston with relocated origin and corresponding initial guess.

    This body object functions identically to the first one, except the Y coordinate of the piston is always 4 units greater, because the origin of the body has moved 4 units upward.
    Note that each of these body objects must be added to the current model with SetBodies before they will have any effect on the model.

    2.1.2 SetBodies

    The Mech SetBodies function is used to apply the data contained in body objects to the current kinematic model.

    The body object processing function.

    All properties specified in a call to SetBodies overwrite properties that are currently defined unless the property specification is the default, Automatic, in which case the property is left unchanged.
    If SetBodies is passed a body object with an InitialGuess specification other than Automatic, the current initial guesses of each body are reset to the values of the permanent initial guesses.
    There is a subtle issue regarding the use of the PointList specification with SetBodies. When SetBodies is run with a new InitialGuess specification, the changed guess is immediately reflected in Mech's internal database. The same holds true for changing inertia properties with SetBodies; the mass matrix is immediately updated.
    However, changing the coordinates of a point with PointList must reflect a change throughout the constraint equations defined with SetConstraints. This cannot be done without rebuilding the constraint equations. Therefore, if the constraint equations have already been built with SetConstraints when SetBodies is passed a PointList specification other than Automatic, the constraint equations will all be automatically rebuilt by SetConstraints the next time that a solution is sought, which may cause a noticeable delay in the operation of SolveMech.
    The following command incorporates the three body objects that were defined in Section 2.1.1 into the current model.

    This starts a model with the three body objects.

    SetBodies returns Null. All of the mechanism points and properties passed to SetBodies are stored in Mech's internal database.
    Now that local point definitions have been added to the current model, they can be referenced by their local point numbers in any Mech function. Instead of using the local coordinates of a point, simply use the integer point number. For example, the Translate2 constraint in the crankshaft-piston model would use four local point numbers instead of the four explicit 2D coordinates in the Line objects.

    Here is a constraint with, and without, local point numbers.

    Updating Properties

    SetBodies only sets the values of the properties that are not specified with the default, Automatic. Thus, SetBodies can be used to update the value of individual body properties without affecting properties already defined.

    This updates only the crankshaft's initial guess.

    PointList

    Note that PointList, like many Mech options, can also be used as a function.

    Another usage of PointList.

    Here are the local coordinates of point 2 on the piston.