A class that represents a tracked variable.
Tracked Variables can be defined as global for the model, or they can be stored on an object, table or label.average | Gets the average value of the tracked variable. |
count | Gets the number of times the tracked variable has been set. |
history | Gets the table of profiles for the tracked variable. |
lowerBound | Gets or sets the lower bound of the tracked variable. |
maximum | Gets the maximum value of the tracked variable. |
minimum | Gets the minimum value of the tracked variable. |
profile | Gets the table of profiles for the tracked variable. |
rate | Gets or sets the current rate of the tracked variable. |
type | Gets the type of the tracked variable. |
upperBound | Gets or sets the upper bound of the tracked variable. |
value | Gets or sets the current value of the tracked variable. |
valueString | Gets or sets the current value of the categorical tracked variable. |
getCategoryName | Gets the name of a category from a categorical tracked variable. |
getTotalTimeAt | Gets the total time the tracked variable as been at the specified categorical value. |
reset | Resets the tracked variable. |
init | Asserts tracked variable data on a node with the designated type and start value. |
TrackedVariable | Creates a reference to a global tracked variable. |
init | Asserts tracked variable data on a node with the designated type and start value. |
readonly double average
Gets the average value of the tracked variable.
The average value is not available for Categorical and Cumulative type tracked variables. See the type property for more information.double average = trackedVariable.average;
readonly int count
Gets the number of times the tracked variable has been set.
int count = trackedVariable.count;
readonly Table history
Gets the table of profiles for the tracked variable.
The history property is only available if the tracked variable flags is set to STAT_USE_HISTORY. See the init method for information on tracked variable flags.
Table history = trackedVariable.history;
double time = history[1][1];
double value = history[1][2];
double rate = history[1][3]; //Kinetic type
double lowerBound
Gets or sets the lower bound of the tracked variable.
The lowerBound property is only available for Kinetic type tracked variables. When setting the lower bound, the lower bound must be less than the current value of the tracked variable.
double lower = trackedVariable.lowerBound;
trackedVariable.lowerBound = -100;
readonly double maximum
Gets the maximum value of the tracked variable.
double maximum = trackedVariable.maximum;
readonly double minimum
Gets the minimum value of the tracked variable.
double minimum = trackedVariable.minimum;
readonly Table profile
Gets the table of profiles for the tracked variable.
The profile property is only available for Categorical type tracked variables.
Table profile = trackedVariable.profile;
string name = profile[2][1];
double value = profile[2][2];
double rate
Gets or sets the current rate of the tracked variable.
The rate property is only available for Kinetic type tracked variables. See the type property for more information.
double rate = trackedVariable.rate;
trackedVariable.rate = 1.5;
readonly int type
Gets the type of the tracked variable.
The type affects what meta data, like average, will be collected, and how it is calculated. Type can be one of the following values:int type = trackedVariable.type;
double upperBound
Gets or sets the upper bound of the tracked variable.
The upperBound property is only available for Kinetic type tracked variables. When setting the upper bound, the upper bound must be greater than the current value of the tracked variable.
double upper = trackedVariable.upperBound;
trackedVariable.upperBound = 100;
Variant value
Gets or sets the current value of the tracked variable.
The value of the tracked variable should be a number or it may be a string for categorical type tracked variables.
double value = trackedVariable.value;
trackedVariable.value = 32;
trackedVariable.value = "processing"; //Categorical type only
Variant valueString
Gets or sets the current value of the categorical tracked variable.
The valueString is only available for the categorical type tracked variables.
string valueStr = trackedVariable.valueString;
trackedVariable.valueString = "processing";
string getCategoryName( int catNum ) |
catNum | The category number to get the name of. |
Gets the name of a category from a categorical tracked variable.
string name = trackedVariable.getCategoryName(1);
double getTotalTimeAt( Variant value ) |
value | Value should be either the name of the category value to get, or the index number of the category. |
Gets the total time the tracked variable as been at the specified categorical value.
The getTotalTimeAt method is only available for Categorical type tracked variables.
double processingTime = trackedVariable.getTotalTimeAt("processing");
double processingTime = trackedVariable.getTotalTimeAt(2);
reset( double startValue = 0.0 , int type = -1 ) |
startValue | The start value of the tracked variable. |
type | If no value is defined, the tracked variable will keep its original type. See the type property for more information. |
Resets the tracked variable.
trackedVariable.reset();
trackedVariable.reset(10);
trackedVariable.reset(0, STAT_TYPE_LEVEL);
static init( treenode theNode , int type , double startValue = 0 , int flags = -1 ) |
theNode | The node to assert the tracked variable data on. |
type | Defines the tracked variable type. See the type property for more information. |
startValue | The starting value of the tracked variable. If the tracked variable presists when the model is reset, this will be the reset value. |
flags | Specifies options for this tracked variable. The flags can be a bitwise
combination of the following three values. By default, none of these options are used: STAT_USE_HISTORY - the tracked variable will keep a history of each value it hold, and the time at which the value is set. STAT_USE_PROFILE - the tracked variable will track a profile of the total time spent at each value. This only works if the set of used values are non-negative integers. STAT_IGNORE_WARMUP - the tracked variable will ignore the resetstats() command. Use this option only if the tracked variable should keep the data collected during warmup time. |
Asserts tracked variable data on a node with the designated type and start value.
TrackedVariable newTV = TrackedVariable.init(aNode, STAT_TYPE_TIME_SERIES, 0.0, STAT_USE_HISTORY | STAT_IGNORE_WARMUP);
TrackedVariable( string name ) |
name | The name of the global tracked variable. |
Creates a reference to a global tracked variable.
TrackedVariable wip = TrackedVariable("WorkInProgress");
static init( treenode theNode , int type , double startValue = 0 , int flags = -1 ) |
theNode | The node to assert the tracked variable data on. |
type | Defines the tracked variable type. See the type property for more information. |
startValue | The starting value of the tracked variable. If the tracked variable presists when the model is reset, this will be the reset value. |
flags | Specifies options for this tracked variable. The flags can be a bitwise
combination of the following three values. By default, none of these options are used: STAT_USE_HISTORY - the tracked variable will keep a history of each value it hold, and the time at which the value is set. STAT_USE_PROFILE - the tracked variable will track a profile of the total time spent at each value. This only works if the set of used values are non-negative integers. STAT_IGNORE_WARMUP - the tracked variable will ignore the resetstats() command. Use this option only if the tracked variable should keep the data collected during warmup time. |
Asserts tracked variable data on a node with the designated type and start value.
TrackedVariable newTV = TrackedVariable.init(aNode, STAT_TYPE_TIME_SERIES, 0.0, STAT_USE_HISTORY | STAT_IGNORE_WARMUP);