Package-level declarations

Types

Link copied to clipboard

The default is to allocate all available from each resource until amount needed is met in the order in which the resources are listed within the list.

Link copied to clipboard
class Allocation(val entity: ProcessModel.Entity, val resource: Resource, theAmount: Int = 1, val queue: RequestQ, allocationName: String? = null)

An allocation represents a distinct usage of a resource by an entity with an amount allocated. Entities can have multiple allocations for the same resource. An allocation is in response to separate requests for units. Multiple requests by the same entity for units of the resource result in multiple allocations (when filled). An allocation is not created until the requested amount is available.

Link copied to clipboard

An allocation listener is notified whenever the resource is allocated and when the resource is deallocated. This allows general actions to occur when the resource's state changes at these instances in time.

Link copied to clipboard
open class AllocationRule(var comparator: Comparator<Resource>) : AllocationRuleIfc
Link copied to clipboard
fun interface AllocationRuleIfc

Function to determine how to allocate requirement for units across a list of resources that have sufficient available units to meet the amount needed.

Link copied to clipboard
class BlockingQueue<T : ModelElement.QObject>(parent: ModelElement, val capacity: Int = Int.MAX_VALUE, name: String? = null) : ModelElement

A blocking queue facilitates the exchange of information between two or more entities that are experiencing processes. Note that an entity can experience one process at a time.

Link copied to clipboard
Link copied to clipboard
class CapacitySchedule(parent: ModelElement, startTime: Double = 0.0, autoStartOption: Boolean = true, repeatable: Boolean = false, val eventPriority: Int = KSLEvent.DEFAULT_PRIORITY, name: String? = null) : ModelElement

A CapacitySchedule represents a known set of capacity specifications that last for a duration of time.

Link copied to clipboard
class Conveyor(parent: ModelElement, segmentData: ConveyorSegments, val conveyorType: Conveyor.Type = Type.ACCUMULATING, velocity: Double = 1.0, val maxEntityCellsAllowed: Int = 1, name: String? = null) : ModelElement

A conveyor consists of a series of segments. A segment has a starting location (origin) and an ending location (destination) and is associated with a conveyor. The start and end of each segment represent locations along the conveyor where entities can enter and exit. A conveyor does not utilize a spatial model. The locations associated with its segments are instances of the interface IdentityIfc. Thus, movement on the conveyor is disassociated with any spatial model associated with the entity using the conveyor. Since a spatial model using instances of the LocationIfc interface and LocationIfc extends the IdentityIfc, the locations associated with segments can be the same as those associated with spatial models. If the destination of a ride request is an instance of LocationIfc then the entity's curren location property will be updated after the movement. However, if the segments are not defined by locations within a spatial model, no updating of the entity's location will take place. The modeler is responsible for making the update to the entity location, if applicable.

Link copied to clipboard
class ConveyorQ(parent: ModelElement, name: String? = null, discipline: Queue.Discipline = Discipline.FIFO) : Queue<Conveyor.ConveyorRequest>
Link copied to clipboard

A conveyor request represents the holding of cells on a conveyor and acts as a "ticket" to use the conveyor. Once an entity has a conveyor request, the entity has control over the cells at the start of the segment associated with the entry location along the conveyor. After receiving a request to access the conveyor the entity can either ride on the conveyor or exit. The conveyor request blocks at the point of access until riding or exiting. The request is placed in the blocking entry state. When the entity asks to ride the conveyor then the request will be placed in the riding state. If the entity never rides the conveyor, then the request stays in the blocking entry state. The property isWaitingForEntry indicates that the conveyor request is waiting to be allowed to block the entry cell of the conveyor at its current location. Once the conveyor request is used to ride the conveyor, the isWaitingToConvey property will report false. The isBlockingEntry property will report true until the request begins riding. Once the request reaches its destination, the isBlockingExit property will be true and the request is in the blocking exit state. When the request exits the conveyor the isCompleted property is true and the request is in the completed state. Once in the completed state, the request can no longer be used for any interaction with the conveyor.

Link copied to clipboard
class ConveyorSegments(val cellSize: Int = 1, val firstLocation: IdentityIfc)

This class represents the data associated with segments of a conveyor and facilitates the specification of segments for a conveyor. See the class Conveyor for more details on how segments are used to represent a conveyor.

Link copied to clipboard

Returns a list of requests that can be allocated at the current time based on the amount available criteria. Each request that can be fully allocated by the amount available is returned. The list is ordered in the same order as the RequestQ. No partial filling is permitted in this default rule.

Link copied to clipboard
fun interface EntitySelectorIfc
Link copied to clipboard

Returns the first resource that can (individually) entirely supply the requested amount. The return list will have 0 or 1 item.

Link copied to clipboard
class HoldQueue(parent: ModelElement, name: String? = null, discipline: Queue.Discipline = Discipline.FIFO) : Queue<ProcessModel.Entity>

This class is designed to hold entities that are waiting within a process.

Link copied to clipboard
interface KSLProcess
Link copied to clipboard

KSLProcessBuilder provides the functionality for describing a process. A process is an instance of a coroutine that can be suspended and resumed. The methods of the KSLProcessBuilder are the suspending methods that are allowed within the process modeling paradigm of the KSL. The various suspend methods have an optional string name parameter to identify the name of the suspension point. While not required for basic modeling, identifying the suspension point can be useful for more advanced modeling involving the cancellation or interrupting of a process. The name can be used to determine which suspension point is suspending the process when the process has many suspension points.

Link copied to clipboard

The number of times the resource was seized is used to determine the ordering. The less the number the smaller. If the number of times seized is equal, then the resource with the earliest time exiting the busy state is considered smaller. That is the one furthest back in time that the busy state was exited.

Link copied to clipboard

The ordering is determined such that more available units "rise to the top", then by least number times seized, then by oldest time last busy

Link copied to clipboard

Compares the resources based on the number available

Link copied to clipboard
open class ProcessModel(parent: ModelElement, name: String? = null) : ModelElement

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. After completing the process, the entity will try to use its sequence to run the next process (if available). Individual processes can be activated for specific entities.

Link copied to clipboard
class ProcessTerminatedException(val afterTermination: (entity: ProcessModel.Entity) -> Unit? = null, m: String = "Process Terminated!") : RuntimeException

Used to exit (terminate) a currently executing ProcessCoroutine.

Link copied to clipboard
Link copied to clipboard
class RequestQ(parent: ModelElement, name: String? = null, discipline: Queue.Discipline = Discipline.FIFO) : Queue<ProcessModel.Entity.Request>

If the user supplies a request selection rule then this will override the default queue discipline for finding the next request from the queue.

Link copied to clipboard
Link copied to clipboard
open class Resource(parent: ModelElement, name: String? = null, capacity: Int = 1) : ProcessModel, ResourceCIfc

A Resource represents a number of common units that can be allocated to entities. A resource has an initial capacity that cannot be changed during a replication. This base resource class can only be busy or idle.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open class ResourcePool(parent: ModelElement, resources: List<Resource>, name: String? = null) : ModelElement

A ResourcePool represents a list of Resources from which resources can be selected to fill requests made by Entities.

Link copied to clipboard
class ResourcePoolAllocation(val entity: ProcessModel.Entity, val resourcePool: ResourcePool, theAmount: Int = 1, val queue: RequestQ, allocationName: String? = null)

An allocation represents a distinct usage of a resource by an entity with an amount allocated. Entities can have multiple allocations for the same resource. An allocation is in response to separate requests for units. Multiple requests by the same entity for units of the resource result in multiple allocations (when filled). An allocation is not created until the requested amount is available.

Link copied to clipboard
open class ResourcePoolWithQ(parent: ModelElement, resources: List<Resource>, queue: RequestQ? = null, name: String? = null) : ResourcePool
Link copied to clipboard

Returns a list of resources that have enough available to meet the request. The returned list will have resources such that the total number of available units is greater than or equal to the amount of the request. If the returned list is empty, this means that there were not sufficient available resource units to fully meet the request. It is important to note that the returned list may have more units available than requested. Resource allocation rules are used to select from the returned list to specify which of the list of resources may be allocated to meet the request.

Link copied to clipboard

Provides for a method to select resources from a list such that the returned list will contain resources that can fully fill the amount needed or the list will be empty.

Link copied to clipboard
open class ResourceWithQ(parent: ModelElement, name: String? = null, capacity: Int = 1, queue: RequestQ? = null) : Resource, ResourceWithQCIfc

A resource is considered busy if at least 1 unit is allocated. A resource is considered idle if no units have been allocated. The capacity can be changed during a replication; however, the capacity of every replication starts at the same initial capacity.

Link copied to clipboard
Link copied to clipboard
data class Segment(val entryLocation: IdentityIfc, val exitLocation: IdentityIfc, val length: Int)

This data class represents the origin entryLocation and destination exitLocation of a length of a segment for a conveyor. See the class Conveyor for more details on how segments are used to represent a conveyor.

Link copied to clipboard
class Signal(parent: ModelElement, name: String? = null, discipline: Queue.Discipline = Queue.Discipline.FIFO) : ModelElement

The purpose of this class is to hold entities that are waiting for a signal while executing a KSLProcess. A reference to this class can be used to signal specific, any, or all the entities waiting to proceed within their process.

Link copied to clipboard
Link copied to clipboard

Because an entity that is executing a process cannot resume itself after suspending itself, we need a mechanism to allow the entity to register itself before suspending.

Properties

Link copied to clipboard
Link copied to clipboard
const val PRIORITY: Int

Functions

Link copied to clipboard
fun allocateInOrder(amountNeeded: Int, resourceList: List<Resource>): Map<Resource, Int>

Returns a map of how many units to allocate to each resource. If a resource is not in the returned map, then it will not have any units allocated.

Link copied to clipboard

Filters the list such that the returned list has resources that have units available for allocation. The returned list may be empty which indicates that there are no resources in the list that have available units.

Link copied to clipboard
fun checkAvailableUnits(amountNeeded: Int, resourceList: List<Resource>): Boolean

Checks if the number of available units in the list is greater than or equal to the amount needed.

Link copied to clipboard

Filters the supplied list such that the returned list has resources that have units available for allocation.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun main()
Link copied to clipboard

Returns the total number of units that are available within the resources contained in the list.

Link copied to clipboard
fun requireAllAvailable(resourceList: List<Resource>)

Checks if all resources in the list are available. Throws an exception if any of the resources in the list do not have available units