In closed-loop systems, joints and constraints must be mutually compatible. For example, in a four-bar linkage, all revolute joints must spin about parallel axes. If one of the joints spins about a different axis, assembly fails and the model does not simulate.
To simplify the troubleshooting process, Simscape™ Multibody™ provides Model Report. This tool helps you pinpoint the joints and constraints that caused assembly to fail. Once you identify these joints and constraints, you can then determine which of their frames to correct—and how to correct them.
In this example, you identify the assembly error source in an
aiming mechanism model using Model Report. Then, using Mechanics Explorer,
you determine how to correct that error source. The
example provides the basis for this example.
To open the model, at the MATLAB® command line, enter
The model opens in a new window.
The figure shows a schematic of the system that the model represents. This system contains four bodies, labeled A-D. These bodies connect in a closed loop via four joints, labeled Ri, Ro, Rg, and Pg. When connected to each other, these components form a system with one degree of freedom.
The model represents the components of this system using blocks. Each block represents a physical component. A World Frame block provides the ultimate reference frame in the model. The figure shows the block diagram that the model uses to represent the double-crank aiming mechanism.
To represent the bodies, the model contains four subsystem blocks, labeled Rigid Body A-D. Each subsystem contains one Cylindrical Solid block and multiple Rigid Transform blocks. The Cylindrical Solid block provides geometry, inertia, and color to the body subsystem. The Rigid Transform blocks provide the frames that you connect the joints to. A Reference Frame block identifies the ultimate reference frame in the subsystem block.
The model labels the body subsystem blocks Rigid Body A-D. To examine the block diagram for a body subsystem, right-click the subsystem block and select Mask > Look Under Mask. The figure shows the block diagram for Rigid Body A.
To represent the joints, the model contains four joint blocks. Three joints provide one rotational degree of freedom between a pair of bodies. You represent each of these joints with a Revolute Joint block. A fourth joint provides one translational degree of freedom between a pair of bodies. You represent this joint with a Prismatic Joint block. The model labels the revolute joint blocks Ro, Rg, and Ri, and the prismatic joint block Pg.
As the model name suggests, this model contains an error. The error prevents the model from assembling successfully, which causes simulation to fail. To update the model and investigate the assembly error:
In the Modeling tab, click Update Model.
Mechanics Explorer opens with a static display of your model in its initial state. Because the model contains an assembly error, Simscape Multibody issues an error message. Ignore that message for now.
Mechanics Explorer provides access to Model Report, a Simscape Multibody utility that summarizes the assembly status of each joint and constraint in a model. Open this utility to determine which joint has failed to assemble. To do this, in the Mechanics Explorer menu bar, select Tools > Model Report.
Model Report opens in a new window. A red square indicates that the model, as expected, has failed to assemble. A second red square indicates that an unassembled joint, Pg, is the only contributing factor in the model assembly error. This information enables you to concentrate your troubleshooting efforts on a small block diagram region—that surrounding the Pg joint block.
The error message that Simscape Multibody issued during model update identifies position violation as the root cause of assembly failure. This suggests that the frames connected by joint Pg are improperly aligned. To confirm this hypothesis, check the orientation of these frames in Mechanics Explorer.
In the Mechanics Explorer tree pane, select Pg.
In the Mechanics Explorer visualization pane, examine the position and orientation of the highlighted frames. These are the frames that appear in a light turquoise blue color.
The two frames are offset along the Z axis. This offset is valid, since joint Pg contains a prismatic primitive aligned with the Z axis, providing the frames with one translational degree of freedom along that axis. However, the two frames are also rotated with respect to each other about the common Z axis. This offset is invalid, since joint Pg contains no Revolute or Spherical primitives, and hence no rotational degrees of freedom about any axis. To correct the model assembly error, you must rotate either of the two frames so that all of their axes are parallel to each other.
In this example, you apply a rotation transform to the follower frame so that its axes lie parallel to the base frame axes. Alternatively, you could apply an equivalent rotation transform to the base frame. This step enables joint Pg, and hence the model itself, to assemble successfully.
In the tree pane of Mechanics Explorer, right-click
the Pg node and select
Go To Block. Simscape
the block diagram to the front and highlights the Pg block.
Right-click the Rigid Body C subsystem block and select Mask > Look Under Mask.
Double-click the Slide Frame Transform block and select the new parameter values that the table provides. Select OK.
|Rotation > Pair 2 > Follower|
|Rotation > Pair 2 > Base|
You can now simulate the model. Mechanics Explorer opens with a 3-D animation of your model. The figure shows a snapshot of the animation. Rotate, roll, pan, and zoom to explore.
You can use the Model Report tool to verify the assembly status. To do this, in the Mechanics Explorer menu bar, select Tools > Model Report. In Model Report, check that the assembly status icons for the model and its joints are green circles. The green circles indicate that the model has assembled correctly.