SlidingWindow (BSlidingWindowBlock)

This block produces a trend where each value represents a rollup of all the prior values for a duration of time, referred to as the window. The block only requires a single value within the window to produce a result.

For value requests, the block processes a trend request using the block’s Window property value to calculate a time range, where the time range start = current station time - window and time range end = current station time. In this case, you would expect the window to likely contain multiple records.

For trend requests, the block iterates through each of the records keeping track of the previous records within the window. It calculates the time range as it evaluates each record where time range start = current record timestamp - window and time range end = current record timestamp. When a trend request processes the first record there are no available past records within the window so the request passes over the first record value, but as it processes subsequent records, it likely processes multiple records whose timestamps are within the calculated window.

Image

To view these properties, double-click the block on the Wire Sheet or the block name in the Nav tree.

Property Value Description
Out read-only value slot Outputs a trend where each value represents a rollup of all the prior values for a duration of time as defined by the Window property.
Trend In required value slot Links from the output of other logic blocks or data sources to supply trend data to the current logic block.
Rollup check box (if optional, and) drop-down list or ORD parameter (when configured in the data definition, defaults to First, when configured elsewhere, defaults to the value as defined in the Data Definition); rollup=option For trend requests, configures the rollup function used when the block’s Use Request Rollup property is false or the Rollup property is not explicitly configured in the request.

For value requests, always uses the block’s Rollup property regardless of the value of the block’s Use Request Rollup property or whether the Rollup property is explicitly configured in the request.

If rollup is not enabled in the binding/settings window, the rollup value configured in the Data Definition applies to all chart bindings, reports and tables.

And returns the logical “and” of Boolean values.

Avg returns the statistical mean, which is determined by calculating the sum of all values and dividing by the number of values.

Count returns the total number or quantity of values in a combination. If you request this value on a binding in a PX view, the system counts the number of values based on the properties defined by the data source block and the algorithm’s Property Sheet.

First returns the first value in the combination.

Last returns the last value in the combination.

Max returns the highest value in the combination.

Median returns the value in the middle of a sorted combination—the number that separates the higher half from the lower half.

Min returns the lowest value in the combination.

Mode returns the statistically most frequently occurring number in the combination.

Or returns the logical “or” of Boolean values.

Range returns the statistical difference between the largest and smallest values in the combination.

Sum adds together all values in the combination resulting in a single value.

Std Dev calculates the standard deviation of the values in the combination.

Load Factor calculates the average divided by peak (Max) value.

Use Request Rollup true or false (default) Determines the rollup function to use for trend requests.

true causes the block to use the function defined by the incoming request. If Time Range is not configured in the request, the block uses its Time Range property.

false causes the block to use the function defined in the block’s Rollup property.

Window hours minutes seconds milliseconds (defaults to 1 hour) Configures the duration of time used in the rollup calculation.

Examples

When processing a trend request, this block:

  • does not wait until the window of time is full of records before outputting a result. The first record that it processes may generate a fault condition even though the block is only considering a single record. Once the algorithm iterates through enough records, based on the interval configured for history records, request interval, or SWB window time, the block will likely be evaluating multiple records. A trend request could detect a nuisance fault condition if the first few records meet the criteria before getting the full window time.
  • subtracts one millisecond from the window value before calculating the earliest record time. This makes it exclude the earliest record that most people might expect to be included. For example, if the window is 30 minutes, the interval is 15 minutes and the current record timestamp is 11:00 am, the block only considers the 10:45 am and 11:00 am records because the 10:30 am record is one millisecond before the calculated time.
Figure 145.   Sliding Window algorithm
Image

The screen captures illustrate the Sliding Window behavior where the initial record value is 40 so the BiSwitch output is true and the Sliding Window Rollup = And, so it passes a true output even though there is only one record at that point in the 45 minute window.

Figure 146.   Sliding Window example data
Image

Processing with Use Request Rollup

When Use Request Rollup is false and Rollup is not configured, the block uses the rollup function defined in the applicable Data Definition. If there is no Data Definition, the block uses the default First function. When Use Request Rollup is false and Rollup property is configured, the block uses the Rollup property value. When Use Request Rollup is true, the block uses the rollup function defined in the request (Analytic Proxy Ext, Analytic Binding, etc.), unless the request does not specify the rollup function in which case the block uses the Algorithm’s Rollup property value.

The following table may help to determine when each value applies.

Data Definition Rollup Data Source Block Use Request Rollup Data Source Block Rollup Request Rollup Algorithm Rollup Actual Rollup Function
Unconfigured False Unconfigured Sum Max Defaults to First
Last False Unconfigured Sum Max Last
Last False Avg Sum Max Avg
Last True Avg Sum Max Sum
Last True Avg Unconfigured Max Max