# Documentation

## Modeling Grounds and Bodies

### Warning

This content is specific to Simscape™ Multibody™ First Generation software. First-generation features are slated to be deprecated and should be avoided.

The basic components of any mechanism are its constituent rigid bodies. A Simscape Multibody body refers to any point or spatially extended object that has mass. Simscape Multibody bodies, unlike physical bodies, do not have degrees of freedom. The Simscape Multibody Bodies library contains two blocks for representing bodies in a Simulink® model:

### Modeling Grounds

A Simscape Multibody ground refers to a body of infinite mass that acts both as a reference frame at rest for a whole machine and as a fixed base for attaching machine components, e.g., the factory floor on which a robot stands. Simscape Multibody Ground blocks enable you to represent points on ground in your machine. This in turn enables you to specify the degrees of freedom that your system has relative to its surroundings. You do this by connecting Joint blocks representing the degrees of freedom between the Body blocks representing parts of your machine and the Ground blocks representing ground points.

Each Ground block has a single connector port to which you can connect a Joint block that can in turn be connected to a single Body block. Each Ground block therefore allows you to represent the degrees of freedom between a single part of your machine and its surroundings. If you want to specify the motion of other parts of your machine relative to the surroundings, you must create additional Ground blocks.

### Caution

Each machine in a Simscape Multibody model must contain at least one Ground block connected to a Body block via a Joint block. Each submachine connected by a Shared Environment block must have at least one Ground.

#### Machine Environment Required for Each Machine

One Ground block in each machine of your model plays a second role, connection to that machine's Machine Environment block, which sets its mechanical environment.

### Caution

Exactly one Ground block in each machine in your model must be connected to a Machine Environment block.

#### World and Grounded Coordinate Systems

The Simscape Multibody master coordinate system and reference frame is called World. All grounds are at rest in World. The connector port of each Ground block defines a grounded coordinate system called GND. The GND coordinate system's axes are parallel to World.

By default the origin of the grounded coordinate system coincides with the origin of the World coordinate system. The Location field of a Ground block's dialog allows you to move the origin of GND to some other point in the World coordinate system, as in the example Model and Simulate a Simple Machine.

The GND coordinate system allows you to specify the positions and motions of parts of your machine relative to fixed points in the machine's surroundings. With a shifted origin, GND remains at rest.

### Modeling Rigid Bodies

The Simscape Multibody Body block enables you to model rigid bodies of finite mass and extent. A body is rigid if its internal parts cannot move relative to one another.

A Body block allows you to specify the following attributes of a rigid body.

Mass Properties.  These include the body's mass, which determines its response to translational forces, and its inertia tensor, which determines its response to rotational torques.

Body Coordinate Systems.  By default a Body block defines three local coordinate systems, one associated with a body's center of gravity, labeled CG, and two others, labeled CS1 and CS2, respectively, associated with two other points on the body that you can specify. You can create additional Body coordinate systems or delete them as necessary.

A Body block's dialog box allows you to specify a Body CS's origin (see Setting a Body CS's Position) and orientation (see Setting a Body CS's Orientation). The origin and orientation of a body's CG CS specify the body's starting location and orientation. The origins of the other Body coordinate systems specify the initial locations of other points on the body.

The Body block allows flexibility in specifying the origins and orientations of Body coordinate systems. You can specify the origin and orientation of a body CS relative to

• The World CS

• Any other CS on the same body

• The Adjoining CS, the CS on the neighboring body or ground directly connected by a Joint, Constraint, or Driver to the selected Body CS you are configuring

This simplifies creation and maintenance of models. The only limitation is that you must specify the origin and location of at least one of a machine's Body coordinate systems relative to the World CS.

Home Configuration.  Once you enter all the needed positions and orientations into the Bodies of your model, your machine is in its home configuration. The body velocities are zero, and any disassembled joints remain disassembled.

Connector Ports.  Any Body CS can display a Body CS Port. A Body CS Port allows you to attach Joints, Actuators, and Sensors to a Body. By default, a Body's CS1 and CS2 coordinate systems each display a Body CS port. You can display a port for any other Body coordinate system as well, including a Body's CG CS.

#### Creating a Body Block

To create a Body block,

1. Drag a Body block icon from the Simscape Multibody Bodies library and drop it into your model window.

2. Open the Body block's dialog box.

3. Enter the mass of the body you are modeling in the Mass field.

4. Select the units of mass from the adjacent units list.

5. Enter a 3-by-3 matrix representing the body's inertia tensor relative to its center of gravity coordinate system (CG CS) origin and axes in the Inertia field (see Determining Inertia Tensors for Common Shapes).

6. Enter the initial positions of the body's CG and coordinate systems in the Position tab.

7. Enter the initial orientation of the body's CG and coordinate systems in the Orientation tab.

8. Click or .

#### Determining Inertia Tensors for Common Shapes

The following table enables you to determine the inertia tensors for some common shapes. For each shape of mass `m`, the table lists the shape's principal moments of inertia, I1, I2, and I3, along the x-, y-, and z-axes of the shape's CG coordinate system.

ShapeI1I2I3
Thin rod of length L aligned along zmL2/12mL2/120
Cylinder of radius R and height h aligned along z(m/4)(R2 + h2/3)(m/4)(R2 + h2/3)mR2/2
Rectangular parallelopiped of sides a, b, and c aligned along x, y, z, respectively(m/12)(b2 + c2)(m/12)(a2 + c2)(m/12)(a2 + b2)
Cone of base radius R and height h along z(m/4)(3R2/5 + h2)(m/4)(3R2/5 + h2)3mR2/10
Ellipsoid of semiaxes a, b, and c aligned along x, y, z, respectively(m/5)(b2 + c2)(m/5)(a2 + c2)(m/5)(a2 + b2)

The corresponding inertia tensor for the shape is the following 3-by-3 matrix:

`$\left(\begin{array}{ccc}{I}_{1}& 0& 0\\ 0& {I}_{2}& 0\\ 0& 0& {I}_{3}\end{array}\right)$`

### Working with Body Coordinate Systems

Every Simscape Multibody body has Body coordinate systems (CSs) attached to it. The location of a body CS is the origin of that CS. The CS's rectangular x-y-z coordinate axes are rotated at some orientation. You set up body CS origins and orientations before running your model. But once the bodies start to move, the origins and orientations of a body's CSs remain fixed in the body. The elements of a body's inertia tensor also remain fixed in the body.

The sections Managing Body Coordinate Systems and Creating Body CS Ports explain how to create custom Body coordinate systems and Body CS ports or delete existing ports.

#### Setting a Body CS's Position

The Position tab of a Body block's dialog box allows you to specify the position of any of a body's local coordinate systems.

The Translated from Origin of and Components in Axes of lists in the tab together specify which other of your machine's coordinate systems you use as reference points and orientations to set up the coordinate systems of the body you are configuring.

To specify the position of a Body CS,

1. Open the Body block's dialog box.

The dialog box's Position tab lists the body's local coordinate systems in a table.

Each row specifies the position of the coordinate system specified in the Name column.

2. Select the units in which you want to specify the origin of the Body CS from the CS's Units list.

3. Specify the reference coordinate systems for the Body CS, i.e., the coordinate systems relative to which you want to measure the Body CS origin and the orientation of the Body CS's coordinate axes. The choices are World, the adjoining CS, and other Body CSs on the same Body.

You must directly or indirectly define all Body CSs by reference to a Ground or to World. Indirect reference means that you specify a Body CS relative to another CS and so on, in a chain of references that ultimately ends in a Ground or World.

You do this by selecting the origin and orientation of the specification CS from the Body CS's Translated from Origin of and Components in Axes of lists, respectively. For example, suppose that you want to specify the position of CS2 relative to another coordinate system, whose origin is at the origin of CS1 but whose axes run parallel to those of the CG CS. Then you would select CS1 from the Translated from Origin of list of CS2 and CG from the Components in Axes of list of CS2.

4. Enter a vector specifying the location of the Body CS in the Origin Position Vector [x y z] field of the CS.

The components of the vector must be in the units that you selected and relative to the coordinate system that you selected. For example, suppose that you had selected `m` as the unit for specifying CS2's origin and CS1 and World as the CSs specifying the origin and orientation for CS2. Now suppose that you want to specify the location of CS2 as one meter to the right of CS1 along the World x-axis. Then you would enter `[1 0 0]` as CS2's position vector.

5. Click to accept the position setting or to accept the setting and dismiss the dialog box.

#### Setting a Body CS's Orientation

The Orientation tab of a Body block's dialog box allows you to specify the orientation of any of a body's local coordinate systems.

To specify the orientation of a Body CS,

1. Open the Body block's dialog box.

2. Select the dialog box's Orientation tab.

3. Select the units (degrees or radians) in which you want to specify the orientation of the CS from the CS's Units list.

4. Select the coordinate system relative to which you want to specify the orientation of the Body CS from the Body CS's Relative CS list. The choices are World, the adjoining CS, and other Body CSs on the same Body.

5. Select the convention you want to use to specify the orientation of the Body CS from the CS's Specified Using Convention list.

6. Enter a vector that specifies the orientation of the Body CS relative to the CS you choose for that purpose, according to the selected specification convention.

7. Click to accept the orientation setting or to accept the setting and dismiss the dialog box.

#### Managing Body Coordinate Systems

You will often need to modify the default Body coordinate systems of a Body block. You might want to connect a Body to more than two Joints, in which case you need not only more Body CSs, but their Body CS ports as well. Connecting Actuators and Sensors to Bodies requires a Body CS and Body CS port for each connection.

The Body coordinate systems tab of a Body block's dialog box contains a row of buttons that allow you to add, delete, and reorder a Body's local coordinate systems.

To use these buttons, select a Body CS in the CS table and select

• Delete to remove the selected CS from the table

• Up to move the CS's entry one row up in the CS table

• Down to move the CS's entry one row down in the CS table