|On this page…|
The double pendulum is a simple multibody system. It contains two links and a pivot mount that connect with joints. This system is nonlinear and does under certain conditions exhibit chaos. In this example, you assemble a double pendulum using custom blocks for the links and the pivot mount. You can later use this model to study the chaotic motion of a double pendulum.
To model the double pendulum, you represent each physical component and constraint using a SimMechanics™ block. The double pendulum system contains three rigid bodies—one pivot mount and two binary links— that connect in series through a pair of revolute joints. You represent the pivot mount and the binary links using the custom library blocks that you created in previous examples. You represent the two joints using two Revolute Joint blocks from the Joints library.
You can guide model assembly. By specifying joint state targets, you can instruct SimMechanics to assemble a joint in the configuration you want. State targets that you can specify include position and velocity, both angular and linear. At times, a state target may conflict with other state targets, or even with other kinematic constraints in the model. In these cases, you can prioritize the most important state targets by assigning them a high priority level. During assembly, if two targets conflict with each other, SimMechanics assembles the high priority target first. To specify both state target values and priority levels, you use the State Targets menu of the joint block dialog boxes.
To model the double pendulum system:
Start a new model.
Drag these custom blocks into the model. See the modeling tutorials if you have not created these custom blocks.
|pivot_mount||1||Model Pivot Mount|
|binary_link||2||Model Binary Link|
Drag these blocks into the model.
|Revolute Joint||SimMechanics > Second Generation (SM 2G) > Joints||2|
|World Frame||SimMechanics > Second Generation (SM 2G) > Frames and Transforms||1|
|Mechanism Configuration||SimMechanics > Second Generation (SM 2G) > Utilities||1|
|Solver Configuration||Simscape > Utilities||1|
Connect and name the blocks as shown in the figure.
The model is now complete. However, before visualizing and simulating the model, specify joint state targets to guide model assembly.
Double-click the two Revolute Joint blocks.
In each block dialog box, click State Targets > Specify Position Target.
In the Value fields, enter the following values and press OK.
|Block Name||Value (deg)|
If the state targets are consistent with each other and with the rest of the model, SimMechanics will assemble each joint in the specified state. To check if a state target was met and what it's actual value is, use the Model Report tool in Mechanics Explorer after updating the model.
With the model window active, press Ctrl+D to update the model.
In the Mechanics Explorer tool bar, click the isometric view button, .
The visualization pane of Mechanics Explorer displays the assembled double pendulum model using an isometric view.
From the visualization pane, it appears that SimMechanics successfully met both joint state targets. To confirm, open the Model Report tool:
In the Mechanics Explorer menu bar, click Tools > Model Report.
In the Joints tab of the Model Report window, check for yellow or red lights.
These lights identify joints with assembly issues. In this example, you should see none.
Under Position, compare the values of Actual and Specified.
These are the actual angle of the joint at time zero, and the specified angle entered in the joint block dialog box, respectively. A green light in the Status column indicates that the two values are equal.
If assembly was successful, you are now ready to simulate the double pendulum model:
With model or Mechanics Explorer window active, press Ctrl+T to simulate the model.
The visualization pane of Mechanics Explorer shows the double pendulum simulation. When the simulation ends, you can replay it without rerunning the simulation. You can also adjust playback speed and loop the animation so that it begins again once it reaches the end. To do this, use the animation tool bar at the bottom of the visualization pane.
For use in subsequent examples, save the model you created as double_pendulum in a convenient folder.