Documentation

Model a Closed-Loop Kinematic Chain

Model Overview

This example shows how to model a four bar—a closed kinematic chain comprising four bodies that connect through revolute joints. One of the links is fixed to the World frame and acts as a ground. This link is replaced here by two pivot mounts connected through a rigid translation transform. The custom smdoc_compound_rigid_bodies library provides the rigid body subsystem blocks used in the example.

Revolute Joint blocks enable you to model the joints connecting adjacent bodies and help set their initial states. Simscape™ Multibody™ software satisfies a joint state target precisely if it is kinematically valid and not in conflict with other state targets. A Priority parameter lets you specify which targets to attempt to satisfy first.

Build Model

To model the four-bar linkage:

  1. Start a new model.

  2. Drag these blocks to the model. The Rigid Transform blocks specify the distance between the two pivot mounts. This distance is the length of the implicit ground link.

    LibraryBlockQuantity
    Simscape > UtilitiesSolver Configuration1
    Simscape > Multibody > UtilitiesMechanism Configuration1
    Simscape > Multibody > Frames and TransformsWorld Frame1
    Simscape > Multibody > Frames and TransformsRigid Transform2

  3. Connect and name the blocks as shown in the figure. The base frame ports of the Rigid Transform blocks must connect to the World Frame block.

  4. From the Simscape > Multibody > Joints library, drag four Revolute Joint blocks into the model.

  5. At the MATLAB® command prompt, enter smdoc_compound_rigid_bodies. A custom library with compound rigid body blocks opens up.

  6. From the smdoc_compound_rigid_bodies library, drag these blocks. Each block represents a rigid body present in the four bar assembly.

    BlockQuantity
    Pivot Mount2
    Binary Link A2
    Binary Link B1

  7. Connect and name the blocks as shown in the figure. You must position the frame ports of the custom rigid body blocks exactly as shown.

Specify Block Parameters

  1. In the Rigid Transform block dialog boxes, specify the offset between the pivot mounts and the world frame. The pivot mounts are assumed to be symmetrically positioned about this frame.

    ParameterCrank-Base TransformRocker-Base Transform
    Translation > MethodStandard AxisStandard Axis
    Translation > Axis-Y+Y
    Translation > Offset15 in units of cm15 in units of cm

  2. In each binary link block dialog box, specify the length parameter.

    BlockLength (cm)
    Binary Link A10
    Binary Link B35
    Binary Link A120

Guide Assembly and Visualize Model

Guide model assembly by specifying the desired initial state for one or more joints in the model. To specify an initial angle of 30° for the Base-Crank joint:

  1. In the Base-Crank Revolute Joint block dialog box, expand State Targets and select Specify Position Target.

  2. In Value, enter -30 and press OK.

  3. In the menu bar, select Simulation > Update Diagram

    Mechanics Explorer opens with a static display of the four-bar linkage in its initial configuration. If the joint state targets that you specified are valid and compatible, the initial configuration matches those state targets precisely.

Verify Model Assembly

To check whether—and how precisely—your state targets were met, you can use the Simscape Variable Viewer or the Simscape Multibody Model Report.

To open the Simscape Variable Viewer, in the Simulink® menu bar, select Analysis > Simscape > Variable Viewer. To open the Simscape Multibody Model Report, update the diagram and, in the Mechanics Explorer menu bar, select Tools > Model Report.

The figure shows a Model Report example. The yellow marker indicates that the Base-Rocker Revolute Joint state target was satisfied approximately only. The remaining green marker indicates that the remaining state target was satisfied precisely.

Simulate Model

Run the simulation, e.g., by selecting Simulation > Run. Mechanics Explorer shows a 3-D animation of the four bar assembly. The assembly moves due to gravity, specified in the Mechanism Configuration block.

Open Reference Model

To see a complete model of the four–bar assembly, at the MATLAB command prompt enter:

  • smdoc_four_bar

Was this topic helpful?