When you use an explicit solver, the simulation may become unstable because the system is stiff. For more information, see Explicit Versus Implicit Continuous Solvers. In most models, the instability can be removed by changing the block parameter values to reduce system stiffness. The Stiffness Impact Analysis tool lets you analyze the Simscape™ networks in the model and determine which of the variables and equations have the most impact on system stiffness. You can then modify the values of parameters involved in these equations to make the system less stiff.
For example, consider a model where a resistor and capacitor are connected in series with a DC voltage source, as shown.
To access the Stiffness Impact Analysis tool, open the Solver Profiler by clicking the hyperlink in the lower-right corner of the model window.
Select the Simscape Stiffness check box in the Solver Profiler toolstrip and click Run.
The Simscape Stiffness tab in the bottom pane shows that the variable
with the most impact on the system stiffness is
i(Current) in the
Resistor block, and the corresponding Eigenvalue is
-1.00000e+15. The larger is the negative Eigenvalue, the stiffer is the
If you look at the source code of the Resistor block, this variable is used in the equation
v == R*i;
and the parameter involved in this equation is
Resistance. Therefore, you can modify the value of
to reduce the system stiffness. For example, if you set Resistance to
1e-6 Ohm and rerun the simulation using the Stiffness Impact Analysis
tool, the corresponding Eigenvalue drops to
-1.00000e+09. This reduction
may be sufficient to let your model run successfully.
The Stiffness Impact Analysis tool has the following limitations:
Stiffness analysis is performed at initialization time only.
The tool performs stiffness analysis of the Simscape networks only. If a model does not contain Simscape blocks, the tool does not show any results.
The tool does not produce results and issues a warning if the system is algebraic, high-index, uses frequency-and-time equation formulation, or contains Simscape Multibody™ blocks.