Cross Correlation block
This block calculates a time-weighted moving cross correlation of two input variables.
Cross Correlation block
Description
The output of the block is the moving cross correlation between two input variables calculated over the last T seconds. The moving cross correlation is thus calculated over a time window of fixed span (width). The window moves forward as time progresses with the one end anchored to current time.
The cross correlation, RXY, between two variables, X and Y, is calculated over the time window as follows: RXY = ∑i Xi Yi. The larger the absolute value of RXY, the higher the correlation. A value of 0 indicates no correlation.
Cross correlation is one way to evaluate the relative correlations between several variables. For example, the relative values of two cross correlations, say RXY and RXZ, indicates whether X is more correlated on Y or Z.
Note that the cross correlation function does not adjust for the averages of the two variables over the time window, i.e. it does not first make them zero-average by subtracting their respective averages before calculating the cross correlation. The covariance function does the latter. In the case where the two variables are zero-mean, the cross correlation and covariance functions are identical.
Cross correlation block
Block Type
Statistical block
Input/Output ports
Both input ports can have only fields of type double. The number of outputs is determined by the configuration.
In order for this block to run, both input ports must be connected to sources that only have fields of type double. The window span must also be larger than 0 seconds.
Functions performed on tags
-
On the values - The value is the cross correlation of the two configured input fields over the window span.
-
On the timestamp - The output time stamp is always set to the execute time.
-
On the quality - The quality is set based on the quality threshold. The quality level is calculated as the number of seconds that both the signals had good quality over the window. This quality level is expressed as a percentage of the window span. If the quality level is less that the quality threshold, the output quality is set to bad, otherwise it is good.
Example
-
Sample period = 60s
-
Window span = 300s
-
Quality threshold = 80%
Time Stamps |
Process Variable X |
Process Variable Y |
Cross Correlation |
Cross Correlation Quality |
02/03/26 12:37 |
23 |
87 |
2001.0 |
0 |
02/03/26 12:38 |
12 |
34 |
400.2 |
0 |
02/03/26 12:39 |
44 |
23 |
481.8 |
0 |
02/03/26 12:40 |
34 |
54 |
684.2 |
0 |
02/03/26 12:41 |
26 |
71 |
1051.4 |
1 |
02/03/26 12:42 |
62 |
8 |
1420.6 |
1 |
02/03/26 12:43 |
17 |
29 |
1119.6 |
1 |
02/03/26 12:44 |
45 |
34 |
1136.6 |
1 |
02/03/26 12:45 |
78 |
67 |
1240.2 |
1 |
02/03/26 12:46 |
18 |
83 |
1918.2 |
1 |
02/03/26 12:47 |
22 |
61 |
1847.8 |
1 |
02/03/26 12:48 |
70 |
49 |
2017.0 |
1 |
02/03/26 12:49 |
10 |
13 |
2604.4 |
1 |
02/03/26 12:50 |
21 |
26 |
2324.4 |
1 |
02/03/26 12:51 |
39 |
31 |
1388.4 |
1 |
Example of processing by Cross Correlation block
Related topics: