Integral retrieval - query example
- Last UpdatedFeb 06, 2025
- 1 minute read
To use the integral retrieval mode, set the following parameter in your query.
wwRetrievalMode = 'Integral'
In this example, the integral is computed for each of five 1-minute long cycles. The wwQualityRule parameter is used to ensure that only points with good quality are used in the computation, which means that points with doubtful quality are discarded. The rules used to determine the returned OPCQuality are the same as described for a time weighted average query.
SELECT DateTime, TagName, CONVERT(DECIMAL(10, 2), Value) AS Flow, OPCQuality, PercentGood FROM History
WHERE TagName = 'FlowRate'
AND DateTime >= '2004-06-07 08:00'
AND DateTime < '2004-06-07 08:05'
AND wwRetrievalMode = 'Integral'
AND wwCycleCount = 5
AND wwQualityRule = 'Good'
The results are:
|
|
DateTime |
TagName |
Flow |
OPCQuality |
PercentGood |
|---|---|---|---|---|---|
|
(interval 1) |
2004-06-07 08:00:00.000 |
FlowRate |
2862.97 |
192 |
100.0 |
|
(interval 2) |
2004-06-07 08:01:00.000 |
FlowRate |
9436.85 |
192 |
100.0 |
|
(interval 3) |
2004-06-07 08:02:00.000 |
FlowRate |
2480.24 |
192 |
100.0 |
|
(interval 4) |
2004-06-07 08:03:00.000 |
FlowRate |
7379.71 |
192 |
100.0 |
|
(interval 5) |
2004-06-07 08:04:00.000 |
FlowRate |
6317.32 |
192 |
100.0 |
Also, the "phantom" cycle affects the integral retrieval mode just as it does the average retrieval mode. For examples, see Querying aggregate data in different ways.