This example shows how to model a queue whose capacity is parameterized.
In this model, the block labeled Queue Capacity produces a signal that changes during the simulation. The subsystem labeled Variable-Capacity Queue uses this signal to model varying queue capacity during simulation.
The Variable-Capacity Queue subsystem contains a FIFO Queue block that has no limit on its capacity. The preceding Enabled Gate block restricts entry to the queue as necessary. The Enabled Gate block depends on the Space Usage Control subsystem, which determines whether the queue has space for another entity.
If the capacity of the queue decreases such that the queue length exceeds the new capacity, then the queue becomes full beyond its capacity and does not flush excess entities. The queue remains in this state until either the capacity increases or enough entities depart from the queue. By comparison, the Queue with Flushing Capability example illustrates how to reduce the length of a queue immediately.