Slope retrieval - query example
- Last UpdatedFeb 06, 2025
- 1 minute read
To use the slope retrieval mode, set the following parameter in your query.
wwRetrievalMode = 'Slope'
For example, the following query calculates and returns the rate of change of the ReactTemp tag in °C/second. The initial value in the Quality column at the query start time shows no value is located exactly at that time, so the slope returned is the same as the one returned at the next delta point. (For more information on initial values, see Determining cycle boundaries.)
At 08:01:17.947 the tag has two delta points, so a slope is calculated and returned for the first point, while a NULL is returned at the second one with a special QualityDetail of 17, indicating that no slope can be calculated as it is either plus or minus infinite.
SELECT DateTime, TagName, CONVERT(DECIMAL(10, 4), Value) AS Slope, Quality, QualityDetail FROM History
WHERE TagName = 'ReactTemp'
AND DateTime >= '2005-04-17 08:00'
AND DateTime <= '2005-04-17 08:05'
AND wwRetrievalMode = 'Slope'
The results are:
|
DateTime |
TagName |
Slope |
Quality |
QualityDetail |
|---|---|---|---|---|
|
2005-04-17 08:00:00.000 |
ReactTemp |
3.8110 |
133 |
192 |
|
2005-04-17 08:00:00.510 |
ReactTemp |
3.8110 |
0 |
192 |
|
2005-04-17 08:00:01.713 |
ReactTemp |
4.1563 |
0 |
192 |
|
2005-04-17 08:00:02.917 |
ReactTemp |
4.1563 |
0 |
192 |
|
2005-04-17 08:00:04.230 |
ReactTemp |
3.8081 |
0 |
192 |
|
2005-04-17 08:00:05.433 |
ReactTemp |
4.1563 |
0 |
192 |
|
… |
… |
… |
||
|
2005-04-17 08:01:16.743 |
ReactTemp |
-1.7517 |
0 |
192 |
|
2005-04-17 08:01:17.947 |
ReactTemp |
-27.0158 |
0 |
192 |
|
2005-04-17 08:01:17.947 |
ReactTemp |
NULL |
1 |
17 |
|
2005-04-17 08:01:19.260 |
ReactTemp |
-1.7530 |
0 |
192 |
|
2005-04-17 08:01:20.463 |
ReactTemp |
-1.9119 |
0 |
192 |
|
2005-04-17 08:01:21.667 |
ReactTemp |
-1.9119 |
0 |
192 |
|
2005-04-17 08:01:22.977 |
ReactTemp |
-1.7517 |
0 |
192 |
|
… |
… |
… |