Quantcast

Documentation Center

  • Trial Software
  • Product Updates

Model Binary Link

Model Overview

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.

Modeling Approach

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:

  1. 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.

  2. 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.

  3. 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.

Solid Properties

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.

DimensionMATLAB Variable
LengthL
WidthW
ThicknessT
Peg RadiusR

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.

Build Model

  1. 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.

  2. Right click Binary Link and select Mask > Look Under Mask.

    From the SimMechanics Body Elements library, drag three Solid blocks into the model.

  3. Connect and name the blocks as shown in the figure.

  4. In the Solid block dialog boxes, specify these parameters.

    ParameterHoleMainPeg
    Geometry > ShapeSelect General ExtrusionSelect General ExtrusionSelect Cylinder
    Geometry > Cross-sectionEnter HoleCSEnter MainCS
    Geometry > RadiusEnter R
    Geometry > LengthEnter TEnter TEnter 2*T
    Geometry > DensityEnter RhoEnter RhoEnter Rho
    Graphic > ColorEnter LinkRGBEnter LinkRGBEnter LinkRGB

Update Subsystem

In the subsystem mask, initialize the MATLAB variables you entered for the block parameters.

  1. Select the subsystem block and press Ctrl+M to create a subsystem mask.

  2. In the Parameters & Dialog tab of the Mask Editor, drag four edit boxes into the Parameters group and specify these parameters. Then, click OK.

    PromptName
    Peg RadiusR
    Mass DensityRho
    Link Color [R G B]LinkRGB
    Peg Color [R G B]PegRGB

  3. 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)];
    
  4. In the binary_link subsystem block dialog box, specify these parameters.

    ParameterValue
    Length30
    Width2
    Thickness0.8
    Peg Radius0.4
    Mass Density2700
    Link Color [R G B][0.25 0.4 0.7]
    Peg Color [R G B][1 0.6 0.25]

Visualize Model

Update the block diagram. You can do this by pressing Ctrl+D. Mechanics Explorer opens with a static 3-D display of the binary link.

Open Reference Model

To view a completed version of the binary link model, at the MATLAB command prompt enter smdoc_binary_link_a.

Related Examples

Was this topic helpful?