Find and Fix Aiming-Mechanism Assembly Errors

Model Overview

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, SimMechanics™ 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 sm_dcrankaim_assembly_with_error featured example provides the basis for this example.

Explore Model

To open the model, at the MATLAB® command line, enter sm_dcrankaim_assembly_with_error. The model opens in a new window.

The figure shows a schematic of the system that the model represents. This system contains four rigid bodies, labeled A-D. These rigid 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 rigid bodies, the model contains four subsystem blocks, labeled Rigid Body A-D. Each subsystem contains one Solid block and multiple Rigid Transform blocks. The Solid block provides geometry, inertia, and color to the rigid 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 rigid body subsystem blocks Rigid Body A-D. To examine the block diagram for a rigid 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 rigid 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 rigid 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.

Update Model

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:

  • On the Simulink® menu bar, select Simulation > Update Diagram.

    Mechanics Explorer opens with a static display of your model in its initial state. Because the model contains an assembly error, SimMechanics issues an error message. Ignore that message for now.

Troubleshoot Assembly Error

Mechanics Explorer provides access to Model Report, a SimMechanics 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.

Identifying Error Root Cause

The error message that SimMechanics 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.

  1. In the Mechanics Explorer tree pane, select Pg.

  2. 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.

Correct Assembly Error

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.

  1. Right-click the Rigid Body C subsystem block and select Mask > Look Under Mask.

  2. Double-click the Slide Frame Transform block and select the new parameter values that the table provides.

    ParameterNew Value
    Rotation > Pair 2 > Follower+X
    Rotation > Pair 2 > Base+Y

  3. Click OK.

Simulate Model

You can now simulate the model. On the Simulink menu bar, select Simulation > Run. Mechanics Explorer opens with a 3-D animation of your model. The figure shows a snapshot of the animation. Rotate, 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.

Save Model

Save the model as aiming_mechanism in a convenient folder. In a subsequent example, you prescribe a joint trajectory using this model.

Related Examples

More About

Was this topic helpful?