The playback functionality of a History server provides the capability to get an initial set of data from the History server and then get continual updates of historical data. This is different than the Asynchronous Advise methods in that those methods are centered around the current time. The playback interface supports methods that retrieval data from the past and then supply updates from stored data. Typically the updates are sent at a rate that is more frequent than the time the data was stored. For example, the request could be to send 10 minutes worth of data every minute.
This operation initially retrieves data from the start time to the end time.
After the initial response it periodically (every updateInterval) responds with numIntervals worth of data divided into resampleInterval sized bins. The time of the last value returned in the initial response is used as the start time for the first update. After that, the time of the last value returned in an update is used as the start time for the next update.
This function is intended to be used to playback processed history data. By controlling the update interval, the data can be displayed on trends in real time, in slower motion, or faster than real time.
The results are returned via the client's Playback event handler.
Visual Basic (Declaration) | |
---|---|
Public Function ReadProcessedWithUpdate( _ ByVal transactionID As Integer, _ ByRef startTime As OPCHDA.NET.OPCHDAtime, _ ByRef endTime As OPCHDA.NET.OPCHDAtime, _ ByVal resampleInterval As TimeSpan, _ ByVal numIntervals As Integer, _ ByVal updateInterval As TimeSpan, _ ByVal server() As Integer, _ ByVal aggregate() As Integer, _ ByRef cancelID As Integer, _ ByRef errors As Integer() _ ) As Integer |
C# | |
---|---|
public int ReadProcessedWithUpdate( int transactionID, ref OPCHDA.NET.OPCHDAtime startTime, ref OPCHDA.NET.OPCHDAtime endTime, TimeSpan resampleInterval, int numIntervals, TimeSpan updateInterval, int[] server, int[] aggregate, out int cancelID, out int[] errors ) |
Parameters
- transactionID
- An identifier created by the client and passed to the server in this call. The server shall return this identifier along with the results of this call.
- startTime
- The earliest time of the history to be read.
- endTime
- The latest time of the history to be read.
- resampleInterval
- Time between return values.
- numIntervals
- The number of ResampleIntervals in an update.
- updateInterval
- The interval to send data for updates.
- server
- The list of processed server items to be retrieved.
- aggregate
- The list of processed values to be returned.
- cancelID
- OUT: Place to return a Server generated ID to be used in case the operation needs to be canceled.
- errors
- OUT: Array of HRESULTs indicating the success of the individual item reads. Indicates only whether the corresponding server handle was valid.
Return Value
S_OK, S_FALSE, OPC_E_MAXEXCEEDED, E_NOTIMPL, E_INVALIDARG, E_FAILThe domain of the initial request is defined by startTime, endTime, and resampleInterval. If startTime or endTime is given in string (relative) format, the value returned will be the DateTime to which that value was translated by the server.
All three must be specified. endTime must be greater than startTime.
The resampleInterval determines how many subintervals the complete interval is divided into.
The specified function is calculated at each subinterval beginning with startTime and selecting the data within the next resampleInterval, a value will be calculated according to the aggregate at each subinterval. For MinimumActualTime and MaximumActualTime used with aggregate values, if more than one instance of the value exists within a time range, which instance (time stamp) of the value is returned is server dependent.
In any case, the server may set the OPCHDA_EXTRADATA quality flag to let the caller know that there are other timestamps with that value. The domain of updates is defined by the time of the last value returned, the resampleInterval and numIntervals. A resampleInterval of 0 is illegal resulting in a return status of E_INVALIDARG. If only an initial set of data is desired, the numIntervals should be set to 0 The request must still be cancelled.
The updateInterval can not be less than the resampleInterval. The order of the data returned will match the order of the ItemIDs in the request.
Target Platforms: Windows 7/8/10, Windows Server 2008/2012/2016, .NET 4.x