Documentation |
On this page… |
---|
In example Represent Binary Link Frame Tree, you modeled the frame tree of a binary link rigid body. In this example, you add to that frame tree the solid properties of the binary link: geometry, inertia, and color.
To model a binary link, you must use multiple Solid blocks. Each Solid block represents an elementary portion of the binary link. Rigid bodies that you model using multiple Solid blocks are called compound rigid bodies. The compound rigid body technique reduces a single complex task (modeling the entire binary link shape) into several simple tasks (modeling the Main, Hole, and Peg sections of the binary link).
To use the compound rigid body technique:
Divide shape into simple sections.
Dividing the shape simplifies the modeling task in more complex cases. You can divide the binary link into three simple sections: Main, Peg, and Hole, shown in the figure.
Represent each section using a Solid block.
Each section should be simple enough to model using a single Solid block. In the binary link example, you can represent sections Main and Hole using SimMechanics™ shape General Extrusion, and section peg with SimMechanics shape Cylinder.
Rigidly connect Solid blocks to rigid body frame tree.
Rigid connections ensure the different solid sections move as a single rigid body. Connect the Solid blocks to the binary link frame tree to apply the correct spatial relationships between the solid sections.
You model the binary link as a compound rigid body subsystem. In this subsystem, three Solid blocks represent the basic solid sections of the binary link. Each solid section has a shape and a local reference frame that you connect to the binary link frame tree. Two SimMechanics shapes are used: General Extrusion and Cylinder.
You can promote subsystem reusability by parameterizing solid properties in terms of MATLAB^{®} variables. In this example, you initialize the variables in a subsystem mask. You can then specify their numerical values in the subsystem dialog box. The table provides the dimensions needed to model the binary link solid sections. In the previous example, Represent Binary Link Frame Tree, you used the first three dimensions to specify the spatial relationships between the different binary link frames.
Dimension | MATLAB Variable |
---|---|
Length | L |
Width | W |
Thickness | T |
Peg Radius | R |
SimMechanics shape General Extrusion requires you to specify a set of cross-section coordinates. This is a MATLAB matrix with all the [X Y] coordinate pairs needed to draw the cross-section. Straight line segments connect adjacent coordinate pairs.
Coordinate matrices must obey a set of rules. The most important rule is that the solid region must lie to the left of the line segment connecting adjacent coordinate pairs. For more information, see Revolution and General Extrusion Shapes. The figure shows the coordinates required to specify the cross-section shapes of solid sections Main and Hole.
At the MATLAB command prompt, enter smdoc_binary_link_frames. A SimMechanics model opens with the frame tree you modeled in the Represent Binary Link Frame Tree tutorial.
Right click Binary Link and select Mask > Look Under Mask.
From the SimMechanics Body Elements library, drag three Solid blocks into the model.
Connect and name the blocks as shown in the figure.
In the Solid block dialog boxes, specify these parameters.
Parameter | Hole | Main | Peg |
---|---|---|---|
Geometry > Shape | Select General Extrusion. | Select General Extrusion. | Select Cylinder. |
Geometry > Cross-section | Enter HoleCS. Select units of cm. | Enter MainCS. Select units of cm. | — |
Geometry > Radius | — | — | Enter R. Select units of cm. |
Geometry > Length | Enter T. Select units of cm. | Enter T. Select units of cm. | Enter 2*T. Select units of cm. |
Geometry > Density | Enter Rho. | Enter Rho. | Enter Rho. |
Graphic > Color | Enter LinkRGB. | Enter LinkRGB. | Enter PegRGB. |
In the subsystem mask, initialize the MATLAB variables you entered for the block parameters.
Select the subsystem block and press Ctrl+M to create a subsystem mask.
In the Parameters & Dialog tab of the Mask Editor, drag four edit boxes into the Parameters group and specify these parameters. Then, click OK.
Prompt | Name |
---|---|
Peg Radius | R |
Mass Density | Rho |
Link Color [R G B] | LinkRGB |
Peg Color [R G B] | PegRGB |
Note: The subsystem mask should contain three other parameters: L, W, and T. You specify those parameters in Represent Binary Link Frame Tree. |
In the Initialization tab of the Mask Editor, define the extrusion cross-sections and press OK:
% Cross-section of Main: Alpha = (-pi/2:0.01:pi/2)'; Beta = (pi/2:-0.01:-pi/2)'; PegCS = [L/2+W/2*cos(Alpha)... W/2*sin(Alpha)]; HoleCS = [-L/2 W/2; -L/2 + R*cos(Beta)... R*sin(Beta); -L/2 -W/2]; MainCS = [PegCS; HoleCS]; % Cross-section of Hole: Alpha = (pi/2:0.01:3*pi/2)'; Beta = (3*pi/2:-0.01:pi/2)'; HoleCS = [W/2*cos(Alpha) W/2*sin(Alpha); R*cos(Beta) R*sin(Beta)];
In the binary_link subsystem block dialog box, specify these parameters.
Parameter | Value |
---|---|
Length | 30 |
Width | 2 |
Thickness | 0.8 |
Peg Radius | 0.4 |
Mass Density | 2700 |
Link Color [R G B] | [0.25 0.4 0.7] |
Peg Color [R G B] | [1 0.6 0.25] |
Update the block diagram. You can do this by pressing Ctrl+D. Mechanics Explorer opens with a static view of the binary link. To obtain the view shown in the figure, in the Mechanics Explorer toolstrip select the isometric view button .
To view a completed version of the binary link model, at the MATLAB command prompt enter smdoc_binary_link_a.