Main Content

Examine Model Dynamics Using Solver Profiler

When model simulation slows down or stops responding, a close examination of the dynamics of the model can help you identify the factors affecting the simulation.

Understanding solver behavior enables you to interpret how the model simulates and what causes the solver to take small steps.

The Solver Profiler analyzes a model for patterns that affect its simulation. The Solver Profiler presents graphical and statistical information about the simulation, solver settings, events, and errors. You can use this data to identify locations in the model that caused simulation bottlenecks.

In addition, there are multiple factors that can limit the simulation speed. The Solver Profiler logs and reports all the major events that occur when simulating a model:

  • Zero-crossing events

  • Solver exception events

  • Solver reset events

  • Jacobian computation events

Note

In order to accurately profile the solver performance, the Solver Profiler may temporarily modify some logging settings of your model. Your settings will be restored after profiling has been completed.

These events are common and necessary for an accurate simulation. However, they do incur computational cost and frequent occurrences can slow down or even stall the simulation.

To examine model dynamics and identify causes that affect the simulation:

  1. Open the model that is simulating slowly or unsuccessfully. For example, open the BouncingBallWithSwitch model.

  2. Open the Solver Profiler by clicking the hyperlink in the lower-right corner of the Simulink® Editor.

  3. The Solver Profiler provides smart logging and diagnostics of continuous model states and Simscape™ states. To enable this, select the Continuous States, Zero Crossing or Simscape States option before a run. Disable these options only if you are running out of memory. After the run, access the States Explorer, Zero Crossing Explorer, or Simscape Explorer to examine those states.

  4. Click Run. The profiler simulates the model and starts capturing solver performance data.

    When the simulation ends, the profiler displays the statistics and exceptions it captured over the duration of the simulation.

    Tip

    You can pause or stop the simulation at any time to view the information captured until that point.

  5. Use the profiler plot to highlight the parts of the model that caused generate the most events.

  6. Click Save to capture your profiling session, or exit without saving.

See Also

| | |