Full Library / Resource / Timed-Queue / TimedQueue_N_Priority
Block Name: TimedQueue_N_Priority

Code File Location: VisualSim/actor/lib/Resource_FCFS_N_Priority

Note:  If you have purchased the Smart_Resource package, use the Smart_Timed_Resource block and not this one.

Block Overview

  o  It is used in place of a multi-dimension queue whesn the duration between queuing and popping is known apriori.  Queues need to be reordered based on priority.  If no priority is required, use TimedQueue. 

  o  Define multiple concurrent resources with pre-defined processing time.

  o  Define multi-core processors, parallel buses, dma channels, wireless channels, wired virtual channels etc.

TimedQueue_N_Priority

Description

This TimedQueue (First-Come, First-Server) block contains multiple sets of Queue + Server Resource.  The Queue to use for a data structure is identified by an integer number in the dimension_input port.  The Queue is ordered based on the priority of the data structure.  Higher priority items will move to the front of the queue. Higher the number, higher the priority.   The Server Resource is a timed resource that delays the incoming data structure before placing it on the output port.

When the Server Resource is free, the token or Data Structure at the head of the queue is sent to the server resourcee. The server resource holds the token for the time_input period and then places it on the output port. If the queue is full, then the incoming Data Structure or token is sent to the reject_output port.  The input, time_input, priority_input and dimension_input must arrive for the transaction to be placed in the queue.

To compute the throughput through this block, multiply the utilization by the Speed used to compute the Server Resource delay. 

To illustrate the usage, look at the following Examples in the BDE.


Statistics OutputValue Explanation 

Mathematical Equation

Type
Number_Entered 100Number of transactions entering the queue.-int
Number_Exited25Number of transactions that left the queue.-int
Number_Rejected10Number of transactions rejected and output to reject port.-int
Queue_Number 1Queue Number.  Queue number start at 1.-int
Occupancy_Min4.0Minimum queue size during the simulation.
If (Xn < Xn – 1) Xmin = Xn
double
Occupancy_Mean8.0Mean/Average queue size during the simulation.
Xµ  = (1 / n) * (X1 + X2 + … + Xn)
double
Occupancy_StDev3.0Standard Deviation from the Mean queue size during the simulation.Xσ = Math.sqrt ((1 / n) * ((X1 - Xµ)2 + (X2 - Xµ)2  + … + (Xn - Xµ)2))

STDEV_90_PCT = 1.6448530004790

STDEV_95_PCT = 1.9599610823207

STDEV_99_PCT = 2.5758345145732
double
Occupancy_Max25.0Maximum queue size consumed during the simulation.
If (Xn > Xn – 1) Xmax = Xn
double
Total_Delay_Min1.3In seconds. Least time through the queue+server among all transactions.
If (Xn < Xn – 1) Xmin = Xn
double
Total_Delay_Mean1.3In seconds. Mean/Average time through the queue+server among all transactions.
Xµ  = (1 / n) * (X1 + X2 + … + Xn)
double
Total_Delay_StDev1.3In seconds. Standard Deviation from the Mean time through the queue+server among all transactions.Xσ = Math.sqrt ((1 / n) * ((X1 - Xµ)2 + (X2 - Xµ)2  + … + (Xn - Xµ)2))

STDEV_90_PCT = 1.6448530004790

STDEV_95_PCT = 1.9599610823207

STDEV_99_PCT = 2.5758345145732
double
Total_Delay_Max1.3In seconds. Maximum time through the queue+server among all transactions.
   If (Xn > Xn – 1) Xmax = Xn
double
Utilization_Pct_Mean0.0Mean/Average utilization of the server portion only.  Queue utilization not considered. Units are in percentage.
Xµ  = (1 / n) * (X1 + X2 + … + Xn)
double

Where n is the number of samples and X is occupancy or delay.


Parameter Explanation TypeExample
Number_of_DimensionsThis specifies the number of resource dimensions, or resource queues to create for this block.Integer1
Max_FCFS_LengthThis is the maximum FCFS Queue length for every resource dimensions, or resource queues. The "Max_FCFS_Length" parameter attribute is set to 30, as a default.Integer30
FCFS_TypeFCFS Queue type attribute, either "FIFO," or "LIFO." The default is "FIFO."  This is the ordering of the tokens in the queue, either First-In, First-Out or Last-In, Last-Out.-FIFO


Port Explanation
FCFS_input This is used for data tokens entering FCFS Queue.  In order for the data token or data structure to enter the queue properly, the 'FCFS_input', 'dimension_input', 'time_input' and 'priority_input' must all be entered at the same time, else port data could be overwritten. 
time_input This is used  for setting the time delay of the incoming data token (numerical) or composite data structure (StringToken). In order for the data token or data structure to enter the queue properly, the 'FCFS_input', 'dimension_input', 'time_input' and 'priority_input' must all be entered at the same time, else port data could be overwritten.
dimension_inputThis is used to enter the dimensions number of data tokens entering the queue. In order for the data token or data structure to enter the queue properly, the 'FCFS_input', 'dimension_input', 'time_input' and 'priority_input' must all be entered at the same time, else port data could be overwritten.
priority_inputThis is used for setting the priority of the incoming data token (numerical) or composite data structure (StringToken). In order for the data token or data structure to enter the queue properly, the 'FCFS_input', 'dimension_input', 'time_input' and 'priority_input' must all be entered at the same time, else port data could be overwritten.
stats_inputThe stats_output outputs the statistics, when the stats_input receives a request. If the stats_input request is a server number, then the current statistics for that server is placed on the stats_output. If the input is the negative of a server number, then statistics for the Server are reset. If the {Number_of_Dimensions + 1} is sent in, then the statistics for all the servers are sent to the stats_output. Similarly, if the negative of the {Number_of_Dimensions + 1} is sent, the statistics are reset for all the Servers.
FCFS_outputOutput port sending front FCFS data token (numerical) or composite data structure (StringToken) after a delay at the front of the queue based on 'time_input'.  The ordering in the queue is based on the 'priority_input'. Output is dependent on the simulation time and 'time_input'.  The takes the type of the FCFS_input.
FCFS_length_outputOutput port sending the length of the FCFS Queue.  This is generated everytime a Data Structure exits the block or departs on the output port.
FCFS_reject_outputOutput port rejecting input FCFS Queue token when FCFS Queue is full, based on "FCFS_input". The type is based on the input token.
stats_outputOutput port sending FCFS Queue statistics based on the trigger at the stats_input port. The type is data structure for the single server and is array of data structures for all server statistics.