Click or drag to resize
OSIsoft, LLC

AFDataFilteredSummaries Method

This method, when supplied a filter expression that evaluates to true or false, evaluates it over the passed time range. For the time ranges where the expression evaluates to true, the method calculates the requested summaries on the source attribute.

Namespace:  OSIsoft.AF.Data
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version:
public IDictionary<AFSummaryTypes, AFValues> FilteredSummaries(
	AFTimeRange timeRange,
	AFTimeSpan summaryDuration,
	string filterExpression,
	AFSummaryTypes summaryType,
	AFCalculationBasis calcBasis,
	AFSampleType sampleType,
	AFTimeSpan sampleInterval,
	AFTimestampCalculation timeType


Type: OSIsoft.AF.TimeAFTimeRange
The bounding time range over which the filtered summary intervals are computed.
Type: OSIsoft.AF.TimeAFTimeSpan

The duration of each summary interval. If specified in hours, minutes, seconds, or milliseconds, the summary durations will be evenly spaced UTC time intervals. Longer interval types are interpreted using wall clock rules and are time zone dependent. For example, an interval created with the string "24h" means using an evenly spaced 24 UTC hour interval between each event. On the other hand, an interval created with the string "1d" would return an interval shorter or longer than 24 hours if the interval encompasses a Daylight Savings Time change.

When a positive duration is specified, the summary calculation begins at the earliest bounding time in the timeRange and applies the duration repeatedly in time ascending direction to generate the summary intervals.

If a negative duration is specified, the summary calculation begins at the latest bounding time in the timeRange and applies the duration repeatedly in time descending direction to generate the summary intervals. Note that the order of values returned will still be reflected by the timeRange, regardless of the summary duration sign.

Type: SystemString
A string containing a filter expression. Expression variables are relative to the attribute. Use '.' to reference the containing attribute.
Type: OSIsoft.AF.DataAFSummaryTypes
A flag which specifies one or more summaries to compute for each interval over the time range
Type: OSIsoft.AF.DataAFCalculationBasis
Specifies the method of evaluating the data over the time range.
Type: OSIsoft.AF.DataAFSampleType
Together with the sampleInterval, specifies how and how often the filter expression is evaluated.
Type: OSIsoft.AF.TimeAFTimeSpan
When the sampleType is Interval, it specifies how often the filter expression is evaluated when computing the summary for an interval.
Type: OSIsoft.AF.DataAFTimestampCalculation
An enumeration value that specifies how the timestamp is calculated.

Return Value

Type: IDictionaryAFSummaryTypes, AFValues
A dictionary of AFValues, indexed by the specific AFSummaryTypes.
ArgumentOutOfRangeException The summaryType cannot be None.
NotSupportedException The data reference does not support this method.

The following table illustrates the interaction between timeRange and summaryDuration with the timestamp summary calculations and order of returned values for each summary type.

Time RangeSummary DurationSummaries returned in AFValues
Ascending (Y to T)Positive (5h)Y to Y+5h, Y+5h to Y+10h, Y+10h to y+15h, Y+15h to Y+20h
Descending (T to Y)Positive (5h)Y+15h to Y+20h, Y+10h to Y+15h, Y+10h, Y+5h to Y+10h, Y to Y+5h
Ascending (Y to T)Negative (-5h)T-20h to T-15h, T-15h to T-10h, T-10h to T-5h, T-5h to T
Descending (T to Y)Negative (-5h)T-5h to T, T-10h to T-5h, T-15h to T-10h, T-20 to T-15h

Time-weighted totals are computed by integrating the rate tag values over the requested time range. If some of the data are bad in the time range, the calculated total is divided by the fraction of the time period for which there are good values. Mathematically, this approach is equivalent to assuming that during the period of bad data, the tag takes on the average values for the entire calculation time range. The PercentGood summary can be used to determine if the calculation results are suitable for the application's purposes.

For time-weight totals, if the time unit rate of the attribute cannot be determined, then the value will be totaled assuming a unit of "per day" and no unit of measure will be assigned to the value. If the measured time component of the tag is not based on a day, the user of the data must convert the totalized value to the correct units. For example, if the rate tag was gallons/minute, the conversion can be accomplished using UOMDatabase.UOMs["minute"].Convert(value, UOMDatabase.UOMs["day"].

Note Notes to Callers
This method, property, or class is only available in the .NET 4 version of the SDK.

Security note Security Note
You must have ReadData security rights to read a data value.

Version Information


Supported in: 2.10.5, 2.10, 2.9.5, 2.9, 2.8.5, 2.8, 2.7.5, 2.7, 2.6, 2.5
See Also
Enabling Operational Intelligence