Limitations

Sample Time and Solver Restrictions

The default sample times of Simscape™ blocks are continuous. You cannot simulate Simscape blocks with discrete solvers using the default sample times.

If you switch to a local solver in the Solver Configuration block, the states of the associated physical network become discrete. If there are no continuous Simulink® or Simscape states anywhere in a model, you are free to use a discrete solver to simulate the model.

You cannot override the sample time of a nonvirtual subsystem containing Simscape blocks.

Algebraic Loops

A Simscape physical network should not exist within a Simulink algebraic loop. This means that you should not directly connect an output of a PS-Simulink Converter block to an input of a Simulink-PS Converter block of the same physical network.

For example, the following model contains a direct feedthrough between the PS-Simulink Converter block and the Simulink-PS Converter block (highlighted in magenta). To avoid the algebraic loop, you can insert a Transfer Function block anywhere along the highlighted loop.

A better way to avoid an algebraic loop without introducing additional dynamics is shown in the modified model below.

Restricted Simulink Tools

Certain Simulink tools are restricted for use with Simscape software:

  • You can use the Simulink set_param and get_param commands to set or get Simscape block parameters, if the parameters correspond to fields in the block dialog box. MathWorks® does not recommend that you use these commands to find or change any other block parameters.

    If you make changes to block parameters at the command line, run your model first before saving it. Otherwise, you might save invalid block parameters. Any block parameter changes that you make with set_param are not validated unless you run the model.

  • Simscape blocks accept Simulink.Parameter objects as parameter values in get_param and set_param, within the restrictions specified here.

  • Enabled subsystems can contain Simscape blocks. Always set the States when enabling parameter in the Enable dialog to held for the subsystem's Enable port.

    Setting States when enabling to reset is not supported and can lead to fatal simulation errors.

  • You can place Simscape blocks within nonvirtual subsystems that support continuous states. Nonvirtual subsystems that support continuous states include Enabled subsystems and Atomic subsystems. However, physical connections and physical signals must not cross nonvirtual boundaries. When placing Simscape blocks in a nonvirtual subsystem, make sure to place all blocks belonging to a given Physical Network in the same nonvirtual subsystem.

  • Nonvirtual subsystems that do not support continuous sample time blocks (such as If Action, For Iterator, Function-Call, Triggered, While Iterator, and so on) cannot contain Simscape blocks.

  • An atomic subsystem with a user-specified (noninherited) sample time cannot contain Simscape blocks.

  • Simulink configurable subsystems work with Simscape blocks only if all of the block choices have consistent port signatures.

  • When using SimState to save and restore simulations of models, you cannot make any changes to the Simscape blocks in the model between the time at which you save the SimState and the time at which you restore the simulation using the SimState.

    This is an extension of the Simulink limitation prohibiting structural changes to the model between these two points in time (see Limitations of the SimState). Changes to Simscape block parameters can cause equation changes and result in changes to the state representation. Therefore, modifying parameters of Simscape blocks between saving and restoring the SimState is not allowed.

  • Linearization with the Simulink linmod function or with equivalent Simulink Control Design™ functions and graphical interfaces is not supported with Simscape models if you use local solvers.

  • Model referencing is supported, with some restrictions:

    • All Physical connection lines must be contained within the referenced model. Such lines cannot cross the boundary of the referenced model subsystem in the referencing model.

    • The referencing model and the referenced model must use the same solver.

Unsupported Simulink Tools

Certain Simulink tools and features do not work with Simscape software:

  • The Simulink Profiler tool does not work with Simscape models.

  • Exporting a model to a format used by an earlier version (File > Export Model to > Previous Version) is not supported for models containing Simscape blocks.

  • Physical signals and physical connection lines between conserving ports are different from Simulink signals. Therefore, the Signal and Scope Manager tool and the signal label functionality are not supported.

Simulink Tools Not Compatible with Simscape Blocks

Some Simulink tools and features do not work with Simscape blocks:

  • Execution order tags do not appear on Simscape blocks.

  • Simscape blocks do not invoke user-defined callbacks.

  • You cannot set breakpoints on Simscape blocks.

  • Reusable subsystems cannot contain Simscape blocks.

  • You cannot use the Simulink Fixed-Point Tool with Simscape blocks.

  • The Report Generator reports Simscape block properties incompletely.

Code Generation

Code generation is supported for Simscape physical modeling software and its family of add-on products. However, there are restrictions on code generated from Simscape models.

  • Code reuse is not supported.

  • Encapsulated C++ code generation is not supported.

  • Tunable parameters are not supported.

  • Run-time parameter inlining ignores global exceptions.

  • Simulation of Simscape models on fixed-point processors is not supported.

  • Block diagnostics in error messages are not supported. This means that if you get an error message from simulating generated code, it does not contain a list of blocks involved.

  • Conversion of models or subsystems containing Simscape blocks to S-functions is not supported.

Code Generation describes Simscape code generation features. Restricted Simulink Tools describes limitations on model referencing.

There are variations and exceptions as well in the code generation features of the add-on products based on Simscape platform. For details, see documentation for individual add-on products.

Code Generation and Fixed-Step Solvers

Most code generation options for Simscape models require the use of fixed-step Simulink solvers. This table summarizes the available solver choices, depending on how you generate code.

Code Generation OptionSolver Choices
Accelerator mode
Rapid Accelerator mode
Variable-step or fixed-step
Simulink Coder™ software: RSim Target*Variable-step or fixed-step
Simulink Coder software: Targets other than RSimFixed-step only

* For the RSim Target, Simscape software supports only the Simulink solver module. In the model Configuration Parameters dialog box, see the Code Generation: RSim Target: Solver selection menu. The default is automatic selection, which might fail to choose the Simulink solver module.

Was this topic helpful?