Add Gating Logic Using Combinations of Gates

Effect of Combining Gates

You can use multiple gate blocks in combination with each other:

  • Using a Release Gate block and/or one or more Enabled Gate blocks in series is equivalent to a logical AND of their gate-opening criteria. For an entity to pass through the gates, they must all be open at the same time. The next figure shows a logical AND of two conditions.

      Note:   Do not connect two Release Gate blocks in series. No entities would ever pass through such a series of gates because each gate closes before the other gate opens, even if the gate-opening events occur at the same value of the simulation clock.

  • Using multiple gate blocks in parallel, you can implement a logical OR of their gate-opening criteria. Use the Output Switch and Path Combiner blocks as in the figure below and set the Output Switch block's Switching criterion parameter to First port that is not blocked.

    Each entity attempts to arrive at the first gate; if it is closed, the entity attempts to arrive at the second gate, and so on. If all gates are closed, then the Output Switch block's entity input port is unavailable and the entity must stay in a preceding block (such as a queue or server preceding the switch).

      Note:   The figure above uses two Release Gate blocks and one Enabled Gate block, but you can use whatever combination is suitable for the logic of your application and whatever sequence you prefer. Also, the figure above omits the control signals (vc and en) for visual clarity but in your model these ports must be connected.

The Enabled Gate and Release Gate blocks open and close their gates in response to updates in their input signals. If you expect input signals for different gate blocks to experience simultaneous updates, then consider the sequence in which the application resolves the simultaneous updates. For example, if you connect an Enabled Gate block to a Release Gate block in series and the enabled gate closes at the same time that the release gate opens, then the sequence matters. If the gate-closing event is processed first, then a pending entity cannot pass through the gates at that time; if the gate-opening event is processed first, then a pending entity can pass through the gates before the gate-closing event is processed. To control the sequence, select the Resolve simultaneous signal updates according to event priority parameters in the gate blocks and specify appropriate Event priority parameters. For details, see Simultaneous Events and Assign Event Priorities.

Treat First Entity as Special Case

This example (open modelmodel) illustrates the use of a Release Gate block and an Enabled Gate block connected in parallel. The Release Gate block permits the arrival of the first entity of the simulation, which receives special treatment, while the Enabled Gate block permits entity arrivals during the rest of the simulation. In this example, a warmup period at the beginning of the simulation precedes normal processing.

The Release Gate block is open precisely when the #d output signal from the Time-Based Entity Generator block rises from 0 to 1. That is, the gate is open for the first entity of the simulation and no other entities. The first entity arrives at an Infinite Server block, which represents the warmup period.

Subsequent entities find the Release Gate block's entity input port unavailable, so they attempt to arrive at the Enabled Gate block. The Enabled Gate block is open during the entire simulation, except when the first entity has not yet departed from the Infinite Server block. This logic is necessary to prevent the second entity from jumping ahead of the first entity before the warmup period is over.

The Path Combiner block merges the two entity paths, removing the distinction between them. Subsequent processing depends on your application; this model merely uses a queue-server pair as an example.

The plot below shows which path each entity takes during the simulation. The plot shows that the first entity advances from the first (Path=1) entity output port of the Output Switch block to the Release Gate block, while subsequent entities advance from the second (Path=2) entity output port of the Output Switch block to the Enabled Gate block.

Was this topic helpful?