ProcessModel

open class ProcessModel(parent: ModelElement, name: String? = null) : ModelElement(source)

A process model facilitates the modeling of entities experiencing processes via the process view of simulation. A ProcessModel has inner classes (Entity, EntityGenerator, etc.) that can be used to describe entities and the processes that they experience. The key class is Entity, which has a function process() that uses a builder to describe the entity's process in the form of a coroutine. An entity can have many processes described that it may follow based on different modeling logic. A process model facilitates the running of a sequence of processes that are stored in an entity's processSequence property. An entity can experience only one process at a time. If using a sequence, after completing a process, the entity will try to use its sequence to run the next process (if available). Individual processes can be activated for specific entities.

See KSLProcessBuilder for documentation on the functionality provided for processes.

Parameters

parent

the parent model element

name

an optional name for the process model

Inheritors

Constructors

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

Types

Link copied to clipboard
open inner class BatchingEntity<T : ProcessModel.BatchingEntity<T>>(val batchesIncludeSelf: Boolean = true, aName: String? = null) : ProcessModel.Entity
Link copied to clipboard
object Companion
Link copied to clipboard
open inner class Entity(aName: String? = null) : ModelElement.QObject, SpatialElementIfc, VelocityIfc

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.

Link copied to clipboard
protected inner class EntityGenerator<T : ProcessModel.Entity>(entityCreator: () -> T, timeUntilTheFirstEntity: RVariableIfc, timeBtwEvents: RVariableIfc, maxNumberOfEvents: Long = Long.MAX_VALUE, timeOfTheLastEvent: Double = Double.POSITIVE_INFINITY, var activationPriority: Int = KSLEvent.DEFAULT_PRIORITY + 1, name: String? = null) : EventGenerator

Note that an EntityGenerator relies on the entity having a defined default process. The generator will create the entity and activate the default process. If the entity does not have a default process then an illegal state exception will occur. You can specify the default process via the isDefaultProcess parameter of the process() function or directly via the defaultProcess property of the entity.

Link copied to clipboard
protected inner class EntitySequenceGenerator<T : ProcessModel.Entity>(entityCreator: () -> T, timeUntilTheFirstEntity: RVariableIfc, timeBtwEvents: RVariableIfc, maxNumberOfEvents: Long = Long.MAX_VALUE, timeOfTheLastEvent: Double = Double.POSITIVE_INFINITY, var activationPriority: Int = KSLEvent.DEFAULT_PRIORITY + 1, name: String? = null) : EventGenerator

Note that an EntitySequenceGenerator relies on the entity having at least one process that has been added to its process sequence and the entity's addToSequence property being true. The generator will create the entity and activate the process that is listed first in its process sequence. If the entity does not have any processes in its process sequence then an illegal state exception will occur.

Link copied to clipboard
protected inner class ProcessActivator<T : ProcessModel.Entity>(entityCreator: () -> T, initialCountLimit: Int = 1, var processName: String? = null, var resetCountOption: Boolean = true, var activationPriority: Int = KSLEvent.DEFAULT_PRIORITY, name: String? = null) : ModelElement

This class will activate the entity's default process or the process provided by the process name argument. When the increment counter reaches the supplied initial count limit the entity's process will be activated. If the reset count option is true the internal counter is reset and additional entities will be created and activated when the count again reaches the limit. If the supplied process name is null (or not a named process for the entity), then the entity's default process will be activated. If both are unspecified, then an error occurs.

Functions

Link copied to clipboard
fun activate(process: KSLProcess, timeUntilActivation: Double = 0.0, priority: Int = KSLEvent.DEFAULT_PRIORITY): KSLEvent<KSLProcess>
fun activate(process: KSLProcess, timeUntilActivation: GetValueIfc, priority: Int = KSLEvent.DEFAULT_PRIORITY): KSLEvent<KSLProcess>

Cause the entity to start the process. The activation of the process is governed by an event that is scheduled to occur at the specified activation time.

Link copied to clipboard
protected open override fun afterReplication()

It is essential that subclasses that override this function call the super. This ensures that suspended entities are cleaned up after a replication

Link copied to clipboard
protected open fun dispose(entity: ProcessModel.Entity)

This method is called when the entity has been activated, run at least one process and has no further processes to run. Subclasses can override this method to provide logic after all processes have been completed by the entity. By default, nothing happens.

Link copied to clipboard
fun <T : ProcessModel.Entity> startProcessSequence(entity: T, timeUntilActivation: Double = 0.0, priority: Int = KSLEvent.DEFAULT_PRIORITY): KSLEvent<KSLProcess>?

Cause the entity to start the process sequence in the order specified by the sequence. The activation of the first process is governed by an event that is scheduled to occur based on the time until activation parameter.

fun <T : ProcessModel.Entity> startProcessSequence(entity: T, timeUnitActivation: GetValueIfc, priority: Int = KSLEvent.DEFAULT_PRIORITY): KSLEvent<KSLProcess>?

Cause the entity to start the process sequence in the order specified by the sequence. The activation of the first process is governed by an event that is scheduled to occur at the specified activation time.