Model Four Bar

Model Overview

The four-bar linkage is a planar closed-loop linkage used extensively in mechanical machinery. This linkage has four coplanar bars that connect end-to-end with four revolute joints. In this example, you model a four-bar linkage using the Binary Link and Pivot Mount custom blocks that you created in previous examples. For an advanced application of the four-bar linkage, see the bucket actuating mechanism of the Backhoe featured example.

Modeling Approach

To model the four-bar linkage, you represent each physical component with a SimMechanics™ block. The linkage in this example has five rigid bodies—three binary links and two pivot mounts—that connect in a closed loop through four revolute joints. Two of the binary links have one peg and one hole. The third binary link has two holes. The fourth link is implicit: the fixed distance between the two coplanar pivot mounts represents this link.

You represent the binary links and pivot mounts using the custom library blocks that you created in previous examples. You represent the four revolute joints using four Revolute Joint blocks from the SimMechanics Joints library.

The two pivot mounts connect rigidly to the world frame. For this reason, the implicit link acts as the ground link. Two Rigid Transform blocks provide the rigid connection between the two pivot mounts and the World frame. A translation offset in each Rigid Transform block displaces the two pivot mounts symmetrically along the world frame Y axis.

To guide model assembly, you can specify the desired initial state for one or more joints in the model. To do this, you use the State Targets menu of the joint blocks. The state targets that you can specify are the joint position and velocity. These are angular quantities in revolute joints. You can specify state targets for all but one of the joints in a closed loop.

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
    SimMechanics > Second Generation > UtilitiesMechanism Configuration1
    SimMechanics > Second Generation > Frames and TransformsWorld Frame1
    SimMechanics > Second Generation > 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 World Frame block.

  4. From the SimMechanics > Second Generation > 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. See the tutorials in the table for instructions on how to create the blocks.

    BlockQuantityModeling Tutorial
    Pivot Mount2

    Model Pivot Mount

    Binary Link A2

    Model Binary Link

    Binary Link B1

    Model Two-Hole Binary Link

  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.

    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

The model is now complete. You can now specify the desired initial state for one or more joints in the model. In this example, you specify an initial angle of 30° for the Base-Crank joint. To do this:

  1. Double-click the Base-Crank Revolute Joint block.

  2. In the block dialog box, expand State Targets and select Position.

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

  4. 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. The figure shows the static display that you see in Mechanics Explorer after updating the model. To obtain the view shown in the figure, in the Mechanics Explorer toolstrip select the isometric view button .

You can guide assembly so that the four-bar linkage assembles in an open configuration instead. To do this, you must specify a position state target for at least one more joint. You do not have to specify this target precisely. If you have a general idea of what the target should be, you can enter an approximate value and select a low priority level for that target.

Closed-loop kinematic chains like the four-bar linkage are especially vulnerable to assembly issues. Even when the model assembles, SimMechanics may fail to meet one or more state targets. You can check the assembly status of the model and of the joints using the Model Report utility:

  1. In the Mechanics Explorer menu bar, select Tools > Model Report.

  2. Examine the model report for red squares or yellow triangles. These shapes identify issues in the assembly or in the joint state targets.

The figure shows the model report for the four bar linkage in the open configuration. A green circle indicates that SimMechanics satisfied the Base-Crank Revolute Joint state target precisely. A yellow circle indicates that SimMechanics satisfied the Base-Rocker Revolute Joint state target approximately.

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 double pendulum assembly, at the MATLAB command prompt enter:

  • smdoc_four_bar

Was this topic helpful?