This content is specific to Simscape™ Multibody™ First Generation software. First-generation features are slated to be deprecated and should be avoided.
The Simscape Multibody term machine has two meanings.
It refers to a physical system that includes at least one rigid body. The Simscape Multibody block library allows you to create Simulink® models of machines.
It also refers to a topologically distinct and separate block diagram representing one physical machine. A model can have one or more machines.
This section explains the nature of machines and Simscape Multibody models.
A Simscape Multibody model consists of a block diagram composed of one or more machines, each of which is a set of connected blocks representing a single physical machine. For example, the following model contains two machines.
A Simscape Multibody model differs significantly from other Simulink models in how it represents a machine.
An ordinary Simulink model represents the mathematics of a machine's motion, i.e., the algebraic and differential equations that predict the machine's future state from its present state. The mathematical model enables Simulink to simulate the machine.
A Simscape Multibody model represents the physical structure of a machine, the mass properties and geometric and kinematic relationships of its component bodies. Simscape Multibody software converts this structural representation to an internal, equivalent mathematical model. This saves you the time and effort of developing the mathematical model yourself.
You create a Simscape Multibody model in much the same way you create any other Simulink model. First, you open a Simulink model window. Then you drag instances of Simscape Multibody and other Simulink blocks from the Simulink block libraries into the window and draw lines to interconnect the blocks (see Connecting Simscape Multibody Blocks).
The Simscape Multibody block library provides the following blocks specifically for modeling machines:
Machine Environment blocks set the mechanical environment for a machine. Exactly one Ground block in each machine must be connected to a Machine Environment block.
Body blocks represent a machine's components and the machine's immobile surroundings (ground). See Modeling Grounds and Bodies.
Joint blocks represent the degrees of freedom of one body relative to another body or to a point on ground. See Modeling Degrees of Freedom.
Constraint and Driver blocks restrict motions of or impose motions on bodies relative to one another. See Constraining and Driving Degrees of Freedom.
Actuator blocks specify forces, motions, variable masses and inertias, or initial conditions applied to bodies, joints, and drivers. See Applying Motions and Forces.
Sensor blocks measure the forces on and motions of bodies, joints, and drivers. See Sensing Motions and Forces.
Force element blocks model interbody forces. See Sensing Motions and Forces.
Simscape mechanical elements model one-dimensional motion and, with certain restrictions, can be interfaced with Simscape Multibody machines. See Combining One- and Three-Dimensional Mechanical Elements.
You can use blocks from other Simulink libraries in Simscape Multibody models. For example, you can connect the output of Simscape Multibody Sensor blocks to Scope blocks from the Simulink Sinks library to display the forces and motions of your model's bodies and joints. Similarly, you can connect blocks from the Simulink Sources library to Simscape Multibody Driver blocks to specify relative motions of your machine's bodies.
In general, you connect Simscape Multibody blocks in the same way you connect other Simulink blocks: by drawing lines between them. Significant differences exist, however, between connecting standard Simulink blocks and connecting Simscape Multibody blocks. This section discusses these differences.
The lines that you draw between standard Simulink blocks, called signal lines, represent inputs to and outputs from the mathematical functions represented by the blocks. By contrast, the lines that you draw between Simscape Multibody blocks, called connection lines, represent physical connections and spatial relationships among the bodies represented by the blocks.
You can draw connection lines only between specialized connector ports available only on Simscape Multibody blocks (see next section) and you cannot branch existing connection lines. Connection lines appear as solid black when connected and as dashed red lines when either end is unconnected.
Standard Simulink blocks have input and output ports. By contrast, most Simscape Multibody blocks contain only specialized connector ports that permit you to draw connection lines among Simscape Multibody blocks. Simscape Multibody connector ports are of two types: Body CS ports and general-purpose ports.
Body CS ports appear on Body and Ground blocks and define connection points on a body or ground. Each is associated with a local coordinate system whose origin specifies the location of the associated connection point on the body.
General-purpose connector ports appear on Joint, Constraint, Driver, Sensor, and Actuator blocks. They permit you to connect Joints to Bodies and connect Sensors and Actuators to Joints, Constraints, and Drivers. General-purpose connector ports appear as circles on the block icon. The circle is unfilled if the port is unconnected and filled if the port is connected.
Simscape Multibody Actuator blocks (see Applying Motions and Forces) contain standard Simulink input ports. Thus, you can connect standard Simulink blocks to a Simscape Multibody model via Actuator blocks. Similarly, Simscape Multibody Sensor blocks contain output ports (see Sensing Motions and Forces). Thus, you can connect a Simscape Multibody model to Simulink blocks via Sensor blocks.
Large, complex block diagram models are often hard to analyze. Enclosing functionally related groups of blocks in subsystems alleviates this difficulty and facilitates reuse of block groups in different models.
You can create subsystems containing Simscape Multibody blocks that you can connect to other Simscape Multibody blocks. You do this in two ways:
The Simulink documentation explains more about creating subsystems.
To create a Simscape Multibody subsystem automatically,
Create the subsystem block diagram in your model window, leaving unconnected ports for external connections.
Group-select the subsystem block diagram.
In the Simulink menu bar, select Diagram > Subsystem & Model Reference > Create Subsystem from Selection.
The last step replaces the block diagram with a Subsystem block containing the selected block diagram. It also creates and connects Simscape Multibody Connection Port blocks for the ports that you left unconnected in the block diagram. The Connection Port blocks in turn create connector port icons on the subsystem icon, enabling you to connect external Simscape Multibody blocks to the new subsystem.
Sometimes you need to make a subsystem configured differently from an automatically created one. To create a Simscape Multibody subsystem manually,
From the Simulink Ports & Subsystems library, add a Subsystem block to the model.
Open the Subsystem block.
Create the subsystem block diagram in the subsystem window.
Drag a Connection Port block from the Simscape Utilities library into the subsystem window for each port that you want to be available externally.
Connect the external connector ports to the Connection Port blocks.
You can create your own Simscape Multibody blocks from subsystems, for example, a spring-loaded Joint block or a sphere Body block. To do this, create a block diagram that implements the functionality of your custom block, enclose the diagram as a subsystem, and add a mask (i.e., a graphical user interface) to the subsystem. To facilitate sharing your custom blocks across models or with other users, create a Simulink block library and add these masked subsystem blocks to the library. The Simulink documentation explains how to create custom blocks with masks.