ModelElement

The internal constructor for creating model elements. A model element is some construct that is an element of a model. Model elements are added to the main model when they are constructed by supplying a parent model element. The constructed model element becomes a child to the parent in the model element hierarchy. This constructor is internal because of the interaction with the class Model, which serves as the parent to all model elements.

Parameters

name

an optional name. If not provided, then a name is provided automatically by using the class type of the element and a unique number.

Inheritors

Constructors

Link copied to clipboard
constructor(parent: ModelElement, name: String? = null)

The main constructor for creating model elements. A model element is some construct that is an element of a model. Model elements are added to the main model when they are constructed by supplying a parent model element. The constructed model element becomes a child to the parent in the model element hierarchy.

Types

Link copied to clipboard
object Companion
Link copied to clipboard
protected abstract inner class EventAction<T> : ModelElement.EventActionIfc<T>

A convenience base class for creating event actions associated with the model element. The class has the ability to schedule its action.

Link copied to clipboard
fun interface EventActionIfc<T>

An interface used to implement the actions associated with event logic within the simulation.

Link copied to clipboard
protected interface EventBuilderIfc<T>
Link copied to clipboard

Uses the builder pattern to create and schedule the event and the action that is associated with the event

Link copied to clipboard

A Comparator for comparing model elements based on getId()

Link copied to clipboard
open inner class QObject @JvmOverloads constructor(aName: String? = null) : Comparable<ModelElement.QObject> , ModelElement.QObjectIfc

QObject can be used as a base class for objects that need to be placed in queues on a regular basis. A QObject can be in one and only one Queue at a time. An arbitrary object can be associated with the QObject. The user is responsible for managing the type of the attached object.

Link copied to clipboard
interface QObjectIfc : NameIfc
Link copied to clipboard

A set of constants for indicating model element status to observers of basic model element changes

Link copied to clipboard
protected abstract inner class TimedEventAction<T>(theTimeBtwEvents: GetValueIfc) : ModelElement.EventAction<T>

A convenience base class for creating event actions associated with the model element. The class has the ability to schedule its action according to a repeating time between events.

Link copied to clipboard

A definition of default time unit conversions. MILLISECOND = 1.0, SECOND = 1000.0, MINUTE = 60SECOND, HOUR = 60MINUTE, DAY = 24HOUR, WEEK = 7DAY, MONTH = 30.0DAY, YEAR = 365DAY

Link copied to clipboard
protected interface TimeUnitIfc<T>

A Tagging interface to force the builder to specify time timeUnits after calling the in() method.

Properties

Link copied to clipboard

A flag to control if the model element reacts to after experiment actions.

Link copied to clipboard

A flag to control whether the model element reacts to after replication actions.

Link copied to clipboard

A flag to control if the model element reacts to before experiment actions.

Link copied to clipboard

A flag to control if the model element reacts to before replication actions.

Link copied to clipboard

Indicates the current status of the model element for observers of ModelElement.Status

Link copied to clipboard

A global uniform random number source

Link copied to clipboard
protected val executive: Executive

the executive that is executing the events

Link copied to clipboard
open override val id: Int
Link copied to clipboard

The length of time from the start of the simulation to the warm-up event. Sets the length of the warm-up for this model element.

Link copied to clipboard

A flag to control if the model element reacts to initialization actions

Link copied to clipboard
open override var label: String?
Link copied to clipboard

the left traversal count for pre-order traversal of the model element tree

Link copied to clipboard

the model that contains this element

Link copied to clipboard

Returns a string representation of the model element and its child model elements. Useful for realizing the model element hierarchy.

Link copied to clipboard

A flag to control if the model element participates in monte carlo actions.

Link copied to clipboard

A collection containing the first level children of this model element

Link copied to clipboard
protected open var mySpatialModel: SpatialModel?
Link copied to clipboard
override val name: String
Link copied to clipboard

Gets the number of model elements contained by the model element.

Link copied to clipboard
Link copied to clipboard
protected val parent: ModelElement?

the parent of this model element

Link copied to clipboard
open override val parentName: String?
Link copied to clipboard

Indicates the previous status of the model element for observers of ModelElement.Status This allows the transition to be noted by observers

Link copied to clipboard

A flag to control if the model element reacts to end replication actions.

Link copied to clipboard

the right traversal count for pre-order traversal of the model element tree

Link copied to clipboard

The spatial model associated with this model element. By default, each model element uses its parent model element's spatial model unless changed via this property. This changes the spatial model for this model element and no others.

Link copied to clipboard
Link copied to clipboard
override val time: Double
Link copied to clipboard

A reference to the TimedUpdate event.

Link copied to clipboard

The time interval between TimedUpdate events. The default is zero, indicating no timed update

Link copied to clipboard

Specifies whether this model element participates in the time update event specified by its parent

Link copied to clipboard

Specifies the havingPriority of this model element's timed update event.

Link copied to clipboard
protected var warmUpEvent: KSLEvent<Nothing>?

A reference to the warm-up event

Link copied to clipboard

Indicates whether the warm-up action occurred sometime during the simulation for this model element. False indicates that the warm-up action has not occurred

Link copied to clipboard

Specifies if this model element is warmed up when the warmup action occurs for its parent. The warm-up flag indicates whether this model element will be warmed up when its parent warm-up event/action occurs. The default value for all model elements is true. A value of true implies that the model element allows its parent's warm up event to call the warm-up action. A value of false implies that the model element does not allow its parent's warm up event to call the warm-up action. False does not necessarily mean that the model element will not be warmed up. It may, through the use of the lengthOfWarmUp property, have its own warm-up event and action.

Link copied to clipboard

Specifies the priority of this model element's warm up event.

Functions

Link copied to clipboard
protected open fun afterExperiment()

This method should be overridden by subclasses that need actions performed after an experiment has been completed It is called after all replications are done and can be used to collect data from the model element, etc.

Link copied to clipboard
protected open 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
protected open 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
protected open fun beforeReplication()

This method should be overridden by subclasses that need actions performed prior to each replication. It is called prior to each replication and can be used to initialize the model element. It is called before initialize() is called.

Link copied to clipboard
fun <T> BernoulliPicker(successProbability: Double, successOption: T, failureOption: T, streamNum: Int = 0): BernoulliPicker<T>
Link copied to clipboard
fun BernoulliRV(probOfSuccess: Double, streamNum: Int = 0, name: String? = null): BernoulliRV
Link copied to clipboard
fun BetaRV(alpha1: Double, alpha2: Double, streamNum: Int = 0, name: String? = null): BetaRV
Link copied to clipboard
fun BinomialRV(pSuccess: Double, numTrials: Int, streamNum: Int = 0, name: String? = null): BinomialRV
Link copied to clipboard

Cancels the timed update event for this model element.

Link copied to clipboard

Cancels the warm-up event for this model element.

Link copied to clipboard

Checks if this model element or any model element directly above this model element in the hierarchy of model elements all the way until the top Model participates in the warm-up action.

Link copied to clipboard
fun ConstantRV(value: Double, name: String? = null): ConstantRV
Link copied to clipboard
fun day(): Double

Returns the value of a 1-day time interval in terms of the base time unit

Link copied to clipboard
fun <T> DEmpiricalList(elements: List<T>, theCDF: DoubleArray, streamNum: Int = 0): DEmpiricalList<T>
Link copied to clipboard
fun DEmpiricalRV(values: DoubleArray, cdf: DoubleArray, streamNum: Int = 0, name: String? = null): DEmpiricalRV
Link copied to clipboard
fun DPopulation(elements: DoubleArray, streamNum: Int = 0): DPopulation
Link copied to clipboard
fun <T> DUniformList(elements: MutableList<T> = mutableListOf(), streamNum: Int = 0): DUniformList<T>
Link copied to clipboard
fun DUniformRV(range: IntRange, streamNum: Int = 0, name: String? = null): DUniformRV
fun DUniformRV(min: Int, max: Int, streamNum: Int = 0, name: String? = null): DUniformRV
Link copied to clipboard
fun EmpiricalRV(data: DoubleArray, streamNum: Int = 0, name: String? = null): EmpiricalRV
fun EmpiricalRV(interval: Interval, numPoints: Int, streamNum: Int = 0, name: String? = null): EmpiricalRV
fun EmpiricalRV(lowerLimit: Double, numPoints: Int, width: Double, streamNum: Int = 0, name: String? = null): EmpiricalRV
Link copied to clipboard
fun ExponentialRV(mean: Double, streamNum: Int = 0, name: String? = null): ExponentialRV
Link copied to clipboard

Find the first parent that has its own warm-up event this guarantees that all elements below the found model element do not have their own warm-up event. A model element that has its own warm-up event also opts out of the warm-up action. If the returned parent is the Model, then all are controlled by the model (unless they opt out). Elements can opt out and not have their own warm-up event. Thus, they have no warm-up at all.

Link copied to clipboard
fun GammaRV(shape: Double, scale: Double, streamNum: Int = 0, name: String? = null): GammaRV
Link copied to clipboard
fun GeneralizedBetaRV(alpha: Double, beta: Double, min: Double, max: Double, streamNum: Int = 0, name: String? = null): GeneralizedBetaRV
Link copied to clipboard
fun GeometricRV(probOfSuccess: Double, streamNum: Int = 0, name: String? = null): GeometricRV
Link copied to clipboard

Fills up the provided collection carrying all the Counters that are contained by any model elements within this model element. In other words, any Counters that are in the model element hierarchy below this model element.

Link copied to clipboard

Gets all model elements that are contained within this model element in parent-child order within the hierarchy

Link copied to clipboard

Fills up the provided collection carrying all the RandomElementIfc and subclasses of RandomElementIfc that are contained by any model elements within this model element. In other words, any RandomElementIfc instances that are in the model element hierarchy below this model element.

Link copied to clipboard

Fills up the provided collection carrying all the response variables that are contained by any model elements within this model element. In other words, any response variables that are in the model element hierarchy below this model element.

Link copied to clipboard

Fills up the provided collection carrying all the variables that are contained by any model elements within this model element. In other words, any variables that are in the model element hierarchy below this model element.

Link copied to clipboard

Fills up the supplied StringBuilder carrying a string representation of the model element and its child model elements Useful for realizing the model element hierarchy.

Link copied to clipboard

Fills up the provided collection carrying the Counters that are contained only by this model element

Link copied to clipboard

A list containing the (child) model elements of only this model element

Link copied to clipboard

Fills up the provided collection carrying only the random variables associated carrying this element

Link copied to clipboard

Fills up the provided collection carrying the response variables that are contained only by this model element

Link copied to clipboard

Fills up the provided collection carrying only the variables associated carrying this element

Link copied to clipboard

This method returns the planned time for the warm-up for this model element.

Link copied to clipboard
fun hour(): Double

Returns the value of a 1-hour time interval in terms of the base time unit

Link copied to clipboard
fun Hyper2ExponentialRV(mixingProb: Double, mean1: Double, mean2: Double, streamNum: Int = 0, name: String? = null): Hyper2ExponentialRV
Link copied to clipboard

Fills a StringBuilder carrying the model element names in the order that they will be initialized

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

Checks if a warm-up event is scheduled for any model element directly above this model element in the hierarchy of model elements all the way until the top Model.

Link copied to clipboard

Checks if the current status is the supplied status

Link copied to clipboard

Checks if a timed update event has been scheduled for this model element

Link copied to clipboard

Checks if a warm-up event has been scheduled for this model element

Link copied to clipboard
fun JohnsonBRV(alpha: Double, beta: Double, min: Double, max: Double, streamNum: Int = 0, name: String? = null): JohnsonBRV
Link copied to clipboard
fun LaplaceRV(location: Double, scale: Double, streamNum: Int = 0, name: String? = null): LaplaceRV
Link copied to clipboard
fun LogisticRV(location: Double, scale: Double, streamNum: Int = 0, name: String? = null): LogisticRV
Link copied to clipboard
fun LogLogisticRV(shape: Double, scale: Double, streamNum: Int = 0, name: String? = null): LogLogisticRV
Link copied to clipboard
fun LognormalRV(mean: Double, variance: Double, streamNum: Int = 0, name: String? = null): LognormalRV
Link copied to clipboard

Returns the value of a 1-millisecond time interval in terms of the base time unit

Link copied to clipboard
fun minute(): Double

Returns the value of a 1-minute time interval in terms of the base time unit. For example, if the time unit is set to hours, then minute() should return 0.0166 (TIME_UNIT_MINUTE/TIME_UNIT_HOUR)

Link copied to clipboard
fun MixtureRV(list: List<RVariableIfc>, cdf: DoubleArray, streamNum: Int = 0, name: String? = null): MixtureRV
Link copied to clipboard
protected open fun montecarlo()

This method should be overridden by subclasses that need actions performed after before replication. It is called after beforeReplication but prior to afterReplication() and can be used to perform pure monte-carlo (non-event type) simulations carrying the model element

Link copied to clipboard
fun NormalRV(mean: Double, variance: Double, streamNum: Int = 0, name: String? = null): NormalRV
Link copied to clipboard

Notify the observers

Link copied to clipboard
fun PearsonType5RV(shape: Double, scale: Double, streamNum: Int = 0, name: String? = null): PearsonType5RV
Link copied to clipboard
fun PearsonType6RV(alpha1: Double, alpha2: Double, beta: Double, streamNum: Int = 0, name: String? = null): PearsonType6RV
Link copied to clipboard
fun PoissonRV(mean: Double, streamNum: Int = 0, name: String? = null): PoissonRV
Link copied to clipboard
fun PWCEmpiricalRV(histogram: HistogramIfc, streamNum: Int = 0, name: String? = null): PWCEmpiricalRV
fun PWCEmpiricalRV(breakPoints: DoubleArray, proportions: DoubleArray = DoubleArray(breakPoints.size - 1) { 1.0 / (breakPoints.size - 1) }, streamNum: Int = 0, name: String? = null): PWCEmpiricalRV
Link copied to clipboard
protected open fun registerConditionalActions()

This method should be overridden by subclasses that need to register conditional actions prior to a replication with the executive. It is called once before each replication, right after the method initialize() is called. The user can use the executive property to access the Executive

Link copied to clipboard
protected open fun removedFromModel()

This method should be overridden by subclasses that need actions performed when a model element is removed from a model

Link copied to clipboard
protected open fun replicationEnded()

This method should be overridden by subclasses that need actions performed when the replication ends and prior to the calling of afterReplication(). It is called when each replication ends and can be used to collect data from the model element, etc.

Link copied to clipboard

Creates an EventScheduler which can be used to create and schedule events on the simulation calendar reactingWith a fluency pattern.

protected fun <T> schedule(eventAction: ModelElement.EventActionIfc<T>, timeToEvent: Double, message: T? = null, priority: Int = KSLEvent.DEFAULT_PRIORITY, name: String? = null): KSLEvent<T>
protected fun <T> schedule(eventAction: ModelElement.EventActionIfc<T>, timeToEvent: GetValueIfc, message: T? = null, priority: Int = KSLEvent.DEFAULT_PRIORITY, name: String? = null): KSLEvent<T>

Allows event actions to be scheduled by model elements

Link copied to clipboard
fun second(): Double

Returns the value of a 1-second time interval in terms of the base time unit

Link copied to clipboard

Sets the after experiment option of all model elements (children) contained by this model element.

Sets the after replication flag of all model elements (children) contained by this model element.

Sets the before experiment option of all model elements (children) contained by this model element.

Sets the before replication flag of all model elements (children) contained by this model element.

Link copied to clipboard

Sets the initialization option of all model elements (children) contained by this model element.

Link copied to clipboard

Sets the monte carlo option flag of all model elements (children) contained by this model element.

Sets the end replication option flag of all model elements (children) contained by this model element. Determines whether the replicationEnded() method will be called

Link copied to clipboard

Sets the timed update option flag of all model elements (children) contained by this model element.

Link copied to clipboard

Sets the warm-up option flag of all model elements (children) contained by this model element.

Link copied to clipboard
fun ShiftedGeometricRV(probOfSuccess: Double, streamNum: Int = 0, name: String? = null): ShiftedGeometricRV
Link copied to clipboard
fun ShiftedRV(shift: Double, rv: RVariableIfc, streamNum: Int = 0, name: String? = null): ShiftedRV
Link copied to clipboard
protected fun stopReplication(msg: String? = null)

Causes the current replication to stop processing events.

Link copied to clipboard
open override fun time(): Double
Link copied to clipboard
protected open fun timedUpdate()

This method should be overridden by subclasses that need actions performed at each timed update event during each replication. It is called for each timed update during each replication if the model element reacts to timed update actions.

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
fun TriangularRV(min: Double, mode: Double, max: Double, streamNum: Int = 0, name: String? = null): TriangularRV
Link copied to clipboard
fun TruncatedNormalRV(mean: Double, variance: Double, interval: Interval, streamNum: Int = 0, name: String? = null): TruncatedNormalRV
Link copied to clipboard
fun TruncatedRV(distribution: InvertibleCDFIfc, cdfLL: Double, cdfUL: Double, lowerLimit: Double, upperLimit: Double, streamNum: Int = 0, name: String? = null): TruncatedRV
Link copied to clipboard
fun UniformRV(interval: Interval, streamNum: Int = 0, name: String? = null): UniformRV
fun UniformRV(min: Double, max: Double, streamNum: Int = 0, name: String? = null): UniformRV
Link copied to clipboard
protected fun update()

The update method can be called at reactor defined points to indicate that the model element has been changed in some fashion that the update status observers need notification. This method ensures that each contained model element that requires an update action will perform its actions.

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

Link copied to clipboard
fun week(): Double

Returns the value of a 1-week time interval in terms of the base time unit

Link copied to clipboard
fun WeibullRV(shape: Double, scale: Double, streamNum: Int = 0, name: String? = null): WeibullRV