|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 with 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.
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 Cross-Section Coordinates. The figure shows the coordinates required to specify the cross-section shapes of solid sections main and hole.
This example assumes the binary link is made of Aluminum, with a mass density of 2,700 kg/m3. The binary link has a blue color, while the peg has an orange color. The orange color helps identify the peg when, in subsequent examples, you connect the peg of one link to the hole of another link. As with all parameters in this example, you specify density and color in terms of MATLAB variables. The table summarizes the variables and the values that you use in this example.
|Solid Sections: Property||MATLAB Variable||Value|
|main/hole: Color||rgb_link||[0.25 0.4 0.7]|
|peg: Color||rgb_peg||[1 0.6 0.25]|
Drag blocks into the model canvas and specify the relevant block parameters.
Open the frame tree model you built in example Represent Binary Link Frame Tree.
Open the binary_link subsystem.
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.
|Geometry > Shape||Select General Extrusion||Select General Extrusion||Select Cylinder|
|Geometry > Cross-section||Enter hole_coords||Enter main_coords||—|
|Geometry > Radius||—||—||Enter R_Peg|
|Geometry > Length||Enter T_Link||Enter T_Link||Enter 2*T_Link|
|Geometry > Density||Enter rho||Enter rho||Enter rho|
|Graphic > Color||Enter rgb_link||Enter rgb_Link||Enter rgb_Peg|
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.
|Link Color [R G B]||rgb_Link|
|Peg Color [R G B]||rgb_Peg|
In the Initialization tab of the Mask Editor, define the extrusion cross-sections and press OK:
% Cross-section of main: theta_ccw = (-90:1:90)'*pi/180; theta_cw = (90:-1:-90)'*pi/180; peg_end = [L_Link/2+W_Link/2*cos(theta_ccw)... W_Link/2*sin(theta_ccw)]; hole_end = [-L_Link/2 W_Link/2; ... -L_Link/2+R_Peg*cos(theta_cw)... R_Peg*sin(theta_cw); -L_Link/2 -W_Link/2]; main_coords = [peg_end; hole_end]; % Cross-section of hole: theta_ccw = (90:1:270)'*pi/180; theta_cw = (270:-1:90)'*pi/180; hole_coords = [W_Link/2*cos(theta_ccw) ... W_Link/2*sin(theta_ccw); R_Peg*cos(theta_cw) R_Peg*sin(theta_cw)];
In the binary_link subsystem block dialog box, specify these parameters.
|Link Color [R G B]||[0.25 0.4 0.7]|
|Peg Color [R G B]||[1 0.6 0.25]|
Update the model to visualize the binary link rigid body in Mechanics Explorer.
Press Ctrl+D to update the diagram. The binary link appears in the visualization pane of Mechanics Explorer.
To obtain the view used in the illustrations for this example:
In the View Convention drop-down list, select Y Up (XY Front).
In the Mechanics Explorer toolstrip, click the isometric view button .
Compare the result with the example schematics to confirm the validity of the solid properties specified.
So that you can use it in later examples, save the binary link subsystem as a custom library block.
Open the custom block library that you created in Represent Binary Link Frame Tree
Drag the binary_link subsystem block to the library.
Save the library as linkage_elements.