MovableResource

open class MovableResource @JvmOverloads constructor(parent: ModelElement, initLocation: LocationIfc, defaultVelocity: RVariableIfc, name: String? = null, stepSize: Double = 1.0) : Resource, MovableResourceIfc, MoveableResourceCIfc, VehicleMovementIfc(source)

A movable resource is a single unit capacity resource that resides within a spatial model and thus can be moved.

Parameters

parent

the parent model element

initLocation

the initial starting location of the resource within the spatial model

defaultVelocity

the default velocity for movement within the spatial model It also implements VehicleMovementIfc, the movement seam a fleet is written against, so that tours, dispatching and a manifest can be driven over a free path by exactly the code that drives them over a guide path or a continuous projection. Nothing about the existing move, moveWith and transportWith verbs changes: those remain one delay to the destination and are what a modeller uses to move a resource directly. The seam is a second way in, used by a fleet, and it is the one that can be interrupted and redirected part way. See "The movement seam" below.

name

the name of the resource

stepSize

how far apart the seam's decision points are, in the spatial model's own distance units. It fixes how quickly a redirection or a halt is observed -- at most stepSize/velocity later -- and is ignored entirely where the spatial model cannot interpolate, since there a journey is one step and has always been

Inheritors

Constructors

Link copied to clipboard
constructor(parent: ModelElement, initLocation: LocationIfc, defaultVelocity: RVariableIfc, name: String? = null, stepSize: Double = 1.0)

Types

Link copied to clipboard
object Companion
Link copied to clipboard
protected inner class HomeBaseDriver : ProcessModel

Properties

Link copied to clipboard
open override var capacity: Int

The current capacity of the resource. In general, it can be 0 or greater

Link copied to clipboard
open override var currentLocation: LocationIfc
Link copied to clipboard
open override val distanceTravelled: Double

How far this resource has travelled this replication, however it was moved. Never decreases.

Link copied to clipboard
open override val fracTimeMoving: TWResponseCIfc
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val hasHomeBase: Boolean
Link copied to clipboard
open override var homeBase: LocationIfc?
Link copied to clipboard
Link copied to clipboard
@set:KSLControl(controlType = ControlType.INTEGER, lowerBound = 0.0, upperBound = 1.0)
open override var initialCapacity: Int

The initial capacity of the resource at the start of the replication. The initial capacity must be greater than 0.

Link copied to clipboard
open override var initialHomeBase: LocationIfc?
Link copied to clipboard
open override var initialLocation: LocationIfc
Link copied to clipboard
open override val isHalted: Boolean

True while the resource is stopped short of where it was going, with nothing scheduled.

Link copied to clipboard
open override var isMoving: Boolean
Link copied to clipboard
Link copied to clipboard

True while this vehicle has been taken off shift.

Link copied to clipboard

True indicates that the movable resource is in the process of returning to its home base.

Link copied to clipboard
open override val isTracked: Boolean
Link copied to clipboard
Link copied to clipboard
open override val modelElement: ModelElement
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
protected val myHomeQ: RequestQ
Link copied to clipboard
Link copied to clipboard
protected val myVelocity: RandomVariable
Link copied to clipboard
Link copied to clipboard
open override val operatingTime: Double

How long it has spent moving this replication, however it was moved. Never decreases.

Link copied to clipboard
open override val positionNow: LocationIfc

Where the resource is at this instant, which is not the same thing as currentLocation.

Link copied to clipboard
open override val previousLocation: LocationIfc
Link copied to clipboard
open override val spatialID: Int
Link copied to clipboard
open override val spatialName: String
Link copied to clipboard
open override val status: SpatialModel.Status
Link copied to clipboard

How far apart the seam's decision points are, in the spatial model's own distance units.

Link copied to clipboard
open override val velocity: GetValueIfc

A value for the velocity. May be random

Link copied to clipboard
open override val velocityRV: RandomVariableCIfc

Functions

Link copied to clipboard
open override fun attachObserver(observer: ObserverIfc<SpatialElementIfc>)

Allows the adding (attaching) of an observer to the observable

Link copied to clipboard
open override fun beginTravelTo(destination: LocationIfc, purpose: MovePurpose, waiter: ProcessModel.Entity): HoldQueue?

Sends the resource to destination and hands back the queue to wait in.

Link copied to clipboard
open override fun countObservers(): Int

Returns how many observers are currently attached to the observable

Link copied to clipboard
open override fun detachAllObservers()

Detaches all the observers from the observable

Link copied to clipboard
open override fun detachObserver(observer: ObserverIfc<SpatialElementIfc>)

Allows the deletion (removing) of an observer from the observable

Link copied to clipboard

Takes this vehicle off shift: it cannot be seized again until goOnShift, and requests for it wait. Work already allocated finishes under the resource's own capacity change rule.

Link copied to clipboard
fun goOnShift()

Puts this vehicle back on shift.

Link copied to clipboard
fun halt()

Stops the resource where it stands and wakes whoever was waiting for it.

Link copied to clipboard
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
open override fun initializeSpatialElement()
Link copied to clipboard
open override fun isAttached(observer: ObserverIfc<SpatialElementIfc>): Boolean

Returns true if the observer is already attached

Link copied to clipboard
open override fun isReachable(destination: LocationIfc): Boolean

True for any location of this resource's own spatial model.

Link copied to clipboard
open override fun pathDistanceTo(destination: LocationIfc): Double

How far destination is by this spatial model's own metric, measured from positionNow.

Link copied to clipboard
open override fun resumeHalted()

Starts a halted vehicle again from where it stopped. Harmless on one that is not halted.

Link copied to clipboard

If the movable resource has a defined home base, and it is not already returning to home, this function causes the movable resource to be requested and sent to its home base. If there are pending requests, this request will compete with them, possibly waiting until finally causing the resource to return to its home base.