OPCHDA.NET-UA
ReadProcessed(OPCHDAtime,OPCHDAtime,TimeSpan,Int32[],Int32[],OPCHDAitem[],Int32[]) Method
See Also  Send Feedback
OpcHDaNetUaOption.Net4 Assembly > hdaUAwrapper Namespace > HDAServer Class > ReadProcessed Method : ReadProcessed(OPCHDAtime,OPCHDAtime,TimeSpan,Int32[],Int32[],OPCHDAitem[],Int32[]) Method

startTime
The beginning of the history period to be read.
endTime
The end of the history period to be read.
resampleInterval
Interval between returned values.
server
The list of server item handles for the items to be read.
aggregates
The calculation to be performed on the raw data to create the values to be returned.
itemValues
OUT: Array of structures in which the item values are returned. The order of the structures in the array shall be the same as the order of the server item handles.
errors
OUT: Array of HRESULTs indicating the success of the individual item reads. The errors correspond to the handles passed in server. This indicates whether the read succeeded in obtaining defined values, qualities and timestamps. NOTE any FAILED error code indicates that the contents of the corresponding OPCHDA_ITEM structure are UNDEFINED.

Glossary Item Box

This synchronous function computes aggregate values, qualities, and timestamps from data in the history database for the specified time domain for one or more items. The time domain is divided into subintervals of duration resampleInterval. The specified aggregate is calculated for each subinterval beginning with startTime by using the data within the next resampleInterval. This function is intended to provide values calculated with respect to the resample interval. For example, this function can provide hourly statistics such as Maximum, Minimum, Average, etc. for each item during the specified time domain when resampleInterval is 1 hour.

Syntax

Visual Basic (Declaration) 
Public Overloads Function ReadProcessed( _
   ByVal startTime As OPCHDAtime, _
   ByVal endTime As OPCHDAtime, _
   ByVal resampleInterval As TimeSpan, _
   ByVal server() As Integer, _
   ByVal aggregates() As Integer, _
   ByRef itemValues As OPCHDAitem(), _
   ByRef errors As Integer() _
) As Integer
C# 
public int ReadProcessed( 
   OPCHDAtime startTime,
   OPCHDAtime endTime,
   TimeSpan resampleInterval,
   int[] server,
   int[] aggregates,
   out OPCHDAitem[] itemValues,
   out int[] errors
)

Parameters

startTime
The beginning of the history period to be read.
endTime
The end of the history period to be read.
resampleInterval
Interval between returned values.
server
The list of server item handles for the items to be read.
aggregates
The calculation to be performed on the raw data to create the values to be returned.
itemValues
OUT: Array of structures in which the item values are returned. The order of the structures in the array shall be the same as the order of the server item handles.
errors
OUT: Array of HRESULTs indicating the success of the individual item reads. The errors correspond to the handles passed in server. This indicates whether the read succeeded in obtaining defined values, qualities and timestamps. NOTE any FAILED error code indicates that the contents of the corresponding OPCHDA_ITEM structure are UNDEFINED.

Return Value

S_OK, S_FALSE, OPC_E_MAXEXCEEDED, E_INVALIDARG, E_FAIL

Remarks

The domain of the request is defined by startTime, endTime, and resampleInterval. If startTime or endTime is given in string (relative) format, the value returned shall be the DateTime to which that value was translated by the server. All three must be specified. If endTime is less than startTime, the data shall be returned in reverse order, with later data coming first. If startTime and endTime are the same, the server shall return E_INVALIDARG, as there is no meaningful way to interpret such a case.

The values used in computing the aggregate for each subinterval shall include any value that falls exactly on the timestamp beginning the subinterval, but shall not include any value that falls directly on the timestamp ending the subinterval. Thus, each value shall be included only once in the calculation. If the time domain is in reverse order, we consider the later timestamp to be the one beginning the subinterval, and the earlier timestamp to be the one ending it. Note that this means that simply swapping the start and end times will not result in getting the same values back in reverse order, as the subintervals being requested in the two cases are not the same.

If the last subinterval computed is not a complete subinterval (the time domain of the request is not evenly divisible by the resample interval), the last aggregate returned shall be based upon that incomplete subinterval, and the quality of the aggregate shall be OPCHDA_PARTIAL. For MinimumActualTime and MaximumActualTime, if more than one instance of the value exists within a subinterval, which instance (time stamp) of the value 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. To obtain multiple aggregates for the same item, include the server item handle in the list of items for each desired aggregate.

If resampleInterval is 0, the server shall create one aggregate value for the entire time range. This allows aggregates over large periods of time. A value with a timestamp equal to endTime will be excluded from that aggregate, just as it would be excluded from a subinterval with that ending time. The timestamp returned with the aggregate shall be the time at the beginning of the interval, except where the aggregate specifies a different value. Also, the quality returned with the aggregate shall be GOOD (see the OPC Data Access Standard) if all values upon which the aggregate is based have a quality of GOOD. If any of those values have any other quality, the quality of the aggregate shall be Sub-Normal (0x010110xx).

If no data exists for a given Item in any subinterval in the time domain, the server shall return OPC_S_NODATA in the errors array for that Item, and the corresponding itemValues structure shall have a count of 0. If data does exist in at least one subinterval for that item, the server shall return a timestamp, quality, and value for each subinterval in the time domain. For each subinterval for which there is no data, the server shall return a value of VT_EMPTY and a quality of OPCHDA_NODATA for that subinterval, with the appropriate timestamp. If the timestamp for the aggregate is based upon the data, the timestamp returned for OPCHDA_NODATA shall be that of the beginning of the interval.

Note: Vendor-defined aggregates may have different behavior with respect to whether trailing edge values are included in a subinterval. It is expected that server vendors will document the behavior of their vendor-specific aggregates clearly so that clients will know what values are included in each aggregate.

Requirements

Target Platforms: Windows 7/8/10, Windows Server 2008/2012/2016, .NET 4.x

See Also

Copyright © 2018 Advosol Inc. All Rights Reserved.