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
provides the 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.
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.
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.
From the Simscape > Multibody > Joints library, drag four Revolute Joint blocks into the model.
At the MATLAB® command prompt, enter
A custom library with compound body subsystem blocks opens up.
drag the following 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 body subsystem blocks exactly as shown.
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.
|Parameter||Crank-Base Transform||Rocker-Base Transform|
|Translation > Method|
|Translation > Axis|
|Translation > Offset|
In each binary link block dialog box, specify the length parameter.
|Binary Link A|
|Binary Link B|
|Binary Link A1|
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:
In the Base-Crank Revolute Joint block dialog box, expand State Targets and select Specify Position Target.
In Value, enter
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.
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.
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.
To see a complete model of the four–bar assembly, at the MATLAB command prompt enter: