ResponseSchedule

class ResponseSchedule @JvmOverloads constructor(parent: ModelElement, theScheduleStartTime: Double = 0.0, repeatSchedule: Boolean = true, name: String? = null) : ModelElement(source)

This class allows the creation of a schedule that represents a list of intervals of time. The starting length of a schedule is 0.0. The length of a schedule depends upon the intervals added to it. The schedule's length encompasses the furthest interval added. If no intervals are added, then the schedule only has its start time and no response collection will occur.

The user adds intervals and responses for which statistics need to be collected during the intervals. The intervals within the cycle may overlap in time. The start time of an interval is specified relative to the beginning of the cycle. The length of any interval must be finite.

The schedule can be started any time after the start of the simulation. The default starting time of the schedule is time 0.0. The schedule will start automatically at the designated start time.

The schedule can be repeated after the cycle length of the schedule is reached. The default is for the schedule to automatically repeat. Note that depending on the simulation run length only a portion of the scheduled intervals may be executed.

The classic use case of this class is to collect statistics for each hour of the day. In this case, the user would use the addIntervals() method to add 24 intervals of 1 hour duration. Then responses (response variables, time weighted variables, and counters) can be added to the schedule. In which case, they will be added to each interval. Thus, interval statistics for each of the 24 intervals will be collected for everyone of the added responses. If more than one day is simulated and the schedule is allowed to repeat, then statistics are collected across the days. That is, the statistics of hour 1 on day 1 are averaged with the statistics of hour 1 on all subsequent days.

This functionality is built on the ResponseInterval class, which can be used separately. In other words, response intervals do not have to be on a schedule. The schedule facilitates the collection of many responses across many intervals.

Parameters

parent

the parent model element

theScheduleStartTime

the time to start the schedule, must be finite.

repeatSchedule

Whether the schedule will repeat

name

the name of the model element

Constructors

Link copied to clipboard
constructor(parent: ModelElement, theScheduleStartTime: Double = 0.0, repeatSchedule: Boolean = true, name: String? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The time that the schedule started for its current cycle

Link copied to clipboard

The time that has elapsed into the current cycle

Link copied to clipboard

Indicates if the schedule has been scheduled to start

Link copied to clipboard

Represents the length of time of the schedule based on the intervals added

Link copied to clipboard

The number of intervals in the schedule

Link copied to clipboard

The time remaining within the current cycle

Link copied to clipboard

An unmodifiable list of the ResponseScheduleItems

Link copied to clipboard

The schedule repeat flag controls whether the entire schedule will repeat after its entire cycle has elapsed. The default is true.

Link copied to clipboard

The time that the schedule should start

Functions

Link copied to clipboard

There must not be any duplicates in the collection or null values. Causes interval statistics to be collected for all the counters for every interval in the schedule.

Link copied to clipboard

Causes interval statistics to be collected for the counter for every interval in the schedule

Link copied to clipboard
fun addIntervals(startTime: Double = 0.0, numIntervals: Int, duration: Double, label: String? = null)

Add non-overlapping, sequential intervals to the schedule, each having the provided duration

Link copied to clipboard
fun addResponseInterval(startTime: Double, duration: Double, theLabel: String): ResponseScheduleItem

Add an interval for collecting responses to the schedule. If the start time plus the duration reaches past the current schedule length, the schedule length is extended to include the interval.

Link copied to clipboard

There must not be any duplicates in the collection or null values. Causes interval statistics to be collected for all the responses for every interval in the schedule.

Link copied to clipboard

Causes interval statistics to be collected for the response for every interval in the schedule

Link copied to clipboard
Link copied to clipboard
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