OPC Historic Aggregates (Algorithms)
OPC historic aggregates are calculations that can be applied to sets of historic data. For example, you can use the 'Max' OPC historic aggregates to calculate the maximum value in a set of historic data.
To avoid confusion with database aggregates, we refer to the calculations that can be performed on historic data as historic algorithms. But in the OPC standard, these calculations are called OPC Historic Aggregates.
The table below lists the Algorithm options. With some of the options, you can access further information by clicking on the entry in the Algorithm column.
Take care when entering the names of algorithms manually. Use the table below to determine whether the algorithm names comprise single words, multiple words with spaces, or are camel case (also known as 'medial capitals').
Algorithm Option | Algorithm | Description |
---|---|---|
1 Hour Moving Average |
The average value over an hour period that starts at the beginning of the sample. |
|
24 Hour Moving Average |
The average value over a 24 hour period that starts at the beginning of the sample. |
|
8 Hour Moving Average |
The average value over an 8 hour period that starts at the beginning of the sample. |
|
Average including last interpolated value |
The average of the values in the sample. The average includes the interpolated value at the start of the interval. |
|
Average including last value |
The average of the values in the sample. The average includes the last value reported before the start of the interval. |
|
Average of absolute differences between consecutive values |
Moving Range |
The sum of the absolute differences between each pair of values in the sample. |
Average of values |
The average value of the values in sample (the sum of the values divided by the number of values). |
|
Count of values |
The number of raw values in the sample. |
|
Difference of first and last value |
Delta |
The last value minus the first value in the block of data. Produces a zero value if both values are the same; a negative value if the last value is smaller than the first; and a positive value if the last value is larger than the first. |
Difference of maximum and minimum value |
Range |
The difference between the maximum value and the minimum value in the sample. If only one value exists in the sample, a zero value is returned. |
Duration in which data is bad |
DurBad |
The duration (in seconds) of bad data in the sample. (Values for which the quality is Uncertain are not included.) |
Duration in which data is good |
DurGood |
The duration (in seconds) of good data in the sample. |
Interpolated value |
This is a calculation to estimate a value that is not included in the sample. ClearSCADA uses straight line (linear) interpolation to calculate an interpolated value at the start of the specified interval. ClearSCADA estimates the interpolated value using the last known value before the start of the interval, and the first known value after the start of the interval. |
|
Last value in the data for the interval |
End Last |
The last good quality value in the sample (sample). |
Maximum including last interpolated value |
The largest value in the sample (including the interpolated value at the start of the interval). |
|
Maximum including last value |
The largest value in the sample (including the last known value before the start of the interval). |
|
Maximum value |
The largest value within the sample. |
|
Maximum value and time stamp |
The largest value within the sample. The value is time stamped with the time at which it occurred. (The time is not displayed on Mimics or Data Grids, and so on.) |
|
Minimum including last interpolated value |
The smallest value within the sample, including the interpolated value at the start of the interval. |
|
Minimum including last value |
The smallest value within the sample, including the last known value before the start of the interval. |
|
Minimum value |
The smallest value within the sample. |
|
Minimum value and time stamp |
The smallest value within the sample. The value is time stamped with the time at which it occurred. (The time is not displayed on Mimics or Data Grids, and so on.) |
|
Percent in which data is bad |
PerBad |
The percentage of the data interval during which the quality of data is Bad. |
Percent in which data is good |
PerGood |
The percentage of the data interval during which the quality of data is Good. (1 = 100%) |
Standard deviation of values |
The 'spread' of the values about their mean value. |
|
Stepped analog |
Stepped |
Returns the last value before the start of the specified interval. This aggregate is included for backwards compatibility with old-style Trends. |
Sum of values |
The sum of the historic values in the sample. |
|
Time-weighted average |
An average value for the sample, taking into consideration the amount of time the data source remained in each value. |
|
Totalized value (Time Integral) |
The totalized value of the data in the sample. |
|
Value at end of the interval |
End |
The last value in the sample. |
Value at start of the interval |
Start |
The first value in the sample. |
Variance of values |
The square of the standard deviation of the values. |
For more information on how the algorithms are calculated, which values are included in a sample, and how time stamps are applied to processed historic values, see Built-In Historic Algorithms for Processed Historic Data in the ClearSCADA Guide to Trends.
Example: Referencing an OPC Historic Tag in an Expression
The tag for calculating the average value of an analog point, AIP4 within the group 'SCADAPack Modbus Direct' (itself within the group 'SCADAPack Modbus Group'), over a 2-hour period, starting three hours ago is:
"SCADAPack Modbus Group.SCADAPack Modbus Direct.AIP4;Average;H-3H;2H"
You can enter this tag manually, by typing it into the Expression window, or you can use the Select Historic Tag window to locate the data source and specify the required parameters for the tag.
ClearSCADA also supports any custom historic algorithms that have been created on your system (see Historic Algorithms (Custom) in the ClearSCADA Guide to Server Administration). When you are configuring a Historic item, any custom historic algorithms are included in the list of available algorithms.