주요 콘텐츠

Enable minimal zero-crossing impact integration

Option to reduce the effect of zero crossings on continuous state integration

Model Configuration Pane: Solver

Description

The Enable minimal zero-crossing impact integration configuration parameter specifies how the software decides whether to reset the solver for each zero crossing detected in simulation. By default, the software resets the solver for every detected zero crossing. When you enable this parameter, the software resets the solver only if the zero crossing affects the value of one or more continuous states in the model.

In some cases, enabling this parameter can improve simulation performance by reducing the number of solver resets. After a reset, the solver might take smaller steps than necessary to satisfy specified tolerance values. In addition to removing the overhead of solver resets themselves, reducing the number of solver resets can reduce the number of time steps in the simulation.

Enabling this parameter might not have an effect for some models. This parameter has an effect only if:

  • Zero-crossing detection is enabled.

  • The simulation uses a variable-step solver.

This parameter does not affect the number of solver resets due to zero crossings if:

  • The model references one or more referenced models configured to use a local solver.

  • All zero-crossing signals affect at least one continuous state in the model.

Dependencies

To enable this parameter, set the solver Type to Variable-step.

Settings

off (default) | on
off

The solver does not try to reduce the number of solver resets that occur due to zero-crossing detection.

on

The solver tries to reduce the number of solver resets that occur due to zero-crossing detection.

Tips

To determine whether the software is able to reduce the number of solver resets due to zero-crossing detection, check the value of the CompiledMinimalZcImpactIntegration parameter after compiling the model for simulation. (since R2025b)

  • "on" — The software reduces the number of solver resets that occur due to zero-crossing detection.

  • "off" — The software is unable to reduce the number of solver resets that occur due to zero-crossing detection.

To compile a model for simulation without running the simulation, initialize a simulation using the Simulation object. For example, this code:

  1. Creates a Simulation object for a model named MyModel.

  2. Compiles the model for simulation by initializing a simulation using the Simulation object.

  3. Gets the value of the CompiledMinimalZcImpactIntegration parameter.

  4. Stops the simulation.

mdl = "MyModel";
sm = simulation(mdl);
initialize(sm)
f = get_param(mdl,"CompiledMinimalZcImpactIntegration");
stop(sm)

Programmatic Use

Parameter: MinimalZcImpactIntegration
Type: string | character vector
Values: "on" | "off"
Default: "off"

Version History

Introduced in R2018a