TimeGood Mode
The TimeGood mode calculates the amount of time for which the data was of good quality.
The TimeGood mode is most useful when combined with filtered data queries. You can use a filter condition to acquire samples for which a specific condition was true, then calculate for how long that data was of a good quality. For example, you could use a filter condition to determine the amount of time a pump was activated, then calculate for how much of that time the data was of a good quality.
To get the most use out of the TimeGood mode, you should understand how filtered data queries work.
- Value
-
The TimeGood mode retrieves the total number of milliseconds during the interval for which the data is good AND for which the filter condition is true. If there is no filter tag or condition, then TimeGood is the total number of milliseconds in the interval that the data is good.
- Quality
-
The TimeGood mode always has a percent good of 100, even if there are no raw samples or if all samples have bad quality. In the latter case, the Value will be 0, but the percent good is still 100.
- Example: Finding the amount of time the collector was running
-
The following example uses multiple intervals without a filter condition. If the data is good for the entire interval, the returned Value would be the length of the interval in milliseconds.
Import the following data (identical to that used in the examples for Interpolated Data)
* Example for Interpolated Data Documentation * [Tags] Tagname,DataType,HiEngineeringUnits,LoEngineeringUnits BADDQTAG,SingleFloat,60,0 [Data] Tagname,TimeStamp,Value,DataQuality BADDQTAG,29-Mar-2002 13:59:00.000,22.7,Good BADDQTAG,29-Mar-2002 14:08:00.000,12.5,Bad BADDQTAG,29-Mar-2002 14:14:00.000,7.0,Bad BADDQTAG,29-Mar-2002 14:22:00.000,4.8,Good
The following SQL query retrieves data with a start time of 14:00 and an end time of 14:30 in 5-minute intervals.:
select timestamp,value,intervalmilliseconds from ihRawData where tagname = baddqtag and samplingmode=calculated and calculationmode=timegood and timestamp > '29-mar-2002 13:55:00' and timestamp <'29-mar-2002 14:30:00' and intervalmilliseconds=5m
Time Stamp Value Intervalmilliseconds 29-Mar-2002 14:00:00.000 60,000.00 300,000 29-Mar-2002 14:05:00.000 300,000.00 300,000 29-Mar-2002 14:10:00.000 180,000.00 300,000 29-Mar-2002 14:15:00.000 0.00 300,000 29-Mar-2002 14:20:00.000 0.00 300,000 29-Mar-2002 14:25:00.000 180,000.00 300,000 The percent quality for each returned interval is 100.00 and is not shown. By including the intervalmilliseconds column, you can compare the returned milliseconds to the total milliseconds for the interval.
- When data is good for the whole interval: From 14:01 to 14:05 the data is good, though no raw samples are contained. The value is equal to intervalmilliseconds (300,000).
- When data starts bad while entering the interval and then turns good: The data is bad going into the 14:21 to 14:25 interval, resulting in a value of 180,000 (out of 300,000).
- When data is bad from the middle of the interval to the end the interval: The data in the 14:06 to 14:10 interval starts with good quality and changes to bad quality. The value is therefore less than the calculated intervalmilliseconds (180,000 out of 300,000).
- When there are no raw samples in an interval: The number of raw samples has no effect on the Value; it only affects the percent quality
The interval from 14:01 to 14:05 contains no raw samples. The data quality throughout the entire interval is good. Therefore, for this interval, the Value is 300,000 (the length of the entire interval).
The interval from 14:16 to 14:20 contains no raw samples. The data quality throughout the entire interval is bad. At no time in this interval is there good data, so for this interval, the Value is 0.
The following example demonstrates the case of bad data throughout a section in the middle of an interval. The following query retrieves data from a larger interval that has a section of bad quality in the middle of 2 periods of good quality.
select timestamp,value,intervalmilliseconds from ihRawData where tagname = baddqtag and samplingmode=calculated and calculationmode=timegood and timestamp >= '29-mar-2002 14:05:00' and timestamp <= '29-mar-2002 14:25:00' and intervalmilliseconds=20m
Time Stamp | Value | Intervalmilliseconds |
---|---|---|
29-Mar-2002 14:25:00.000 | 360,000.00 |
1,200,000 |
A Value of 360,000 milliseconds corresponds to 3 minutes of good quality at the beginning of the interval and 3 minutes of good quality at the end of the interval.