SimMechanics | ![]() ![]() |
Troubleshooting Simulation Errors
SimMechanics simulations can stop before completion with one or more error messages. You might find the previous section, How SimMechanics Works, useful for tracing errors. Some common errors also appear in Modeling Machines and Checking Model Validity in the Modeling Mechanical Systems chapter. This section discusses generic error types.
Most errors and error-fixing strategies fall into broad categories. These groupings are reflected in the keywords occurring in the error messages that SimMechanics displays.
Data Validation Errors
Every numerical entry you make in SimMechanics must be a real numerical expression or MATLAB equivalent. Spatial vectors are 3-vectors, such as [3 4 5]
. Spatial tensors are 3-by-3 matrices, such as rotation matrices and the inertia tensor.
Note You can specify a two-dimensional curve in the Point-Curve Constraint block with 2-vectors. |
Ground and Body Geometry Errors
Every model must have a least one Ground block. Every Body block must have at least one Body CS, defined at the body's center of gravity (CG). You must directly or indirectly define the Body coordinate systems (CSs) of a machine relative to a Ground or to World. You cannot enter cyclic Body CS definitions. For example, defining CS3 relative to CS2, defining CS2 relative to CS1, then defining CS1 relative to CS3, results in a definition both cyclic and missing any reference to a Ground or World. You could break the cycle by referencing CS1 to a Ground or to World.
To be rendered in visualization, a Body must be connected to at least one Joint that is connected to the rest of the machine. You cannot visualize with equivalent ellipsoids a body whose principal inertial moments do not satisfy the triangle inequalities. (See Rendering Body Shapes in SimMechanics in the Visualizing and Animating Machines chapter.)
Joint Geometry Errors
The geometric configuration of joints, constraints, and drivers can conflict with assembly requirements and restrictions on certain blocks.
Assembly Violated
Assembled joints must satisfy assembly tolerances on their connected Body CSs at all times. Disassembled joints assembled at machine initialization must also satisfy assembly tolerances during the simulation.
Zero Massless Connector Distance
The initial distance between two Body CS origins connected by a massless connector must be nonzero. The massless connector holds the distance between two Body CS origins constant during motion.
Composite Joints: Restrictions Among Primitives
Certain composite Joint blocks place restrictions on their primitive joint axes. For example, Bearing must have its prismatic axis P1
aligned to its third revolute axis R3
.
Block Connection and Topology Errors
General rules on how to connect SimMechanics blocks are discussed in the Modeling Mechanical Systems chapter. In particular, consult that chapter's sections:
Some restrictions are properties of individual blocks, as explained in their reference pages. See the SimMechanics Block Reference.
![]() | How SimMechanics Works | Motion Singularity and Inconsistency Errors | ![]() |