SimMechanics | ![]() ![]() |
Mechanical Environment Settings Dialog Box
The Mechanical Environment Settings dialog box allows you to choose simulation options that are specific to models using SimMechanics blocks. To display this dialog, select Mechanical environment from the model's Simulation menu. The Mechanical Environment Settings dialog appears. The dialog groups SimMechanics global settings onto four tabbed panes: Parameters, Constraints, Linearization, and Visualization. The following sections explain the settings on each pane.
Parameters Pane
This pane includes the following simulation settings.
Gravity Vector and Units
The value of this parameter is a MATLAB vector that specifies the magnitude and direction of gravitational acceleration in the model's world coordinate system. The adjacent list box specifies the units that the vector represents. The default vector is [0 -9.81 0]
. The default units are m/s
2 (meters per square second). Use the menu to the right if you want to reset the units.
Analysis Mode
Specifies the type of analysis to be performed during the simulation. Choose one from the menu. See Choosing an Analysis Mode for more information.
Analysis Mode |
Description |
Forward dynamics |
Computes the positions and velocities of the system's bodies, given forces, torques, and initial conditions. This is the default mode. |
Inverse dynamics |
Computes the forces and torques required to produce the specified motions of an open system (see Open-Topology Example: Double Pendulum). |
Kinematic s |
Computes the forces and torques required to produce the specified motions of a closed-loop system (see Closed-Loop Example: Four-Bar System). |
Trimming |
Variant of Forward Dynamics mode to be used with the Simulink |
Linear Assembly Tolerance
Maximum separation allowed between bodies connected by prismatic joints. The default is 1e-3 m
. Use the menu on the right to set the units. See Setting Assembly Tolerances for more information.
Angular Assembly Tolerance
Maximum separation allowed between bodies connected by revolute joints. Default is 1e-3 rad
. Use the menu on the right to set the units. See Setting Assembly Tolerances for more information.
Constraints Pane
This pane contains settings for models that contain constraint or driver blocks.
Constraint Solver Type
Type of solver used to solve constraints on the mechanical system's states specified by the model's constraint and driver blocks. Choose one from the menu. See Choosing a Constraint Solver for more information.
Solver Type |
Description |
Stabilizing |
Adds a self-correcting term to the state equations to be solved that stabilizes the numerical solution, i.e., causes it to gravitate toward, rather than drift away from, the actual solution. This is the default. |
Tolerancing |
Solves the constraints on the system's states to a specified degree of accuracy. |
Solves the constraints to the numerical precision of the computer on which the simulation is running. |
Constraint Relative Tolerance
The relative tolerance used by the Tolerancing constraint solver to determine when to stop refining a solution. Default is 1e-4
. See Tolerancing Constraint Solver for more information.
Constraint Absolute Tolerance
The absolute tolerance used by the Tolerancing constraint solver to determine when to stop refining the solution of a model state. Default is 1e-4
. See Tolerancing Constraint Solver for more information.
Use Robust Singularity Handling
Select this check box if you want Simulink to take extra steps to handle singularities in a system's equations of motion. This option increases the length of time required to solve a system's equations of motion regardless of whether they have singularities. Hence, you should select this option only as a last resort, i.e., only if Simulink ODE solvers cannot otherwise solve the system's equations of motion or require an excessively long time to do so.
Show automatically cut joints
Selecting this check box causes Simulink to mark the icons of Joint or Constraint/Driver blocks that it cuts during simulation of the model.
Linearization Pane
This pane allows you to specify the type of state perturbation used by the Simulink model linearization command, linmod
, when linearizing a SimMechanics model (see Linearizing SimMechanics Models).
State Perturbation Type
Specifies the type of state perturbation used by linmod
to linearize a mechanical systems model.
Adaptive perturbation
computes the size of the perturbation used at each step in the linearization process to ensure accurate computation of the linearization coefficients.
Fixed perturbation
uses the perturbation size specified in the Perturbation size field.
Fixed perturbation is generally faster but can also be less accurate than adaptive perturbation. You therefore should choose the fixed option only if the adaptive option takes an excessively long time and you are willing to devote time to finding, either analytically or experimentally, a fixed perturbation size that produces an accurate linearization of your model. If you choose the fixed option, you should check its results against the linearization produced by the adaptive option.
Perturbation Size
Specifies the relative size of the perturbation used by the Fixed perturbation
option. The size is relative to the size of the state being perturbed.
Visualization Pane
This pane enables you to select various visualization options for your model. For additional information on visualization, see Visualizing and Animating Machines.
Draw Machine Using
Specifies the visualization tool that Simulink uses to render your model when you are building and/or simulating the model. If the Virtual Reality Toolbox is installed on your system, the adjacent menu allows you to choose between MATLAB Graphics
or the Virtual Reality Toolbox
. If the Virtual Reality Toolbox is not installed on your system, Simulink uses MATLAB (Handle) Graphics to render your model.
Represent Bodies As
Specifies the type of shape used to render the model's bodies. You can choose Equivalent ellipsoids
or Convex hulls
. See Rendering Body Shapes in SimMechanics in the Visualizing and Animating Machines chapter.
Draw Machine in Initial State
Selecting this check box causes Simulink to render the model in its initial state when you select the Apply or OK button on the Mechanical Environment Settings dialog and at the times specified by the Update machine option.
Update Machine
Specifies when Simulink updates the initial state rendering of your model. The menu options are
When diagram changes
(whenever you change your block diagram)
Only at Update diagram
(whenever you select Update diagram from the model's Edit menu)
Animate Machine During Simulation
Selecting this check box causes Simulink to animate the model's visualization during simulation, i.e., recreate the rendering of the model at each time step to show the current positions of the model's bodies.
![]() | Choosing an ODE Solver | Finding Forces from Motions | ![]() |