Statistics are calculated for each of the data collector monitors. These statistics can be accessed via predefined functions for each data collector monitor. In the following, we assume that a data collector monitor with the ML name `DC`

has been created.

The following functions can be used for data collector monitors that calculate either untimed or timed statistics. See calculating statistics for more information about untimed and timed statistics.

returns the number times values have been added to the monitor**DC.count**()

returns the minimum of the observed values**DC.min**()

returns the maximum of the observed values**DC.max**()

returns the sum of the observed values**DC.sum**()

returns the average of the observed values**DC.avrg**()

returns the variance of the observed values**DC.vari**()

returns the standard deviation of the observed values**DC.std**()

returns the sum of the squares of the observed values**DC.ss**()

returns the sum of the squares of deviation of the observed values**DC.ssd**()

returns a record containing the**DC.ci**(i)`i%`

confidence interval average of the observed values.`i`

must be 90,95, or 99.

returns the value that was observed first**DC.first**()

returns the most recently observed value**DC.last**()

returns the ML name of the monitor together with a record with all of the statistics for the monitor as strings**DC.get_stat_strings**()

The following functions are also available for data collector monitors that calculate timed statistics

returns the model time at which the first value was observed**DC.starttime**()

returns the model time at which the most recent value was observed**DC.lasttime**()

returns the amount of model time that has elapsed since the monitor was first updated**DC.interval**()

## Return types

The type of the value that is returned by the functions above often depends on the type of the values returned by the observation function for the monitor.

Note that when an observation function returns integer values, the values are converted to infinite integers, i.e. `IntInf.int`

, in order to avoid `Overflow`

exceptions. This means that several of the functions mentioned above, such as `DC.min`

and `DC.sum`

, will return values of type `IntInf.int`

rather than values of type `int`

.

This table provides an overview of the types of the values returned by the functions above. The first row of the table indicates the type of the values returned by the observation function of the monitor.

real | int or IntInf.int | |
---|---|---|

`DC.avrg` | real | real |

`DC.count` | int | int |

`DC.first` | real | IntInf.int |

`DC.last` | real | IntInf.int |

`DC.max` | real | IntInf.int |

`DC.min` | real | IntInf.int |

`DC.ss` | real | IntInf.int |

`DC.ssd` | real | real |

`DC.std` | real | real |

`DC.sum` | real | IntInf.int |

`DC.vari` | real | real |

`DC.ci` | {avrg : real, half_length : real option, lower_endpoint : real option, percentage : int, upper_endpoint : real option} | {avrg : real, half_length : real option, lower_endpoint : real option, percentage : int, upper_endpoint : real option} |

## Examples of use

Suppose a Count Transition Occurrences Monitor has been defined for the Simple Protocol net.

The `count`

function this data collector could be used in a predicate function for generic breakpoint monitor to stop a simulation when the `Receive_Packet`

transition has occurred 5 times.

let

fun predBindElem (Top’Receive_Packet (1, {k,n,p,str})) =

Count_trans_occur_Top’Receive_Packet_1.count() = 5

| predBindElem _ = false

in

predBindElem bindelem

end

The following can be used to access the 95% confidence interval for the `Queue_Delay`

monitor for the example net of the Queue System.

Queue_Delay.ci(95)

Here are examples of the kind of values that are returned by the `ci`

function:

{avrg=55.5,half_length=SOME 705.183,lower_endpoint=SOME 760.683,

percentage=95,upper_endpoint=SOME ~649.683}{avrg=0.0,half_length=NONE,lower_endpoint=NONE,percentage=95,

upper_endpoint=NONE}

## Related pages

Performance analysis, Calculating statistics, Data collector monitors, Data collector monitoring functions

You must be logged in to post a comment.