All Products
SimMechanics
Deployment
Find and Fix Code Generation Issues
ON THIS PAGE
Variable step Simulink solver requires rsim.tlc target
Simulink solver must be continuous
SimMechanics does not support visualization in acceleratormode
SimMechanics Does Not Support Run-Time Parameters
Related Examples
More About
Find and Fix Code Generation Issues
SimMechanics™ supports code generation using Simulink® Coder. However, certain guidelines and limitations apply. These include:
Variable step Simulink solver requires rsim.tlc target.
Simulink solver must be continuous.
SimMechanics does not support visualization in accelerator mode.
SimMechanics does not support run-time parameters.
Note: To generate code for a SimMechanics model, you must have an active Simulink Coder™ installation.
Variable step Simulink solver requires rsim.tlc target
Code generation is compatible with fixed- and variable-step solvers. If you select a variable-step solver, you must specify system target file rsim.tlc. To specify the rsim.tlc system target file, follow these steps:
In the Simulink Editor window for your model, select Simulation > Model Configuration Parameters.
In the left pane of the Model Configuration Parameters dialog box, select Code Generation.
In System target file, enter rsim.tlc.
Click Apply.
Click Build to generate code for the active model.
Simulink solver must be continuous
Both fixed- and variable-step solvers can be continuous or discrete. Generating code from a SimMechanics model requires a continuous solver. SimMechanics blocks use continuous time samples, and are incompatible with discrete solvers. If you attempt to generate code with a discrete solver, Simulink Coder issues an error.
If you receive an error stating that SimMechanics does not support a discrete solver, select a continuous Simulink solver. To change the Simulink solver, follow these steps:
In the Simulink Editor window for your model, select Simulation > Model Configuration Parameters.
In Solver, under Solver options, click Solver.
In the drop-down menu, select any solver with the exception of discrete (no continuous states).
SimMechanics does not support visualization in accelerator mode
SimMechanics supports Accelerator and Rapid Accelerator simulation modes. Selecting an accelerator mode generates executable code that shortens the time required to run a simulation. However, the simulation produces no visualization output. Mechanics Explorer does not open, and you cannot visualize the model simulation. To restore visualization, select the Normal simulation mode.
If you simulate a model in Accelerator or Rapid Accelerator mode, SimMechanics issues a warning indicating that accelerator modes do not support visualization. To remove the warning, disable visualization with Mechanics Explorer:
In the Simulink Editor window for your model, select Simulation > Model Configuration Parameters.
In the Model Configuration Parameters window, expand the SimMechanics 2G node.
Select Explorer.
Clear the Open Mechanics Explorer on model update or simulation check box.