ResponseInterval

class ResponseInterval @JvmOverloads constructor(parent: ModelElement, theDuration: Double, label: String?, aResponseSchedule: ResponseSchedule? = null) : ModelElement(source)

This class represents an interval of time over which statistical collection should be performed. An interval is specified by providing an interval start time and a duration. The duration must be finite and greater than zero.

Simulation responses in the form of instances of ResponseVariable, TimeWeighted, and Counter can be added to the interval for observation. New responses are created and associated with each of the supplied responses. The new responses collect observations associated with the supplied responses only during the specified interval. In the case of response variables or time weighted variables, the average response during the interval is observed. In the case of counters, the total count during the interval is observed.

If the interval is not associated with a ResponseSchedule, the interval may be repeated. In which case, the statistics are collected across the intervals. A repeated interval starts immediately after the previous duration. Note that for ResponseVariables that are observed, if there are no observations during the interval, then the average response during the interval is undefined (and thus not observed). Therefore, interval statistics for ResponseVariables are conditional on the occurrence of at least one observation. This is most relevant when the interval is repeated because intervals with no observations are not tabulated.

An interval that is still collecting when the warm-up event occurs is discarded: it observes nothing at all, neither an average for its responses, nor a total for its counters, nor its empty-interval indicator. The warm-up resets the very quantities that were captured when the interval started, so no figure computed by differencing them describes the interval, and an interval names a window that the reported value is supposed to belong to. A counter in this situation formerly reported a negative count. A warm-up falling exactly on an interval boundary straddles nothing and discards nothing. The discard is reported once per experiment through a warning, because the warm-up time and the interval schedule are both fixed and the situation therefore recurs identically in every replication.

This is deliberately the opposite of what TimeSeriesResponse does, because the two are built for opposite contexts. An interval names a window in a study that discards a warm-up period, whereas a time series is only slicing time and reports every period it slices.

Author

rossetti

Constructors

Link copied to clipboard
constructor(parent: ModelElement, theDuration: Double, label: String?, aResponseSchedule: ResponseSchedule? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard

Indicates if the interval has been scheduled

Link copied to clipboard

The repeat flag controls whether the interval will repeat after its duration has elapsed. The default is false.

Link copied to clipboard

Specifies when the interval is to start. If negative, then the interval will not be started, must not be infinite

Link copied to clipboard

Intervals may be repeated. The represents the time that the interval last ended in time;

Link copied to clipboard

Intervals may be repeated. The represents the time that the interval last started in time;

Functions

Link copied to clipboard

Adds a Counter to the interval for data collection over the interval

Link copied to clipboard
fun addResponseToInterval(theResponse: Response, intervalEmptyStatOption: Boolean = false): Response
fun addResponseToInterval(theResponse: ResponseCIfc, intervalEmptyStatOption: Boolean = false): Response

Adds a ResponseVariable to the interval for data collection over the interval. By default, interval empty statistics are not collected.

Link copied to clipboard
protected open override fun afterReplication()

This method should be overridden by subclasses that need actions performed after each replication. It is called after replicationEnded() has been called.

Link copied to clipboard
Link copied to clipboard
protected open override fun beforeExperiment()

This method should be overridden by subclasses that need logic to be performed prior to an experiment. The beforeExperiment method allows model elements to be set up prior to the first replication within an experiment. It is called once before any replications occur.

Link copied to clipboard

Cancels the scheduling of the interval. Any statistical collection will not occur.

Link copied to clipboard
protected open override fun initialize()

This method should be overridden by subclasses that need actions performed to initialize prior to a replication. It is called once before each replication occurs if the model element wants initialization. It is called after beforeReplication() is called

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

Link copied to clipboard
protected open override fun warmUp()

This method should be overridden by subclasses that need actions performed at the warm-up event during each replication. It is called once during each replication if the model element reacts to warm-up actions.