Simulation Aids Module by Automation Professionals
E-Mail Support

Simulation / recorder

Given a sample interval, row count limit, and sample values, return a dataset constructed from snapshots of the values at the requested interval. Discards the oldest row when the row limit is reached. Will not over-sample when values change faster than requested. When used in an expression tag, the scan class may override the requested poll rate.

Syntax

recorder(pollRate, rowLimit, {sourceDataset | columnName, columnValue} ...) returns Dataset

ArgumentData TypeDescription
pollRateIntegerMilliseconds between snapshots, or zero to pause recording.
rowLimitIntegerTotal number of rows to hold in the recorder.
sourceDatasetDatasetOptional nested list of column names and values to record. If the nested dataset has precisely two columns, named "name" and "value" respectively, result column names and values are taken from its rows. Otherwise, its column names and first row values are used.
columnNameStringColumn name to use in the recording for the following columnValue.
columnValueObjectValue of any type usable within datasets. Required after a column name string argument.

Usage Notes

The accumulated recording is held in a state variable in this function. Editing the binding replaces the function, discarding this state, which discards the recording. Supply a custom property to the pollRate argument if you wish to stop and start recordings without losing any data. Similarly, use nested dataset(s) with your values if you wish to add or remove columns on the fly.

Due to restrictions imposed by the platform, poll rates below 100ms will execute at 100ms. Also, when changing the poll rate, the next sample will occur at the end of the new rate's delay.