Package-level declarations

Types

Link copied to clipboard
data class ControlData(val key: String, val value: Double, val lowerBound: Double, val upperBound: Double, val comment: String, val controlType: ControlType, val elementType: String, val elementName: String, val modelName: String)

A data class for transferring the data associated with a control.

Link copied to clipboard
interface ControlIfc

A control represents an element within a model that can be changed by the user. Every control has a type (DOUBLE, INTEGER, LONG, FLOAT, SHORT, BYTE, BOOLEAN). The value of the control can be set by the user. If the supplied value is not within the allowed range of the control, the value will be limited to within the range. If the user assigns the value of the control to less than the lower bound, then the value is set to the lower bound. If the user assigns the value greater than the upper bound, then the value is set at the upper bound. For example, suppose the lower bound of the control is 1.0 and the upper bound is 10.0. Setting the control value to 0.0, will set the control to 1.0. Setting the control value to 12.0, will set the control to 10.0. Thus, out of range values are not permitted and corrected (silently). The limitToRange() function can be used to inspect the value that will result if the control is set to the supplied value.

Link copied to clipboard
class Controls(aModel: Model)

This class holds the controls associated with an instance of a model. The controls can be accessed via their key names. The following functions are useful when accessing controls.

Link copied to clipboard

Defines the set of valid control types. The valid types are (DOUBLE, INTEGER, LONG, FLOAT, SHORT, BYTE, BOOLEAN). All control types are ultimately coerced to type Double, with BOOLEAN mapping true to 1.0 and false to 0.0.

Link copied to clipboard
annotation class KSLControl(val controlType: ControlType, val name: String = "", val lowerBound: Double = Double.NEGATIVE_INFINITY, val upperBound: Double = Double.POSITIVE_INFINITY, val comment: String = "", val include: Boolean = true)

A KSLControl annotation is used on the setter method of properties within model elements to indicate that those properties should be used to control the execution of the simulation model. The annotation field type must be supplied and must be one of the valid control types as specified by the enum ControlType. The user is responsible for making sure that the type field matches (or is consistent with) the type of the property. Even though the optional annotation fields (lowerBound and upperBound) are specified as double values, they will be converted to an appropriate value for the specified type. Boolean properties are represented as a 1.0 (true) and 0.0 (false) within the numerical conversion for the controls. If a control is BOOLEAN, then the user can supply a 1.0 to represent true and a 0.0 to represent false when setting the control, which will then be set to true or false, appropriately.