Entity

An entity is something that can experience processes and as such may wait in queue. It is a subclass of QObject. The general approach is to use the process() function to define a process that a subclass of Entity can follow. Entity instances may use resources, signals, hold queues, etc. as shared mutable state. Entities may follow a process sequence if defined.

Parameters

aName

an optional name for the entity

Inheritors

Constructors

Link copied to clipboard
constructor(aName: String? = null)

Types

Link copied to clipboard
inner class Blockage(name: String? = null) : IdentityIfc

A blockage is like a semaphore or lock. A blockage can be used to block (suspend) other entities while they wait for the blockage to be cleared. The user can mark process code with the start of a blockage and a subsequent end of the blockage. While the entity that creates the blockage is within the blocking code, other entities can be made to wait until the blockage is cleared. Only the entity that creates the blockage can start and clear it. A started blockage must be cleared before the end of the process routine that contains it; otherwise, an exception will occur. Thus, blockages that are started must always be cleared. The primary purpose of this construct is to facilitate process interaction between entities. Using blockages should be preferred over raw suspend/resume usage and even the use of Suspension instances.

Link copied to clipboard
open inner class BlockingActivity(val activityTime: GetValueIfc, val activityPriority: Int = DELAY_PRIORITY, name: String? = null) : ProcessModel.Entity.BlockingTask

A BlockingActivity is an activity that may block other entities as they wait for the activity's delay to complete.

Link copied to clipboard
inner class BlockingMovement(val fromLoc: LocationIfc, val toLoc: LocationIfc, val velocity: GetValueIfc = this@Entity.velocity, val movePriority: Int = MOVE_PRIORITY, name: String? = null) : ProcessModel.Entity.BlockingTask

Represents the movement of the entity from the specified location to the specified location at the supplied velocity. This wraps the movement within a blockage which will cause entities that are waiting for the movement to complete to block (suspend) until the movement is completed.

Link copied to clipboard
inner class BlockingResourcePoolUsage(val resourcePool: ResourcePool, val amountNeeded: Int = 1, val seizePriority: Int = SEIZE_PRIORITY, delayDuration: Double, delayPriority: Int = DELAY_PRIORITY, val queue: RequestQ, name: String? = null) : ProcessModel.Entity.BlockingActivity

A BlockingResourcePoolUsage represents the usage of a pool of resources that may block other entities while the usage occurs. Equivalent to: seize(), delay(), release()

Link copied to clipboard
inner class BlockingResourceUsage(val resource: Resource, val amountNeeded: Int = 1, val seizePriority: Int = SEIZE_PRIORITY, delayDuration: Double, delayPriority: Int = DELAY_PRIORITY, val queue: RequestQ, name: String? = null) : ProcessModel.Entity.BlockingActivity

A BlockingResourceUsage represents the usage of a resource that may block other entities while its usage occurs. Equivalent to: seize(), delay(), release()

Link copied to clipboard
abstract inner class BlockingTask(name: String? = null) : IdentityIfc

A BlockingTask is a task that takes time to complete and will block the process of an entity that will wait for it to complete.

Link copied to clipboard

Represents some amount of units needed from 1 or more resources

Link copied to clipboard
inner class Suspension(name: String? = null, val type: SuspendType = SuspendType.SUSPEND) : IdentityIfc

An abstraction that represents a general suspension point within a process. Suspensions are one-shot. That is, once resumed they cannot be used again unless passed through the suspend(suspension: Suspension) function for a KSLProcess.

Properties

Link copied to clipboard

Controls whether the entity goes through the function dispose() of its containing ProcessModel. The default is true.

Link copied to clipboard

If an entity is using a conveyor (has requested and received cells) this returns the request. If null, then the entity should not be using a conveyor. This is set via the requestConveyor() suspending function to the request and to null when the entity exits the conveyor.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

If supplied, this process will be the process activated by an EntityGenerator that creates and activates the entity.

Link copied to clipboard

Indicates if the entity has active (started) blockages within a process. A blockage is considered active if it has been started within a process routine. If no blockages have been created or started, this will return false.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

True if a process has been scheduled to activate

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

If not null, the name of the process scheduled to activate

Link copied to clipboard
Link copied to clipboard

Provides access to the entity's processes by name

Link copied to clipboard
Link copied to clipboard

Provides a list of processes for the entity to follow before being disposed

Link copied to clipboard

An iterator over the entity's current process sequence. If a process sequence is supplied and the property useProcessSequence is true then the iterator is used to determine the next process for the entity to execute.

Link copied to clipboard

Controls whether the entity uses an assigned process sequence via the processSequence property at the end of successfully completing a process to determine the next process to experience. The default is false.

Link copied to clipboard
open override var velocity: GetValueIfc

The default velocity for the entity's movement within the spatial model of its ProcessModel

Functions

Link copied to clipboard

A string representation of the allocations held by the entity. Useful for printing and diagnostics.

Link copied to clipboard

A string representation of the active blockages for the entity. Useful for printing and diagnostics.

Link copied to clipboard

If the entity is in a HoldQueue return the queue

Link copied to clipboard
fun isUsing(resource: Resource): Boolean

Checks if the entity is using (has allocated units) the specified resource.

Link copied to clipboard

Computes the number of different allocations of the resource held by the entity.

Link copied to clipboard
fun resumeProcess(timeUntilResumption: Double = 0.0, priority: Int = RESUME_PRIORITY)

If the entity is executing a process and the process is suspended, then the process is scheduled to resume at the specified simulation time. This schedules an event that eventually resumes the process.

Link copied to clipboard
fun terminateProcess(afterTermination: (entity: ProcessModel.Entity) -> Unit? = null)

If the entity is executing a process and the process is suspended, then the process routine is terminated. This causes the currently suspended process to exit, essentially with an error condition. No further processing within the process will execute. The process ends (is terminated). All resources that the entity has allocated will be deallocated. If the entity was waiting in a queue, the entity is removed from the queue and no statistics are collected on its queueing. If the entity is experiencing a delay, then the event associated with the delay is cancelled.

Link copied to clipboard

Computes the total number of units of the specified resource that are allocated to the entity.