Depending on your configuration, you can use both variable-step and fixed-step solvers with discrete-event systems. To choose solver settings for your model, navigate to the Solver pane of the model Configuration Parameters dialog box.
When choosing a solver type for your model, use the following guidelines:
If your model contains only event-based computation
and excludes continuous and discrete time-based computation, choose
the variable-step, discrete solver. In this case, if you select a
variable-step continuous solver, the software detects that your model
does not contain any blocks with continuous states (Simulink® blocks)
and automatically switches the solver to
continuous states). When the software makes this change,
it notifies you with a message in the MATLAB® command
If your discrete-event system is within a Simulink model that also contains time-based modeling, choose either a variable-step or fixed-step solver, depending on your simulation requirements. For each solver type, the following sections describe the behavior of discrete-event systems when contained within such models.
If your discrete-event system is within a Simulink model that contains time-based modeling, and you choose a variable-step solver for the model, the Simulink solver has a major time step each time the discrete-event system needs to process events.
In addition, the SimEvents® configuration
parameter Prevent duplicate events on multiport blocks and
branched signals affects the solver behavior. This parameter
is introduced in R2012a. You can select the parameter once you use
seupdate function to migrate your model to
the latest version of the software, For more information, see:
Depending on whether or not you select this configuration parameter in your model, there is a fundamental difference in how SimEvents uses Timed to Event Signal gateway blocks to convert time-based signals to event-based signals:
If you do not select the configuration parameter, each Timed to Event Signal gateway block within the discrete-event system produces events based on the sample-time hits of the incoming time-based signal. In this scenario, the Simulink sample time diagnostic parameter Single task rate transition might generate a warning or error in your simulation, depending on the value you choose. For more information, see Diagnostics Pane: Sample Time in the Simulink documentation.
If you select the configuration parameter, each gateway
block produces a new event upon every major time step of the variable-step
solver and not based on the sample rate of the
incoming time-based signal. Because of this behavior, if you connect
a time-based signal via a gateway block to a SimEvents block configured to sense
a sample rate at its
ts port, the software
identifies the connection as invalid and produces an error. For more
information see Invalid Connections of Gateway Blocks. In this scenario,
your simulation is not subject to the Simulink sample time diagnostic
parameter, Single task rate transition.
The following graphic illustrates the behavior of the variable-step solver when used with a discrete-event system contained within a Simulink model.
If you have a discrete-event system within a Simulink model that includes time-based modeling, you can choose a fixed-step solver for the model only if you also select the SimEvents configuration parameter Prevent duplicate events on multiport blocks and branched signals. If you do not select this configuration parameter, choosing a fixed-step solver causes an error in the simulation.
When you use a fixed-step solver, the simulation still executes events in the discrete-event system at the times at which they occur. However, these events do not cause the Simulink solver to have sample hits at those times. The software insulates the discrete-event system from the time-based portions of the Simulink model in this way by treating gateway blocks in a special manner:
At Timed to Event Signal gateway blocks, for each major time step of the Simulink solver, the software produces a discrete event by sampling a fresh value at the gateway block. Any time-based signal that connects to a gateway block, and has a sample time that is different to the base rate of the Simulink model, is subject to Simulink rate transition diagnostics.
At Event to Timed Signal gateway blocks, the software converts event-based signals back to time-based signals at only the major time steps of the Simulink solver. This behavior means that there might be a delay between the time at which an event occurs in the discrete-event system and the time at which the time-based portion of the Simulink model observes this event.
The following graphic illustrates the behavior of the fixed-step solver when used with a discrete-event system.