Working with Discrete Event Subsystem Blocks

For discrete event subsystems that respond to entity departures rather than signal-based events, see Creating Entity-Departure Subsystems.

Setting Up Signal-Based Discrete Event Subsystems

Building on the conceptual information in Role of Discrete Event Subsystems in SimEvents® Models, this section provides some practical information to help you incorporate Discrete Event Subsystem blocks into your SimEvents® models.

To create discrete event subsystems that respond to signal-based events, follow the procedure below using blocks in the SimEvents Ports and Subsystems library.

  1. Drag the Discrete Event Subsystem block from the SimEvents Ports and Subsystems library into your model. Initially, it shows one signal input port Din and one signal output port Dout. Note that these are signal ports, not entity ports, because the subsystem is designed to process signals rather than entities. Furthermore, the signal input ports carry only signals of data type double.

  2. In the model window, double-click the Discrete Event Subsystem block to open the subsystem it represents. Initially, the subsystem contains an inport block connected to an outport block. Note that these are Discrete Event Inport and Discrete Event Outport blocks, which are not the same as the Inport and Outport blocks in the Simulink® Ports & Subsystems library. The subsystem also contains a Subsystem Configuration block, which you should not delete.

  3. A discrete event subsystem must have at least one input that determines when the subsystem executes. To change the number of inputs or outputs to the subsystem, change the number of inport and outport blocks in the subsystem window:

  4. Drag other blocks into the subsystem window as appropriate to build the subsystem. This step is similar to the process of building the top level of your model, except that only certain types of blocks are suitable for use inside the subsystem. See Blocks Inside Discrete Event Subsystems for details.

  5. Configure each of the Discrete Event Inport blocks to indicate when the subsystem should be executed. Each inport block independently determines criteria for executing the subsystem:

Signal-Based Events That Control Discrete Event Subsystems

Blocks in a Discrete Event Subsystem operate in response to signal-based events. Using the dialog box of one or more of the Discrete Event Inport blocks inside the subsystem, you configure the subsystem so that it executes in response to particular types of events. The table indicates the types of events and corresponding values of the Type of signal-based event parameter of the Discrete Event Inport block.

EventValue of Type of signal-based event Parameter
An update (sample time hit) in a real or complex input signal, even if the updated value is the same as the previous value.Sample time hit
A change in the value of a real input signal.If the signal is a nonscalar array, then the subsystem executes once if any of the positions in the array has a change in value of the kind you specify (Rising, Falling, or Either). For example, a rising value change from [1 2 3] to [1 5 6] calls the subsystem once, not twice.Change in signal
A rising edge or falling edge in a real input signal known as a trigger signal. If the signal is a nonscalar array, then the subsystem executes once if any of the positions in the array has an edge of the kind you specify (Rising, Falling, or Either).Trigger

When the Subsystem Executes Multiple Times

Each Discrete Event Inport block can potentially execute the subsystem at most once per sample time hit, regardless of whether the signal is scalar or nonscalar. Distinct Discrete Event Inport blocks can execute the subsystem independently of each other.

For example, in the next schematic, suppose Din is a vector of length 2 that the application updates three times at T=1, and Din1 is a scalar that the application updates four times at T=1. Din causes the subsystem to execute three times, and Din1 independently causes the subsystem to execute four times. As a result, the subsystem executes a total of seven times at T=1.

Comparison of Event Types for Discrete Event Subsystems

Here are some points to keep in mind when deciding which type of signal-based event should call your discrete event subsystem:

For more information about signal-based events, see Types of Supported Events.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS