Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Historian

ValueState retrieval query 4

  • Last UpdatedFeb 06, 2025
  • 1 minute read

The following query returns the total of time in state for a discrete tag. In this example, the TimeStampRule system parameter is set to "End" (the default setting), so the returned values are timestamped at the end of the cycle. The returned rows represent the time-in-state behavior during the period starting at 2005-04-13 00:00:00.000 and ending at 2005-04-14 00:00:00.000.

SELECT DateTime, vValue, StateTime, wwStateCalc FROM History

WHERE DateTime > '2005-04-13 00:00:00.000'

AND DateTime <= '2005-04-14 00:00:00.000'

AND TagName IN ('PumpStatus')

AND wwRetrievalMode = 'ValueState'

AND wwStateCalc = 'Total'

AND wwCycleCount = 1

The results are:

DateTime

vValue

StateTime

wwStateCalc

2005-04-14 00:00:00

NULL

1041674.0

TOTAL

2005-04-14 00:00:00

On

56337454.0

TOTAL

2005-04-14 00:00:00

Off

29020872.0

TOTAL

TitleResults for “How to create a CRG?”Also Available in