Scenario 7: Pinpoint reasons for downtime
- Last UpdatedMar 18, 2021
- 3 minute read
You can use State Summary information to help you answer questions like:
-
How much downtime was due to feeder jams?
-
What else is causing downtime?
What is State Summary Data?
State summary data summarizes the states of a tag value. You can use this to analyze process variables with a limited number of states, such as a machine’s state of running/starting/stopping/off or a string that represents a downtime reason.
For each distinct state within a cycle, state summary replication also provides:
-
Total time
-
Percent of the cycle
-
Shortest time
-
Longest time
-
Average time
Using the StateSummaryHistory View
You can use the StateSummaryHistory view to retrieve state summary data.
A state summary results in a series of values, each representing a different state, for the same tag and time period. You configure the maximum states when you create the state summary tag. For more information, see State Summary Replication in the AVEVA Historian Administration Guide.
Example: Querying to Pinpoint Downtime
Suppose you know ahead of time what the likely causes for downtime might be in your plant. You could create a string or integer tag that identifies those causes. Then you can use a query like this one to track actual reasons for downtime in your facility:
SELECT DateTime, TagName, vValue, StateTime, OPCQuality AS 'OPC', PercentGood AS '%Good'
FROM History
WHERE TagName like 'Downtime.Status'
AND DateTime >= '2015-10-07 0:00'
AND DateTime < '2015-10-08 0:00'
AND wwRetrievalMode = 'ValueState'
AND wwTimeStampRule='start'
AND wwStateCalc='percentcontained'
AND wwCycleCount = 1
ORDER BY StateTime DESC
The results of this query are:
|
DateTime |
TagName |
vValue |
StateTime |
OPC |
%Good |
|---|---|---|---|---|---|
|
2015-10-07 00:00:00.000 |
Downtime.Status |
Running |
55.173125 |
0 |
0 |
|
2015-10-07 00:00:00.000 |
Downtime.Status |
Idle |
15.4923715277778 |
0 |
0 |
|
2015-10-07 00:00:00.000 |
Downtime.Status |
Material Jam |
9.52366666666667 |
0 |
0 |
|
2015-10-07 00:00:00.000 |
Downtime.Status |
Electrical |
6.60920138888889 |
0 |
0 |
|
2015-10-07 00:00:00.000 |
Downtime.Status |
Backed Up |
5.18525925925926 |
0 |
0 |
|
2015-10-07 00:00:00.000 |
Downtime.Status |
Equipment Jam |
4.21300347222222 |
0 |
0 |
|
2015-10-07 00:00:00.000 |
Downtime.Status |
Starved |
3.33917083333333 |
0 |
0 |
|
2015-10-07 00:00:00.000 |
Downtime.Status |
NULL |
0.446497685185185 |
0 |
0 |
Example: Finding the Minimum Time in a State
The following query finds the shortest closed/open time for the SteamValve discrete tag.
SELECT DateTime, TagName, vValue, StateTime, wwStateCalc
FROM History
WHERE TagName IN ('SteamValve')
AND DateTime > '2015-10-04 0:00:00'
AND DateTime <= '2015-10-08 0:00:00'
AND wwCycleCount = 1
AND wwRetrievalMode = 'ValueState'
AND wwStateCalc = 'MinContained'
The results of this query are:
|
DateTime |
TagName |
vValue |
StateTime |
wwStateCalc |
|---|---|---|---|---|
|
2015-10-08 00:00:00.000 |
SteamValve |
0 |
20688 |
MinContained |
|
2015-10-08 00:00:00.000 |
SteamValve |
1 |
19105 |
MinContained |
Example: Finding the Percentage of Time in a State
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 after 2015-10-05 0:00 and ending at 2015-10-08 0:00.
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, TagName, vValue, StateTime, wwStateCalc
FROM History
WHERE TagName IN ('PLCSim.Boolean6')
AND DateTime >= '2016-03-15 06:00'
AND DateTime < '2016-03-15 08:00'
AND Value = 1
AND wwRetrievalMode = 'ValueState'
AND wwStateCalc = 'Percent'
AND wwCycleCount = 6
The results of this query are:
|
DateTime |
TagName |
vValue |
StateTime |
wwStateCalc |
|---|---|---|---|---|
|
2016-03-15 06:00:00.0000000 |
PLCSim.Boolean6 |
1 |
50.18475 |
Percent |
|
2016-03-15 06:20:00.0000000 |
PLCSim.Boolean6 |
1 |
49.8515 |
Percent |
|
2016-03-15 06:40:00.0000000 |
PLCSim.Boolean6 |
1 |
49.9315833333333 |
Percent |
|
2016-03-15 07:00:00.0000000 |
PLCSim.Boolean6 |
1 |
50.1493333333333 |
Percent |
|
2016-03-15 07:20:00.0000000 |
PLCSim.Boolean6 |
1 |
49.9735 |
Percent |
|
2016-03-15 07:40:00.0000000 |
PLCSim.Boolean6 |
1 |
49.8709166666667 |
Percent |