MovingStatistics¶
A processing block for calculating moving statistics of a signal and detecting anomalies based on dynamically caluclated thresholds.
The moving statistic processing block can be found in the ‘Templates’ feature in the PMP installer.
Description¶
The top level routing of the processing block is shown in MovingStatistics processing block routing.
Exponentially Weighted Statistics¶
The mean value, variance and standard deviation of a signal are calculated via an exponentially weighted moving average filter.
The smoothing of the filter can be adjusted via the smoothing factor signal \(\alpha\), with \(0 < \alpha < 1\). A lower \(\alpha\) value provides more filtering, and thus a smoother mean value. The smoothing factor is typically calculated from the desired time constant \(\tau\). The time constant is defined as the amount of time for the mean to reach approximately 63.2% of the original signal value after a step reponse. The relation between the time constant and smoothing factor is:
The initial condition for the variance is \(Variance_0 = X_0^2 / (1 - \alpha)\) in order to prevent false positives during start.
Threshold Detection¶
The upper and lower threshold for detecting anomalies are automatically determined based on the mean value and standard deviation of the signal. The thresholds can be modified via the tolerance signal:
When the signal value exceeds the upper or lower threshold the ThresholdExceeded event is triggered. The ThresholdExceededCount signal is raised by 1 for each sample the ThresholdExceeded event is active. The ThresholdExceededCount can be reset via the ThresholdExceededCountReset signal.
Interface¶
Read only signals¶
Name |
Description |
---|---|
Mean |
Exponentially weighted moving mean of X. |
Variance |
Exponentially weighted moving variance of X. |
StandardDeviation |
Exponentially weighted moving standard deviation of X. |
UpperThreshold |
Upper threshold for ThresholdExceeeded detection. |
LowerThreshold |
Lower threshold for ThresholdExceeeded detection. |
ThresholdExceededCount |
Number of samples the upper or lower threshold is exceeded since last reset. |