ValueState retrieval query 5
- Last UpdatedFeb 06, 2025
- 1 minute read
The following query returns the percentage of time in state for a discrete tag for multiple retrieval cycles. The TimeStampRule system parameter is set to "End" (the default setting), so the returned values are timestamped at the end of the cycle. Note that the first row returned represents the results for the period starting at 2003-07-03 22:00:00.000 and ending at 2003-07-04 00:00:00.000.
The "Percent" time-in-state retrieval mode is the only mode in which the StateTime column does not return time data. Instead, it returns percentage data (in the range of 0 to 100 percent) representing the percentage of time in state.
SELECT DateTime, vValue, StateTime, wwStateCalc FROM History
WHERE DateTime >= '2003-07-04 00:00:00.000'
AND DateTime <= '2003-07-05 00:00:00.000'
AND TagName IN ('PumpStatus')
AND Value = 1
AND wwRetrievalMode = 'ValueState'
AND wwStateCalc = 'Percent'
AND wwCycleCount = 13
The results are:
|
DateTime |
vValue |
StateTime |
wwStateCalc |
|---|---|---|---|
|
2003-07-04 00:00:00 |
1 |
50.885 |
PERCENT |
|
2003-07-04 02:00:00 |
1 |
82.656 |
PERCENT |
|
2003-07-04 04:00:00 |
1 |
7.082 |
PERCENT |
|
2003-07-04 06:00:00 |
1 |
7.157 |
PERCENT |
|
2003-07-04 08:00:00 |
1 |
55.580 |
PERCENT |
|
2003-07-04 10:00:00 |
1 |
28.047 |
PERCENT |
|
2003-07-04 12:00:00 |
1 |
47.562 |
PERCENT |
|
2003-07-04 14:00:00 |
1 |
74.477 |
PERCENT |
|
2003-07-04 16:00:00 |
1 |
40.450 |
PERCENT |
|
2003-07-04 18:00:00 |
1 |
78.313 |
PERCENT |
|
2003-07-04 20:00:00 |
1 |
54.886 |
PERCENT |
|
2003-07-04 22:00:00 |
1 |
39.569 |
PERCENT |
|
2003-07-05 00:00:00 |
1 |
50.072 |
PERCENT |