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
an optional name for the entity
Inheritors
Types
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.
A BlockingActivity is an activity that may block other entities as they wait for the activity's delay to complete.
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.
A BlockingResourcePoolUsage represents the usage of a pool of resources that may block other entities while the usage occurs. Equivalent to: seize(), delay(), release()
A BlockingResourceUsage represents the usage of a resource that may block other entities while its usage occurs. Equivalent to: seize(), delay(), release()
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.
Represents some amount of units needed from 1 or more resources
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
Controls whether the entity goes through the function dispose() of its containing ProcessModel. The default is true.
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.
If supplied, this process will be the process activated by an EntityGenerator that creates and activates the entity.
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.
True if a process has been scheduled to activate
If not null, the name of the process scheduled to activate
Provides access to the entity's processes by name
Provides a list of processes for the entity to follow before being disposed
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.
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.
The default velocity for the entity's movement within the spatial model of its ProcessModel
Functions
Can be used by subclasses to perform some logic when (after) the current process is completed, but before deciding to execute the next process (if there is one). Called right before determineNextProcess()
A string representation of the allocations held by the entity. Useful for printing and diagnostics.
Subclasses can override this method and provide logic for the supplied process that will be executed right before the process runs to is first suspension point. For example, this method could be used to make assignments to the entity before the entity starts running the process. By default, this method does nothing.
A string representation of the active blockages for the entity. Useful for printing and diagnostics.
If the useProcessSequence property is true, this method automatically uses the current processSequenceIterator. If the iterator has a next element it is returned, else null is returned. Subclasses may override this implementation to provide a more general approach to determining the next process to run.
This function is called if there are no more processes to run for the entity after successfully completing a process. This method provides subclasses the ability to release any allocations or do clean up before the entity is passed to its EntityType for handling. By default, this method does nothing.
Subclasses of Entity can use this method to clean up after a process is terminated for the entity. Currently, it does nothing.
A request, in a request queue, is there because it's entity is suspended. This function will remove the supplied request from the specified queue and place it in the queue associated with the specified movable resource pool. If the movable resource pool has a unit of capacity available to satisfy the request, then the entity is resumed to allow the unit to be allocated. If the movable resource pool does not have a unit to satisfy the request, the entity stays suspended within the movable resource pool's queue and will be processed as a normal request for the movable resource pool.
A request, in a request queue, is there because it's entity is suspended. This function will remove the supplied request from the specified queue and place it in the queue associated with the specified resource. If the resource has units of capacity available to satisfy the request, then the entity is resumed to allow the units to be allocated. If the resource does not have sufficient units to satisfy the request, the entity stays suspended within the resource's queue and will be processed as a normal request for the resource.
A request, in a request queue, is there because it's entity is suspended. This function will remove the supplied request from the specified queue and place it in the queue associated with the specified resource pool. If the resource pool has units of capacity available to satisfy the request, then the entity is resumed to allow the units to be allocated. If the resource pool does not have sufficient units to satisfy the request, the entity stays suspended within the resource pool's queue and will be processed as a normal request for the resource pool.
Computes the number of different allocations of the resource held by the entity.
This function is used to define via a builder for a process for the entity.
Subclasses of entity can override this method to provide behavior if a request associated with the entity has its requested resource become inactive while its request was waiting in the request queue. This is not a trivial thing to do since the entity will be suspended after seizing a resource. If the entity wants to stop waiting, then the process will have to be terminated and the termination logic will need to handle what to do after the termination. However, if the entity can wait for a different resource, it is possible to remove the request from its current queue and place the request in a different queue that supports a different (active) resource.
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.
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.
Computes the total number of units of the specified resource that are allocated to the entity.