CapacitySchedule

class CapacitySchedule @JvmOverloads constructor(parent: ModelElement, startTime: Double = 0.0, autoStartOption: Boolean = true, repeatable: Boolean = false, val eventPriority: Int = KSLEvent.DEFAULT_PRIORITY, name: String? = null) : ModelElement, CapacityScheduleCIfc(source)

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

A CapacitySchedule has an auto start flag, which controls whether the schedule should start automatically upon initialization (at the start of the replication). The default is to start automatically.

A CapacitySchedule has an initial start time, which represents the amount of time after the beginning of the replication that the schedule is to start. The default start time is zero (at the beginning of the replication).

A CapacitySchedule as a length (or duration) that represents the total time associated with the schedule. After this time has elapsed the entire schedule can repeat if the repeat option is on. The length of the schedule is determined by the durations of the items placed on it.

A CapacitySchedule has a repeat flag that controls whether it will repeat after its duration has elapsed. The default is to repeat the schedule and is only relevant if the schedule duration (length) is finite.

A CapacitySchedule has a cycle start time that represents when the schedule started its current cycle. Again, this is only relevant if the repeat flag is true and the schedule duration is finite. If there is only one cycle, it is the time that the schedule started.

To make a CapacitySchedule useful, instances of the CapacityChangeListenerIfc interface should be added to listen for changes in the schedule. Instances of CapacityChangeListenerIfc are notified in the order in which they are added to the schedule. Instances of CapacityChangeListenerIfc are notified when the schedule starts, when it ends, and when any CapacityItem starts. It is up to the instance of CapacityChangeListenerIfc to react to the schedule changes that it needs to react to and ignore those that it does not care about.

Author

rossetti

Parameters

parent

the parent model element holding the schedule

startTime

the time after the start of the replication that the schedule should start. The default is 0.0

autoStartOption

whether the schedule should start automatically. The default is true.

repeatable

whether the schedule will automatically repeat. The default is false.

eventPriority

the default priority of the events used to start each item on the schedule

name

an optional name for the schedule

Constructors

Link copied to clipboard
constructor(parent: ModelElement, capacityScheduleData: CapacityScheduleData, eventPriority: Int = KSLEvent.DEFAULT_PRIORITY, name: String? = null)

Creates a CapacitySchedule based on capacity schedule data

constructor(parent: ModelElement, startTime: Double = 0.0, autoStartOption: Boolean = true, repeatable: Boolean = false, eventPriority: Int = KSLEvent.DEFAULT_PRIORITY, name: String? = null)

Types

Link copied to clipboard
inner class CapacityItem(val capacity: Int = 0, val duration: Double, val priority: Int = eventPriority)

A CapacityItem represents an item on a CapacitySchedule. CapacityItems are placed on a CapacitySchedule in the order that they will execute. The first item will start when the schedule starts and each item will be scheduled sequentially based on the durations of the previous items. At the specified start time, the capacity is to be set to the supplied value.

Properties

Link copied to clipboard

The time that the schedule started for its current cycle

Link copied to clipboard
open override val eventPriority: Int
Link copied to clipboard
open override var initialStartTime: Double

The time from the beginning of the replication to the time that the schedule is to start

Link copied to clipboard
open override var isAutoStartFlag: Boolean

Indicates whether the schedule should be started automatically upon initialization, default is true

Link copied to clipboard
open override val isEmpty: Boolean

Checks if there are no items on the schedule

Link copied to clipboard
open override var isScheduleRepeatable: Boolean

The schedule repeat flag controls whether the entire schedule will repeat after its entire duration has elapsed. The default is to repeat the schedule. The use of this flag only makes sense if a finite schedule length is specified

Link copied to clipboard
open override val items: List<CapacityItemData>

The capacity schedule item data as a list

Link copied to clipboard

Represents the total length of time of the schedule. The total of the durations determines the length of the schedule. After this time has elapsed the entire schedule can repeat if the schedule repeat flag is true. The default is infinite.

Functions

Link copied to clipboard

The same listener cannot be added more than once. Listeners are notified of schedule changes in the sequence by which they were added.

Link copied to clipboard
open override fun addItem(capacity: Int, duration: Double, itemPriority: Int): CapacitySchedule.CapacityItem

Adds an item to the schedule. Each item is added consecutively to the schedule in the order added. The start time of the 2nd capacity change is the ending time of the first capacity change and so on.

Link copied to clipboard
Link copied to clipboard

If scheduled to start, this cancels the start of the schedule.

Link copied to clipboard
open override fun clearSchedule()

Removes all capacity items from the schedule

Link copied to clipboard
operator fun contains(listener: CapacityChangeListenerIfc): Boolean
Link copied to clipboard
open override fun countScheduleChangeListeners(): Int
Link copied to clipboard
Link copied to clipboard
open override fun deleteCapacityChangeListeners()

Deletes all listeners

Link copied to clipboard

Schedules the start of the schedule for the start time of the schedule if it has not already been started

Link copied to clipboard
open override fun toString(): String

Includes the model name, the id, the model element name, the parent name, and parent id