SResource

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

A SResource represents a simple resource that can have units become busy. A resource is considered busy when it has 1 or more units seized. A resource is considered idle when all available units are idle. A resource has an initial capacity, which represents the units that can be allocated.

The capacity of the resource represents the maximum number of units available for use. For example, if the resource has capacity 3, it may have 2 units busy and 1 unit available. A resource cannot have more units busy than the capacity.

Author

rossetti

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 capacity of the resource at time any time t

Link copied to clipboard
open override val hasAvailableUnits: Boolean

Indicates if resource has available units

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

The initial capacity of the resource at time just prior to 0.0

Link copied to clipboard
open override val isBusy: Boolean

Checks to see if the resource is busy, has some units allocated

Link copied to clipboard
open override val isIdle: Boolean

Checks if the resource is idle, has no units allocated

Link copied to clipboard
open override val numAvailableUnits: Int

Current number of available units

Link copied to clipboard
open override val numBusyUnits: TWResponseCIfc

Response information on number of busy units

Link copied to clipboard
open override val numTimesReleased: Int

Counts how many times the resource has units become idle

Link copied to clipboard
open override val numTimesSeized: Int

Counts how many times the resource has units become busy

Link copied to clipboard
Link copied to clipboard
open override val utilization: TWResponseCIfc

Response information on resource utilization

Functions

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

Release the amount of the resource. The amount to release must be 1 or more and less than or equal to the current number of busy resource units.

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

Seizes amount units of the resource. If amt = 0, then an exception occurs. If the resource has no units available, then an exception occurs. If the amt is greater than the number available, then an exception occurs. Thus, users must check for availability before calling this function.

Link copied to clipboard
open override fun toString(): String

Includes the model name, the id, the model element name, the parent name, and parent id