This model demonstrates the reneging feature of a Queue block along with the use of the Modifier, Extractor, and Gate blocks. Two very different applications of the Extractor block are depicted in this example. A special feature of the Number Holder block is also illustrated here.
This example models a queueing system in which customers arrive randomly over time with one server to process customers. Individual customers wait in the queue for service on a first-in-first-out basis.
After waiting 5 minutes in the queue, a customer reneges (that is, leaves the queue and the system) if the amount of time that customer requires for service is greater than 3.5. The goal is to estimate the average time between customers who renege.
Figure E.7: Reneging Example
The arrival of customers is modeled by using an Entity Generator block with a Numeric Source block attached to its InterArrivalTime port. In the Numeric Source block, an exponential distribution with a mean of 5 is specified.
After entities are generated, they are sent to a Modifier block where an attribute called servicetime is assigned. The servicetime for each entity is sampled from an exponential distribution with a mean of 4.651. (The Extractor block immediately following the first Modifier block is used only to verify that the value is set in the Modifier block; it serves no other purpose in this model.)
Next the entities are sent to the Queue block (FIFO policy). As each entity enters the queue, a renege time is computed and assigned using a Formula block. Figure E.8 shows the properties dialog box for the Formula block connected to the Queue block. In the Formula block, the servicetime attribute for the entity is compared to the value 3.5. If the servicetime is greater than 3.5, then a renege time of 5 is returned. Otherwise, a very large renege time (specifically, 5,000,000) is returned. For those entities with a servicetime of 3.5 or less, their renege time is set sufficiently large to ensure that they wait until they can be serviced and do not leave the queue. Note that the reneging option in the Queue block properties dialog box must be selected for reneging to be used by the queue.
Figure E.8: Renege Time Formula Dialog Box
Entities that do not renege are processed in the Server block. The InServiceTime port of the Server block is connected to an Extractor block. When an entity arrives at the Server block, the Server block passes the entity to the Extractor block. The Extractor block extracts the servicetime attribute from the entity and passes the value to the Server block for use as the server processing time. Note that use of the Extractor block here does not require connections to its InEntity or OutEntity ports.
Entities that renege from the Queue block are sent out its OutRenege port, and the time at which they renege is stored in the entity by using a Modifier block. In this Modifier block the entity attribute renegetime is assigned the value Time Now. The entity is then sent to a Count block to determine whether it is the first entity to renege. The value of Count is passed to a Switch block. If the entity is the first entity to renege, the Switch block returns a value of 1 and the entity is sent to an Extractor block where the renegetime attribute value is extracted and passed into the Number Holder block labeled Last Renege Time.
If the entity is not the first entity to renege, it is sent to a Gate block, and a Formula block computes the time between reneging entities by subtracting the previous entity’s renegetime from the current entity’s renegetime. The renegetime for the previous entity is stored in the Number Holder block labeled LastRenegeTime. In order for this computation to work, the From Upstream option in the LastRenegeTime Number Holder block properties dialog box must be cleared, as shown in Figure E.9. If the From Upstream option is selected, then the Number Holder block pulls a value from upstream, which in this case means it pulls the value from the Extractor block. If this happens, the value of the previous entity’s renegetime is replaced with the current entity’s renegetime, resulting in a value of zero for the time between reneging customers.
Figure E.9: LastRenegeTime Number Holder Dialog Box
After the time between reneging entities is computed, the value is passed from the Gate block to the Number Holder block labeled AvgTimeBetweenRenegingEntities. The entity is then sent to the Extractor block. The renegetime attribute for the entity is extracted and sent to the Number Holder block LastRenegeTime, to be used when the next entity reneges from the system. The entity is then destroyed.