Documentation

Simulating an Electronic System

Selecting a Solver

Simscape™ Electronics™ software supports all of the continuous-time solvers that Simscape supports. For more information, see Setting Up Solvers for Physical Models (Simscape).

You can select any of the supported solvers for running a Simscape Electronics simulation. The variable-step solvers, ode23t and ode15s, are recommended for most applications because they run faster and work better for systems with a range of both fast and slow dynamics. The ode23t solver is closest to the solver that SPICE traditionally uses.

To use Simulink® Coder™ software to generate standalone C or C++ code from your model, you must use the ode14x solver. For more information about code generation, see Code Generation (Simscape).

Specifying Simulation Accuracy/Speed Tradeoff

To trade off accuracy and simulation time, adjust one or more of the following parameters:

  • Relative tolerance (in the Configuration Parameters dialog box)

  • Absolute tolerance (in the Configuration Parameters dialog box)

  • Max step size (in the Configuration Parameters dialog box)

  • Consistency Tolerance (in the Solver Configuration block dialog box)

In most cases, the default tolerance values produce accurate results without sacrificing unnecessary simulation time. The parameter value that is most likely to be inappropriate for your simulation is Max step size, because the default value, auto, depends on the simulation start and stop times rather than on the amount by which the signals are changing during the simulation. If you are concerned about the solver missing significant behavior, change the parameter to prevent the solver from taking too large a step.

The Simulink documentation describes the following parameters in more detail and provides tips on how to adjust them:

The Solver Configuration block reference page in the Simscape documentation explains when to adjust the Consistency Tolerance parameter value.

Avoiding Simulation Issues

If you experience a simulation issue, first read Troubleshooting Simulation Errors (Simscape) to learn about general troubleshooting techniques.

Note

Simscape Electronics software does not have the ability to model large circuits with dozens of analog components. If you encounter convergence issues when trying to simulate a model with more than a few tens of transistors, you may find that the limitations of Simscape Electronics software prevent you from achieving convergence with any set of simulation parameter values.

There are a few techniques you can apply to any Simscape Electronics model to overcome simulation issues:

  • Add parasitic capacitors and/or resistors (specifically, junction capacitance and ohmic resistance) to the circuit to avoid numerical issues. The Astable Oscillator example uses these devices.

  • Adjust the current and voltage sources so they start at zero and ramp up to their final values rather than starting at nonzero values.

Modeling Instantaneous Events and Using Simulink Blocks to Model Physical Components describe how to avoid simulation errors in the presence of specific Simscape Electronics model configurations.

Running a Time-Domain Simulation

When you run a time-domain simulation, Simscape Electronics software uses the Simscape solver to analyze the physical system in the Simulink environment. For more information, see How Simscape Simulation Works (Simscape).

Running a Small-Signal Frequency-Domain Analysis

You can perform small-signal analysis for Simscape and Simscape Electronics models using linearization capabilities of Simulink software. For more information, see Linearize an Electronic Circuit (Simscape).

Was this topic helpful?