SResourcePool

class SResourcePool(parent: ModelElement, capacity: Int = 1, name: String? = null) : ModelElement, SResourcePoolCIfc(source)

A pool of interchangeable resource units shared by one or more ResourcePoolStations. Stations seize and release units from the common pool, so a freed unit can serve whichever station's queue is waiting. When a unit is released, the pool notifies its registered stations (in registration order) so they can serve their queues.

Phase-2 pools provide shared capacity only; per-pool schedules and failures are a later addition (a single station's own resource supports those via SingleQStation).

Parameters

parent

the model element serving as the pool's parent

capacity

the number of units in the pool (>= 1)

name

the name of the pool

Constructors

Link copied to clipboard
constructor(parent: ModelElement, capacity: Int = 1, name: String? = null)

Properties

Link copied to clipboard
open override val capacity: Int

The pool's current capacity (total units).

Link copied to clipboard
open override val hasAvailableUnits: Boolean

True if the pool has at least one available unit.

Link copied to clipboard
@set:KSLControl(controlType = ControlType.INTEGER, lowerBound = 1.0)
var initialCapacity: Int
Link copied to clipboard
open override val numAvailableUnits: Int

Current number of available (idle) units.

Link copied to clipboard
open override val numBusyUnits: TWResponseCIfc

Time-weighted number of busy units across the pool.

Link copied to clipboard
open override val numTimesSeized: Int

The number of times units have been seized from the pool.

Link copied to clipboard
open override val utilization: TWResponseCIfc

Time-weighted utilization of the pool (busy units / capacity).

Functions

Link copied to clipboard
fun attachUnitsAvailableListener(listener: () -> Unit)

Registers a station to be notified (to serve its queue) when units free up.

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
fun release(amount: Int = 1)

Releases amount units and notifies waiting stations that units are available.

Link copied to clipboard
fun seize(amount: Int = 1)

Seizes amount units. The caller must ensure availability first.