Configuring SimMechanics Models in Simulink

SimMechanics and Simulink Options

Simulink® provides an extensive set of simulation options that apply to any type of model. Additional options apply specifically to simulating SimMechanics™ models. This section discusses those standard Simulink options for which mechanical models require special consideration and the additional SimMechanics options specific to mechanical systems .

Distinguishing Models and Machines

Respecting the distinction introduced in Representing Machines with Models, you need to make two categories of settings, one for each machine in a model and one for the entire SimMechanics model. To configure a mechanical model for simulation, you need to interact with two dialogs.

Configuring Methods of Solution following discusses the settings in detail.

Machine Settings via the Machine Environment Block

Every machine in your model requires exactly one Machine Environment block to be connected to one of its Ground blocks. The mechanical settings that you enter in that Machine Environment block determine the mechanical environment for that machine only. Other machines are controlled by their respective Machine Environment blocks.

This block controls the connected machine's mechanical environment, including simulation dynamics, machine dimensionality, gravity, tolerances, constraints, motion analysis modes, and visualization. See the Machine Environment reference page for a full description of the block dialog's four tabs.

The Machine Environment settings are also presented in the following sections of this chapter:

Model-Wide Settings via Simulink and Simscape Interfaces

Mechanical and general settings for an entire model are located in the Simulink Configuration Parameters dialog, accessed through the Simulink Simulation menu. Every node in this dialog is relevant to controlling your model's simulation, including visualization. See the Simulink documentation for more details about this dialog.

At a minimum, you need to check and possibly adjust the settings in the Solver node and the Simscape node, with its SimMechanics subnode, before running a mechanical model:

  • The active Editing area of the Simscape node allows you to choose the Simscape™ software editing mode. To change this setting, see Using the Simscape Editing Mode.

  • The SimMechanics-specific controls appear on the SimMechanics subnode of the Simscape node. It has two active areas, Diagnostics and Visualization.

  • The choice and configuration of the solver are Simulink settings, located on the Solver node. This node has two active areas, Simulation time and Solver options.

Simulink Configuration Parameters Dialog (Simscape Node Shown)

SimMechanics Default Settings Not Changed If SimMechanics Blocks Are Absent

If you have the SimMechanics product installed, any model you build will display the SimMechanics subnode under the Simscape node. However, if you then build a model that does not include any SimMechanics blocks, any nondefault SimMechanics settings you make in the SimMechanics subnode will not be saved in that model. Upon saving, closing, and reopening the model, the SimMechanics settings will revert to their defaults.

Was this topic helpful?