Model a Compound Body

Model Overview

In this example, you model a two-hole binary link as a rigid body. Three Solid blocks represent the main body and hole sections of the link. Two Rigid Transform blocks define the spatial relationships between the three solids.

Build Model

  1. Start a new model.

  2. Drag the following blocks to the model.

    Simscape > UtilitiesSolver Configuration1
    Simscape > Multibody > Frames and TransformsRigid Transform2
    Simscape > Multibody > Body ElementsSolid3

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

    Be sure to flip the Rigid Transform block. Its B frame port must face the Main Solid block. Also include the broken line extending from the Hole B block (right click the existing connection line and drag).

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

    ParameterHole AMainHole B
    Geometry > ShapeSelect General Extrusion.Select General Extrusion.Select General Extrusion.
    Geometry > Cross-sectionEnter HoleACS. Select units of cm.Enter MainCS. Select units of cm.Enter HoleBCS. Select units of cm.
    Geometry > LengthEnter T. Select units of cm.Enter T. Select units of cm.Enter T. Select units of cm.
    Inertia > DensityEnter Rho.Enter Rho.Enter Rho.
    Graphic > Visual Properties > ColorEnter LinkRGB.Enter LinkRGB.Enter LinkRGB.

  5. In the rigid transform block dialog boxes, specify these parameters.

    ParameterRigid TransformRigid Transform1
    Translation > MethodSelect Standard Axis.Select Standard Axis.
    Translation > AxisSelect +X.Select +X.
    Translation > OffsetEnter -L/2. Select units of cm.Enter +L/2. Select units of cm.

Generate Subsystem

Enclose the binary link blocks in a Subsystem block, define the general extrusion coordinates, and specify the relevant parameter values:

  1. Select all blocks excluding Solver Configuration and press Ctrl+G.. Simulink® encloses the selected blocks in a new subsystem block. Rename the subsystem block as shown in the figure.

  2. Select the subsystem block and press Ctrl+M. Simulink adds a parameter mask to the subsystem block.

  3. In the Parameters & Dialog tab of the Mask Editor, drag six edit boxes into the Parameters group and specify the following parameters.

    Peg Hole RadiusR
    Mass DensityRho
    Link ColorLinkRGB

  4. In the Initialization tab of the Mask Editor, define the extrusion cross sections and click OK:

    % Cross-section of Main:
    Alpha = (pi/2:-0.01:-pi/2)';
    Beta = (3*pi/2:-0.01:pi/2)';
    EndACS = [-L/2 W/2; -L/2+R*cos(Alpha)...
    R*sin(Alpha); -L/2 -W/2];
    EndBCS = [L/2 -W/2; L/2+R*cos(Beta)...
    R*sin(Beta); L/2 W/2];
    MainCS = [EndACS; EndBCS];
    % Cross-section of HoleA:
    Alpha = (pi/2:0.01:3*pi/2)';
    Beta = (3*pi/2:-0.01:pi/2)';
    HoleACS = [W/2*cos(Alpha) W/2*sin(Alpha);...
    R*cos(Beta) R*sin(Beta)];
    % Cross-section of HoleB:
    Alpha = (-pi/2:0.01:pi/2)';
    Beta = (pi/2:-0.01:-pi/2)';
    HoleBCS = [W/2*cos(Alpha) W/2*sin(Alpha);...
    R*cos(Beta) R*sin(Beta)];

  5. In the dialog box of the Binary Link B subsystem block, specify these parameters.

    Peg Hole Radius0.4
    Mass Density2700
    Link Color [R G B][0.25 0.4 0.7]

Visualize Model

Update the block diagram. You can do this by pressing Ctrl+D. Mechanics Explorer opens with a static display of the binary link rigid body. To obtain the view shown in the figure, in the Mechanics Explorer toolstrip select the isometric view button .

You can open a copy of the resulting model. At the MATLAB® command line, enter smdoc_binary_link_b.

Open Reference Model

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

Related Examples

Was this topic helpful?