MovableResourcePool

open class MovableResourcePool(parent: ModelElement, movableResources: List<MovableResource>, defaultVelocity: RVariableIfc, name: String? = null) : AbstractResourcePool<MovableResource> , VelocityIfc(source)

A MovableResourcePool represents a list of movable resources from which resources can be selected to fill requests made by Entities.

Resources are selected according to a ResourceSelectionRule. The assumption is that any of the resources within the pool may be used to fill the request.

If no selection rule is supplied the pool selects a list of resources that can fully satisfy the request. The default allocation rule is to allocate the movable resource that is closest to the entity.

If no default rules are supplied, the first available movable resource is selected based on the order of the resources supplied.

Author

rossetti

Parameters

parent

the parent model element

movableResources

a list of resources to be included in the pool

defaultVelocity

the default velocity fore all resources to use.

name

the name of the pool

Inheritors

Constructors

Link copied to clipboard
constructor(parent: ModelElement, movableResources: List<MovableResource>, defaultVelocity: RVariableIfc, name: String? = null)

Properties

Functions

Link copied to clipboard
override fun addResource(resource: MovableResource)

Adds a movable resource to the pool. The model must not be running when adding a resource.

Link copied to clipboard
fun allocate(entity: ProcessModel.Entity, requestLocation: LocationIfc, queue: RequestQ, resourceSelectionRule: MovableResourceSelectionRuleIfc, resourceAllocationRule: MovableResourceAllocationRuleIfc, allocationName: String? = null): Allocation

It is an error to attempt to allocate a movable resource unit to an entity if there are insufficient units available at the time of allocation.

Link copied to clipboard

For use, before calling allocate()

Link copied to clipboard
fun deallocate(allocation: Allocation)
Link copied to clipboard
protected open override fun initialize()

This method should be overridden by subclasses that need actions performed to initialize prior to a replication. It is called once before each replication occurs if the model element wants initialization. It is called after beforeReplication() is called

Link copied to clipboard
protected open fun selectMovableResourceForAllocation(requestLocation: LocationIfc, resourceAllocationRule: MovableResourceAllocationRuleIfc, resourceList: MutableList<MovableResource>): MovableResource
Link copied to clipboard

Uses the pool's resource selection rule to select resources from those that are available that have enough units available to satisfy the request in full. If there are insufficient resources in the pool to satisfy the full amount, then the returned list will be empty. In general, the returned list may have more units available than the requested amount.