Entity Queue

Enqueue entities

  • Library:
  • SimEvents

Description

The Entity Queue block stores entities in a queue, based on the order of arrival or priority. The entity at the head of the queue departs when the downstream block is ready to accept it.

To customize actions when entities enter, exit, or are blocked, enter MATLAB® code in the Entry action, Exit action, or Blocked action field of the Event actions tab. For an example, see Manage Entities Using Event Actions.

Ports

Input

expand all

Input entity that carries scalar, bus, or vector data to enter the queue.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | Boolean | enumerated | bus | string

Output

expand all

Output port that allows entities at the head of the queue to depart when a downstream block is ready to accept it.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | Boolean | enumerated | bus | string

Number of entities that have departed the block.

Dependencies

To enable this port, click the Statistics tab and select the box labeled Number of entities departed, d.

Data Types: double

Number of entities that have not yet departed the block.

Dependencies

To enable this port, click the Statistics tab and select the box labeled Number of entities in block, n.

Data Types: double

Average wait time for entities in the block.

Dependencies

To enable this port, click on the Statistics tab and select the box labeled Average wait, w.

Data Types: double

Port_l outputs the average length of the entity queue.

Dependencies

To enable this port, click the Statistics tab and select the box labeled Average queue length, l.

Data Types: double

Number of entities that are pulled out of this block.

Dependencies

To enable this port, click the Statistics tab and select the box labeled Number of entities extracted, ex.

Data Types: double

Parameters

expand all

Specify the capacity of the queue.

Programmatic Use

Block Parameter: Capacity
Type: character vector
Values: '25' | scalar
Default: '25'

Choose the queue type.

  • FIFO — first-in-first-out

  • LIFO — last-in-first-out

  • Priority — store the entities in order of priority, see Sort by Priority

Programmatic Use

Block Parameter: QueueType
Type: character vector
Values: 'FIFO' | 'LIFO' | 'Priority'
Default: 'FIFO'

Specify the tag when accepting entities broadcast via multicast sources.

Dependencies

This parameter is visible when you set Entity arrival source to Multicast.

Programmatic Use

Block Parameter: MulticastTag
Type: character vector
Values: 'A' | character vector
Default: 'A'

Specify which attribute of the entity determines its priority.

Dependencies

This parameter is visible when you set Queue type to Priority.

Programmatic Use

Block Parameter: PrioritySource
Type: character vector
Values: 'PriorityAttribute' | character vector
Default: 'PriorityAttribute'

Choose the direction of sorting entities based on priority.

  • Ascending — Entities with smaller key values appear in front of the queue.

  • Descending — Entities with greater key values appear in front of the queue.

Dependencies

This parameter is visible when you set Queue type to Priority.

Programmatic Use

Block Parameter: SortingDirection
Type: character vector
Values: 'Ascending' | 'Descending'
Default: 'Ascending'

Choose the source of arrival for the entities.

  • Input port — Input port is source of entities.

  • MulticastMulticast Sender block is source of entities.

Dependencies

This parameter is visible when you set Queue type to Priority.

Programmatic Use

Block Parameter: EntityArrivalSource
Type: character vector
Values: 'Input port' | 'Multicast'
Default: 'Input port'

Specify the behavior of the entity in certain events. Define the behavior in the Event action parameter. The Entry and the Exit actions are called just after the entity entry and just before entity exit. The Blocked action is called after an entity is blocked.

Programmatic Use

Block Parameter: EntryAction, ExitAction, BlockedAction
Type: character vector
Values: MATLAB code
Default: ''

Number of entities that have departed the block.

Programmatic Use

Block Parameter: NumberEntitiesDeparted
Type: character vector
Values: 'on' | 'off'
Default: 'off'

Number of entities present in the block, but which are yet to depart.

Programmatic Use

Block Parameter: NumberEntitiesInBlock
Type: character vector
Values: 'on' | 'off'
Default: 'off'

Sum of the wait times for entities departing the block divided by their total number. Wait time is the duration between the Entity Queue block entry and exit of an entity. For more information, see Interpret SimEvents Models Using Statistical Analysis.

Programmatic Use

Block Parameter: AverageWait
Type: character vector
Values: 'on' | 'off'
Default: 'off'

Accumulated time-weighted average queue size. The block computes this value by:

  1. Multiplying the size of the queue by its duration to calculate time-weighted queue size

  2. Summing up all time-weighted queue sizes and averaging them over total time

For more information, see Interpret SimEvents Models Using Statistical Analysis.

Programmatic Use

Block Parameter: AverageQueueLength
Type: character vector
Values: 'on' | 'off'
Default: 'off'

Outputs the number of extracted entities which are pulled out from this block by the Entity Find block. If the extracted entity is the first entity in the queue, the next entity is set as the pending entity to leave the block. If an entity attribute defines the priority in a priority queue and it is modified by the Entity Find block, the queue is sorted again. When an entity is extracted, Number of entities departed, d, Number of entities in block, n, Average wait, w, and Average queue length, l statistics are updated accordingly. For more information about finding and extracting entities, see Find and Extract Entities in SimEvents Models.

Programmatic Use

Block Parameter: NumEntitiesExtracted
Type: character vector
Values: 'on' | 'off'
Default: 'off'

Model Examples

Introduced in R2016a