|On this page…|
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.
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.
To model the four-bar linkage:
Start a new model.
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.
|Simscape > Utilities||Solver Configuration||1|
|SimMechanics > Second Generation > Utilities||Mechanism Configuration||1|
|SimMechanics > Second Generation > Frames and Transforms||World Frame||1|
|SimMechanics > Second Generation > Frames and Transforms||Rigid Transform||2|
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.
From the SimMechanics > Second Generation > Joints library, drag four Revolute Joint blocks into the model.
At the MATLAB® command prompt, enter smdoc_compound_rigid_bodies. A custom library with compound rigid body blocks opens up.
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.
|Binary Link A||2|
|Binary Link B||1|
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.
In the Rigid Transform block dialog boxes, specify the offset between the pivot mounts and the world frame.
|Parameter||Crank-Base Transform||Rocker-Base Transform|
|Translation > Method||Standard Axis||Standard Axis|
|Translation > Axis||-Y||+Y|
|Translation > Offset||15 in units of cm||15 in units of cm|
In each binary link block dialog box, specify the length parameter.
|Binary Link A||10|
|Binary Link B||35|
|Binary Link A1||20|
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:
Double-click the Base-Crank Revolute Joint block.
In the block dialog box, expand State Targets and select Position.
In Value, enter -30 and press OK.
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.
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. The figure shows the open initial configuration that results when you add a position state target of 0 degrees at the Base-Rocker Revolute Joint block.
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:
In the Mechanics Explorer menu bar, select Tools > Model Report.
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.
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.