Enable a Gate for a Time Interval

Behavior of Enabled Gate Block

The Enabled Gate block uses a control signal at the input port labeled en to determine when the gate is open or closed:

  • When the en signal is positive, the gate is open and an entity can arrive as long as it would be able to advance immediately to the next block.

  • When the en signal is zero or negative, the gate is closed and no entity can arrive.

Because the en signal can remain positive for a time interval of arbitrary length, an enabled gate can remain open for a time interval of arbitrary length. The length can be zero or a positive number.

Depending on your application, the gating logic can arise from time-driven dynamics, state-driven dynamics, a SimEvents® block's statistical output signal, or a computation involving various types of signals. The en signal must be an event-based signal. To convert a time-based signal into an event-based signal, use the Timed to Event Signal block.

Control Joint Availability of Two Servers

Suppose that each entity undergoes two processes, one at a time, and that the first process does not start if the second process is still in progress for the previous entity. Assume for this example that it is preferable to model the two processes using two Single Server blocks in series rather than one Single Server block whose service time is the sum of the two individual processing times; for example, you might find a two-block solution more intuitive or you might want to access the two Single Server blocks' utilization output signals independently in another part of the model.

If you connect a queue, a server, and another server in series, then the first server can start serving a new entity while the second server is still serving the previous entity. This does not accomplish the stated goal. The model needs a gate to prevent the first server from accepting an entity too soon, that is, while the second server still holds the previous entity.

One way to implement this is to precede the first Single Server block with an Enabled Gate block that is configured so that the gate is closed when an entity is in either server. In particular, the gate

  • Is open from the beginning of the simulation until the first entity's departure from the gate

  • Closes whenever an entity advances from the gate to the first server, that is, when the gate block's #d output signal increases

  • Reopens whenever that entity departs from the second server, that is, when the second server block's #d output signal increases

This arrangement is shown below.

The Signal Latch block's st output signal becomes 0 when the block's rvc input signal increases and becomes 1 when the wvc input signal increases. That is, the st signal becomes 0 when an entity departs from the gate and becomes 1 when an entity departs from the second server. In summary, the entity at the head of the queue advances to the first Single Server block if and only if both servers are empty.

Was this topic helpful?