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

AF SDK Reference

Product Family
Current publication
Table of Contents

Future Data

Future Data

Starting with version 2.7, AF provides special handling for data with timestamps in the future ("future data"), typically used to store predictions. While future data can be represented in earlier versions of AF SDK, version 2.7 adds full support for working with future data in PI Data Archive and consuming it through the OSIsoft.AF.Data.AFDataPipe and OSIsoft.AF.Data.AFDataCache.

Note Note

Future data support is available in PI Data Archive versions 3.4.395 and later.

Determining Future Data Support

To determine if an OSIsoft.AF.Asset.AFAttribute supports future data, examine the AFAttribute.SupportedDataMethods property to see if the AFDataMethods.Future flag is set.

PIPoints can be checked for future data support by checking the Future property.

Support for future data by an OSIsoft.AF.Asset.AFAttribute or PIPoint does not indicate the presence of future data, only the capability to store data with timestamps in the future.

Note Note

PI tags that do not support future data will accept data up to 10 minutes in the future.

Querying for Future Data

Prior to the introduction of future data support, AF SDK did not distinguish between the value in effect at the current time and the last value present in the data stream. In AF 2.7, OSIsoft.AF.Asset.AFAttributes and PIPoints that support future data distinguish these concepts.

In AF 2.7, the current value of an AFAttribute is accessed using GetValue without a time context. The end of the data stream for an attribute is queried using AFData.EndOfStream on an OSIsoft.AF.Data.AFData instance associated with the AFAttribute (e.g. obtained via the Data property). The end of the data stream for many attributes can be queried in bulk using AFListData.EndOfStream.

The distinction for PIPoint queries is made by calling CurrentValue or EndOfStream rather than the obsoleted Snapshot method. If called, the Snapshot method will behave like CurrentValue. These methods will behave identically for PIPoints that do not support future data.

There are differences in extrapolation behavior between historical PI tags and PI tags that support future data (this applies to both PIPoints and AFAttributes backed by PIPoints). Interpolated queries and “Auto” retrieval mode (which is the default configuration of the PI Point Data Reference) will return a NoData event for historical tags if queried at a timestamp past the end-of-stream and in the future. Future tags never extrapolate; they return a NoData event for any query after the end-of-stream event, regardless if it is in the past or future. RecordedValues and PlotValues calls to historical tags generate a NoData event at the current time when the requested time range extends into the future (beyond the end-of-stream), whereas future tags will not.

Subscribing to Future Data

The OSIsoft.AF.Data.AFDataPipe and OSIsoft.AF.Data.AFDataCache have been enhanced to simplify consuming future data via updates.

Update Event Horizon

There are several usage models for consuming future data. These are supported by configuring the position of an event horizon and the behavior of events near that horizon. The event horizon is located a fixed offset from current time into the future (the offset length is defined by AFDataPipe.EventHorizonOffset or AFDataCache.EventHorizonOffset). The event horizon mode (AFDataPipe.EventHorizonMode and AFDataCache.EventHorizonMode) controls when update events are returned with respect to the event horizon. There are 3 options:

1. AFEventHorizonMode.TimeOffset : Events are returned as they cross the event horizon from the future. This mode is appropriate for many visualization applications where process data is shown along side future data and it is desirable to limit how much projection data is visible. This is the default for the OSIsoft.AF.Data.AFDataPipe.

2. AFEventHorizonMode.TimeOffsetWithOutsideEvent : Events are returned as they cross the event horizon from the future or when they are the first event after the horizon. This mode is appropriate for performing calculations where queries up to the event horizon should be answerable based on available data (e.g. the interpolated value at the event horizon). This is the default for the OSIsoft.AF.Data.AFDataCache.

3. AFEventHorizonMode.EndOfStream : Returns all updates available. In this mode the event horizon offset is ignored. This is appropriate for taking actions when any new projected data is added or for performing replication of data.

Note Note

If the AFEventHorizonMode.TimeOffsetWithOutsideEvent mode is used and there is no event available after the event horizon, then it can be assumed that all available data has been passed.

Calculated Attributes

Calculated attributes compute their values based on inputs from other attributes. A subscription to a calculated attribute will produce events which follow the character of calculation's inputs. If all inputs are historical attributes or all inputs support future data, evaluation will occur with each new event. However, if the inputs are a mix of historical and future attributes then evaluations triggered by future inputs are postponed until the timestamp is at or before the current time (to align data with historical inputs).

Related Links
Was this topic helpful?