Full Library / Resource / Quantity-based / Resource_QS_Allocate
Block Name: Resource_QS_Allocate
- A
polymorphic quantity-shared resource for N-identical resources,
which enqueues input tokens in either a FIFO, or LIFO, order depending
on the "Queuing_Discipline" parameter attribute. This block supports
blocking and non-blocking model through the "Queueing Displine"
parameter. In non_blocking mode, the DS is released from the
queue as soon as the quantity is allocated, while the blocking mode
does not release the DS until the resources has been released at
the Resource_QS_Free block. Every incoming Data Structure
requests for certain quantity of resources. If the requested
units are available, they are immediately allocated and the Data
Structure is placed in the queue or released immediately (depending on
blocking or non-blocking). A copy/original of the Data Structure is
sent out on the 'ds_output' port. When the token on the
'ds_output' port is sent to the Resource_QS_Free block input, the units
are put back into the resource pool. The associated Data
Structure in the Queue, if blocking, is destroyed and the Data
Structure at the Resource_QS_Free input continues. If the
parameter is set to "Exit_Without_Resource_Units" and none are
available, the incoming token is sent out on the reject port.
- Unlike
the Queue blocks, no pop is required to remove the Data Structure in
the queue and place it on the output port. In the blocking mode,
the QS block delays each token until the granted quantity has been
released using the Resource_QS_Free block. Each of the N
dimensions operate as independent Queue + Server. The
'priority_input' is used to determine the order of the data tokens in
the queue.
- This block has five input ports:
- The ds_input port for the incoming data tokens, the quantity_request (must be a positive integer) port for the requested units and the dimension_input (first queue starts at 1) port for dimension of the internal server are all required for each incoming token.
- The stats_input
port to trigger the current updated statistics (-1 == reset, 0-N ==
summary statistics for the respective server, 'Number_of_Dimensions' +
1 value == summary statistics for all the servers) on the stats_output port. that identifies the resource dimension, quantity granted, priority, and starting
- The Use Model
for the Resource_QS_Allocate Block is to model resource unit requests
to a limited capacity ('Resource_Capacity'). One might model a multi
communication channel, or memory capacity with this block. If current
capacity is not available, then the token will be rejected. Once, a
number of units have been granted, then an ObjectToken is sent out the
'ds_output' port (to be processed and delayed).
- If
the user has multiple dimensions, then it is best if the enqueued data
structures contains a field with the dimension number for further
processing. Statistics are generated using the getBlockStatus("QS
Name","stats") or the ResourceStatistics block.
- Data Structure of the Statistics Output:
BLOCK = "Resource_QS_Allocate", DELTA = 0.0, DS_NAME = "Queue_Common_Stats", ID = 6, INDEX = 0, Number_Entered = 2, Number_Exited = 1, Number_Rejected = 0, Occupancy_Max = 1.0, Occupancy_Mean = 0.6666666666667, Occupancy_Min = 0.0, Occupancy_StDev = 0.471404520791, Quantity_Used_Max = 5, Quantity_Used_Mean = 3, Quantity_Used_Min = 0, Quantity_Used_StDev = 2, Queue_Number = 5, TIME = 10.0, Total_Delay_Max = 1.8087119569, Total_Delay_Mean = 1.8087119569, Total_Delay_Min = 1.8087119569, Total_Delay_StDev = 0.0, Utilization_Pct_Mean = 0.0
|
- See Also:
- QueueItem
- QS_Resource
- Resource_QS_Allocate_Priority
ds_input
public TypedIOPort ds_input
- Input
port. This is used for data tokens entering QS Queue. In
order for the data token or data structure to enter the queue properly,
the 'ds_input', 'dimension_input' and 'quantity_request' must also be
entered at the same time, else port data could be overwritten.
This port can be of any type.
quantity_request
public TypedIOPort quantity_request
- Input
port for resource units requested for the incoming token. This
numnber must be a positive integer value. This number is
dependent on the 'Resource_Capacity' parameter. If available, then
process else enqueue request. The token is rejected if
'Max_Queue_Occupancy' parameter is exceeded. In order for the
data token or data structure to enter the queue properly, the
'ds_input', 'dimension_input' and 'quantity_request' must also be
entered at the same time, else port data could be overwritten.
This is of type integer.
dimension_input
public TypedIOPort dimension_input
- Input
port for specifying the priority of data tokens entering resource.
This is the queue number and the first queue is the number 1.
In order for the data token or data structure to enter the queue
properly, the 'ds_input', 'dimension_input' and 'quantity_request' must
also be entered at the same time, else port data could be overwritten.
This is of type Integer.
stats_input
public TypedIOPort stats_input
- Input
port. that clears statistics (-1) for all dimensions, or an
individual dimensions (>= -2), or getting statistics (0 to n)
on stats_output. If 'stats_input' is '-2', then dimensions (2)
will be reset. This approach cannot reset dimensions(0),
or dimensions(1) using this method. If the 'stats_input' is '0' or
greater, then the statistics for this queue number will be obtained. If
the input value equals 'Number_of_Dimensions' parameter setting, then
the statistics for all the FCFS dimenions will be generated in one
request. The type is integer.
ds_output
public TypedIOPort ds_output
- Output
port sending processed data token (numerical) or composite data
structure (StringToken), based on Resource_QS_Free receiving the
'ds_free_output'. The ordering in the queue is based on the
'priority_input'. This takes the type of the ds_input and removes the
incoming Data Structure from the resource.
reject_output
public TypedIOPort reject_output
- Output
port sends the incoming data structure when the 'Max_Queue_Occupancy'
parameter has been exceeded. Type of incoming data structure.
stats_output
public TypedIOPort stats_output
- Output port sending FCFS Queue statistics based on the trigger at the stats_input port. The type is string.
-
Block_Name
public Parameter Block_Name
- Parameter. A unique over all other Resource and Architecture blocks in the model. The type is string.
Resource_Capacity
public Parameter Resource_Capacity
- Parameter. This specifies the number of units of resource that the block is setup with initially. The type is integer.
Number_of_Dimensions
public Parameter Number_of_Dimensions
- Parameter.
This specifies the number of resource dimensions, or resource
queues to create for this block. The type is integer.
-
Blocking_Mechanism
public StringAttribute Blocking_Mechanism
- Queue
attribute to determine the blocking mechanism. The model can either
"Wait_for_Resource", "Seize_Available_Units" or
"Exit_Without_Resource_Units". The default is "Wait_for_Resource."
Queueing_Disipline
public StringAttribute Queueing_Disipline
- QS
Queuing 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.
-
Addressing_Mode
public StringAttribute Addressing_Mode
- Queue
type attribute, either "Indexed_First_Fit," "Indexed_Best_Fit" or
"Non_Indexed" (default). "Indexed_First_Fit" looks for the first fit of
available resource IDs, which may not be the best use of the resource
IDs, yet runs faster than the "Indexed_Best_Fit" mode. For example
Indexed addresses might be used to model memory availability.
-
Max_Queue_Occupancy
public StringAttribute Max_Queue_Occupancy
- This
parameter is the maximum number of tokens or data structures that can
be in the queue at any instanceof time. All items exceeding this time
will be send to the reject_output port. The type is integer.
Created with the Personal Edition of HelpNDoc: Easily create HTML Help documents