Mechanical links are common building blocks in linkages, mechanisms, and machines. The simple pendulum is an example with one link. In this tutorial, you model a simple link with two end frames that you can later connect to joints. Rigid Transform blocks provide the end frames, while a Solid block provides geometry, inertia, and color. For simplicity, the model assumes the link has a brick shape.
At the MATLAB® command line, enter
Multibody™ block library and a model template with commonly
used blocks open up.
Make a copy of the Rigid Transform block and paste it in the model. The Rigid Transform blocks enable you to create new frames to which you can connect joints during multibody assembly.
Delete the blocks Simulink-PS Converter, PS-Simulink Converter, and Scope. You do not need these blocks in this tutorial.
Connect the remaining blocks as shown in the figure. Ensure that the base frame ports (B) of the Rigid Transform blocks both face the Solid block frame port. Since each Rigid Transform block applies a spatial transformation with respect to its base frame, switching port connections generally changes the spatial relationship between the two frames.
In the Solid block dialog box, specify the following parameters. Later, you define the MATLAB variables shown using a Subsystem block that contains the Solid and Rigid Transform blocks. Among its advantages, this approach enables you to update variables used in multiple blocks from a single place—the Subsystem block dialog box.
|Geometry > Dimensions||Change to |
|Inertia > Density||Default units|
|Graphic > Visual Properties > Color||Not applicable|
In the dialog boxes of the Rigid Transform and Rigid Transform1 blocks, specify the following parameters. These parameters encode the offset between the base and follower port frames of the Rigid Transform blocks, located at the link ends, with respect to the Solid reference port frame.
|Parameter||Rigid Transform1||Rigid Transform||Units|
|Translation > Method||Not applicable|
|Translation > Axis||Not applicable|
|Translation > Offset||Change to |
Select the Solid block and the two Rigid Transform blocks.
Right-click the highlighted region and select Create Subsystem from Selection. Simulink® adds a new Subsystem block containing the Solid and Rigid Transform blocks. At the end of the tutorial, this will be a custom block representing the simple link rigid body.
Right-click the Subsystem block, and select Mask > Create Mask. A mask editor opens up, enabling you to specify the numerical values of the MATLAB variables you entered in the Solid and Rigid Transform block dialog boxes.
In the Parameters & Dialog tab of the Mask Editor window, add five edit fields to the Parameters folder. You can find this folder in the Dialog box pane. In the edit fields, specify the following parameters and click OK. Prompt is the desired text for each parameter in the Subsystem block dialog box. Name is the MATLAB variable associated with each Subsystem block parameter.
Double-click the Subsystem block dialog box and enter the following numerical values. These are the values of the MATLAB variables that you entered in the Solid and Rigid Transform block dialog boxes.
|Color [R G B]|
Update the block diagram. You can do this by selecting, in the Simulink menu bar, Simulation > Update Diagram. Mechanics Explorer opens with a front view of the simple link model. In the Mechanics Explorer toolstrip, select the isometric view button to obtain the 3-D view shown below. To view the frames present in the model—including those you created using the Rigid Transform blocks—select View > Show Frames in the Mechanics Explorer menu bar.
Rename the Subsystem block Simple Link and save it in a custom block library. You reuse this block in tutorial Model a Simple Pendulum.
Simple Link Custom Block