Resource
A Resource represents a number of common units that can be allocated to entities. A resource has an initial capacity that can be changed during a replication.
A resource is busy if at least 1 unit has been allocated. A resource becomes busy when it has allocations. If a seize-request occurs and the resource has capacity to fill it completely, then the request is allocated the requested amount. If insufficient capacity is available at the time of the request, then the request waits until the requested units can be allocated.
If b(t) is the number of units allocated at time t, and c(t) is the current capacity of the resource, then the number of available units, a(t), is defined as a(t) = c(t) - b(t). Thus, a resource is idle if a(t) = c(t). Since a resource is busy if b(t) 0, busy and idle are complements of each other. A resource is either busy b(t) 0 or idle b(t) = 0. If a(t) 0, then the resource has units that can be allocated.
The utilization of a resource is defined as the ratio of the average number of busy units to the average number of active units. Units are active if they are part of the current capacity of the resource.
Subclasses of Resource implement additional state behavior.
Parameters
the parent holding this resource
the name of the resource
the initial capacity of the resource. Cannot be changed during a replication. The default capacity is 1.
Inheritors
Types
Properties
Access to the busy state. Busy means at least 1 unit of the resource is allocated.
The default rule is IGNORE. This can be changed via the useSchedule() function or when there is no schedule being used. The rule cannot be changed when there are pending capacity changes.
Returns the default reporting option. True means that the response should appear on the default reports
If a(t) is greater than zero
If b(t) is greater than zero
Access to the idle state. Idle means that no units of the resource are allocated.
Access to the inactive state. Inactive means that the capacity of the resource is 0
The initial capacity of the resource at the start of the replication. The initial capacity must be greater than 0.
The initial request queue notification rule for controlling the order in which queues are notified for processing requests after a capacity change.
If b(t) is the number of busy units, and c(t) is the current capacity, then the instantaneous utilization iu(t) is
Checks to see if the resource is inactive
Indicates whether capacity changes are pending. The resource cannot allocate units when capacity changes are pending because released busy units will be used to fill the capacity change.
If c(t) is the current capacity and b(t) is the current number busy, then a(t) = c(t) - b(t) is the current number of available units. Under some capacity change situations, a(t) may be negative.
Statistical response representing the number of busy units of the resource.
The number of times that the resource has been released (deallocated)
The number of times that the resource has been seized (allocated)
The last (previous) state before the current state.
Changing this during a replication will only affect the current replication. The rule will be reset to the initial setting at the beginning of each replication.
Statistical response representing the utilization of the resource. This is the time average number of busy units divided by the time average capacity.
The number of times the resource was seized
A general attribute that can be used to assist with selecting resources
Time when state time accumulation started. May be greater than 0 because of warmup.
The current state of the resource.
Indicates if proportion of time spent in states (idle, busy, inactive) is automatically reported
time average instantaneous utilization
Total time that the resource has been idle, busy, or inactive
Functions
Add an allocation listener. Allocation listeners are notified when (after) units are allocated to an entity and after units are deallocated.
It is an error to attempt to allocate resource units to an entity if there are insufficient units available. Thus, the amount requested must be less than or equal to the number of units available at the time of this call.
A resource may fill a request in many ways. This function indicates if the request for the amount needed can be allocated immediately, without any wait based on the current state of the resource. Since the underlying state of the resource may be more complex than indicated by the state exposed in the API, it is important to use this method to determine if the requested amount can be allocated.
It is an error to try to change the capacity directly via this method if the resource is using a capacity change schedule.
Causes the resource to deallocate the amount associated with the allocation
Checks if the entity is using (has allocated units) of the resource.
Computes the number of different allocations of the resource held by the entity. Recall that allocations can be for different amounts.
Resources can be associated with a capacity change schedule. If a capacity change occurs, especially a decrease that makes the resource inactive or an increase that allows the resource to be available occurs, then queues that hold requests for the resource may want to be notified of the capacity change.
Removes the listener
If the resource is using a schedule, the resource stops listening for capacity changes and is no longer using a schedule. The current capacity will be used for the remainder of the replication.
Computes the total number of units of the specified resource that are allocated to the entity.
This function permits a queue to be unregistered from a resource. If the queue was not registered, then nothing occurs.
Tells the resource to listen and react to capacity changes in the supplied Schedule. The model cannot be running when changing the schedule.