Queue Block

Description

The Queue block is used for transient storage of entities. Three types of queueing policies are available for a Queue block: FIFO, LIFO, and Priority.

When a request to send (or push) an entity arrives at a Queue block, the Queue block determines whether it has room to store the entity. If its buffer is full, the Queue block rejects the request to have the entity sent to it. If space is available in its buffer, the Queue block responds that it can accept the entity.

When an entity arrives at a Queue block that uses a FIFO or LIFO queueing policy, the entity is stored at the appropriate end of the buffer. For Queue blocks that use a Priority policy, the Queue block extracts the priority value from an attribute defined for the entity and uses that value to determine where to place the entity in the buffer. The Queue block then sequentially notifies each block connected to its OutEntity port to ask whether it is ready to receive an entity. The Queue block selects an entity (based on the queueing policy—FIFO, LIFO, or Priority) to send out through the OutEntity port to the first downstream block that responds affirmatively. (Entities can also be pulled out through the Queue block’s OutEntity port by a downstream block. In this case the Queue block also selects the entity to release according to the queueing policy.)

When a Queue block’s buffer is no longer full (due to an entity leaving the Queue block or the Queue block’s capacity being increased), the Queue block attempts to pull entities from upstream through the InEntity port until it is at capacity or no entities are available to pull.

If the Queue block’s reneging option is activated (by selecting the Reneging option in the properties dialog box), then after an entity enters the Queue block, the Queue block attempts to pull a numeric value from its InRenegeWait port. If the Queue block pulls a nonnegative number from the port, it schedules a time for the entity to exit the Queue block via the OutRenege port if the entity is still in the Queue block’s buffer at that time. Otherwise no time for reneging is scheduled. If there is no connection to the OutRenege port, no reneging occurs.

Any time an entity enters or exits the Queue block, the Queue block pushes the value of its buffer’s length (the number of entities being held by the Queue block) to the OutLength port. Any time an entity exits the Queue block via its OutEntity port, the Queue block pushes a value that represents how long that entity waited in the buffer to the OutWait port.

An integer value can be pushed through the InCapacity port to set the capacity for the Queue block (the size of its buffer). Valid incoming values for this port are integers in the range of 0 to 2,147,483,647. If the capacity of a Queue block is reduced dynamically during the simulation run, any excess entities are removed from the Queue block (according to the queueing policy being used) and are sent out the OutBalk port. If there are no connections to the OutBalk port, the entities are destroyed.

Holding Block Preemption

Entities in Simulation Studio are hierarchical. That is, entities can hold other entities. The term controlling entity denotes an entity that holds other entities, and the term root entity denotes an entity that is not held by another entity. Each entity held by another entity has one root entity associated with it. The root entity for any held entity is found by traversing up the entity hierarchy from the held entity.

Entities being held by a Queue block can be preempted either by input to the block’s InPreempt port or by a scheduled resource entity event. In order for a root entity that is held by a Queue block to be preempted, the OutPreempt port (or OutBalk port) must have at least one link attached to it. Similarly, for a resource entity that is held by a controlling entity that is in turn held by the Queue block to be preempted, the OutResource port (or OutBalk port) must have at least one link connected to it.

The Queue block’s InPreempt port accepts an Entity Group object as input. (An Entity Group is a collection of references to entities.) When an Entity Group object is pushed to a Queue block’s InPreempt port, the Queue block iterates through the Entity Group collection looking for matches to root entities held by the Queue block. For any matched entity, the Queue block first tries to push that entity out its OutPreempt port. If this push is not successful, the block attempts to push the entity out the OutBalk port. If this also fails, the entity continues to be held by the Queue block until either it exits out the OutEntity port or it is preempted again.

The Queue block, like all entity holding blocks, detects potential preemptive changes (such as those scheduled by a Resource Scheduler block) to resource entities it holds (either directly or indirectly through a controlling entity).

If the number of units associated with a held resource entity decreases or the state of a held resource entity becomes nonfunctional, the Queue block attempts to preempt that resource entity. If the resource entity identified for preemption is a root entity, then the Queue block follows the same protocol for pushing an entity out its OutPreempt port that the InPreempt port uses. If the resource entity is part of a controlling entity, the Queue block removes the resource entity from the controlling entity and attempts to push the associated root entity out the OutPreempt port. The Queue block then attempts to push the preempted resource entity out its OutResource port, or if that fails, out its OutBalk port. If there is a connection to the Queue block’s OutResource port and the Queue block cannot push the resource entity out either the OutResource or OutBalk port, the resource entity is disposed.

The Queue block also provides an OutHoldings port that other blocks can use to pull an Entity Group object that contains a collection of references to entities held by the Queue block.

Fixed Ports

InEntity

Input entity port for entities to be added to the Queue block.

OutEntity

Output entity port for entities that can be accepted by a downstream block.

OutRenege

Output entity port for entities that are reneged and can be accepted by a downstream block.

OutPreempt

Output entity port for root entities that are preempted and can be accepted by a downstream block.

OutResource

Output entity port for resource entities held by controlling entities that are preempted and can be accepted by a downstream block.

OutBalk

Output entity port for entities that cannot leave using the other output entity ports.

InRenegeWait

Numeric input value port that sets the amount of time to wait before an entering entity is reneged.

InCapacity

Numeric input value port that dynamically sets the capacity of the Queue block.

InPreempt

Entity Group input port that causes the Queue block to preempt any root entities it is holding that match entities in the incoming Entity Group.

OutLength

Numeric output value port for the number of root entities held in the Queue block’s buffer.

OutWait

Numeric output value port for the amount of time an exiting entity waited in the Queue block’s buffer.

OutHoldings

Entity Group output port from which a group of entity references can be pulled, representing the entities in the Queue block’s buffer.

Properties Dialog Box Controls

Capacity

Specifies the maximum number of entities the Queue block is permitted to store in its buffer. Valid values for this field are integers in the range from 0 to 2,147,483,647. Selecting the Infinite check box supersedes any Capacity value.

Reneging

Selecting this check box activates the Queue block’s automatic reneging functionality.

Queueing Policy

Selecting a policy type in the Type list box specifies the queueing policy that is used by this Queue block in determining the order in which entities leave the Queue block. Some policies have additional parameters that can be specified when the policy is selected from the list box. The FIFO policy has no parameters and uses a first-in-first-out policy for determining the order of entities leaving the Queue block. The LIFO policy has no parameters and uses a last-in-first-out policy for determining the order of entities leaving the Queue block. The Priority policy allows entities to exit the Queue block based on entity priority. It has the following parameters:

Entity Attribute Type

Specifies the type of the attribute (Number or String) used to extract the priority value from an entity.

Default Priority Number

If Entity Attribute Type is Number, this field specifies the numeric priority value to use for an entity when the Queue block cannot extract a valid priority value from the specified Entity Attribute.

Default Priority String

If Entity Attribute Type is String, this field specifies the string priority value to use for an entity when the Queue block cannot extract a valid priority value from the specified Entity Attribute.

Entity Attribute

Specifies the name of the attribute to use when extracting the priority value from an entity.

Priority Order

Specifies whether higher values or lower values are interpreted to have a higher priority.

Tie Breaking Policy

Specifies the algorithm to use for placing entities in the Queue block’s buffer when entities have the same priority value. Algorithm options include FIFO, LIFO, and Random (for random placement).

Random Stream Seed

If the Tie Breaking Policy is Random, this field specifies the random number generator seed.

Candidates for Design of Experiments

Factors

Capacity (integer), RankValue (double), QueueingPolicy (text)
The format for specifying the value of the QueueingPolicy factor is as follows:
Type==policyType;Entity Attribute Type==attributeType;Default Priority Number==priorityNumber;Default Priority String==priorityString;Entity Attribute==attributeName;Priority Order==priorityOrder;Tie Breaking Policy==tieBreakingPolicy;Random Stream Seed==seed
where:

policyType

is FIFO, LIFO, Priority, or the fully-qualified Java class name of a queueing policy class.

attributeType

is Number or String.

priorityNumber

is a decimal number.

priorityString

is a string value.

attributeName

is the name of an entity attribute.

priorityOrder

is one of the following: Highest Value Has Highest Priority, Lowest Value Has Highest Priority.

tieBreakingPolicy

is one of the following: FIFO, LIFO, Random.

seed

is an integer number.

Each name==value parameter within the factor value is optional. If it is not specified, it is assigned the value specified in the properties dialog box if possible; otherwise it is assigned a default value.

Responses

AverageWait (double), MaximumWait (double), AverageLength (double), MaximumLength (integer), BalkCount (integer), RenegeCount (integer)