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

startTime
The beginning of the history period to be read.
endTime
The end of the history period to be read.
numValues
The maximum number of values returned for any item over the time range. If only one time is specified, the time range must extend to return this number of values.
bounds
True if bounding values should be returned.
server
The list of server item handles for the items to be read.
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 phServer. This indicates whether the read succeeded in obtaining a defined value, quality and timestamp. NOTE that any FAILED error code indicates that the corresponding OPCHDA_ITEM struct is undefined.

Glossary Item Box

This synchronous function reads the values, qualities, and timestamps from the history database for the specified time domain for one or more items. When 'bounds' is TRUE, the bounding values for the time domain are returned. This function is intended for use by clients wanting the actual data saved within the historian. The actual data may be compressed or may be all data collected for the item depending on the historian and the storage rules invoked when the item values were saved. The optional bounding values are provided to allow clients to interpolate values for the start and end times when trending the actual data on a display.

Syntax

Visual Basic (Declaration) 
Public Overloads Function ReadRaw( _
   ByVal startTime As OPCHDAtime, _
   ByVal endTime As OPCHDAtime, _
   ByVal numValues As Integer, _
   ByVal bounds As Boolean, _
   ByVal server() As Integer, _
   ByRef itemValues As OPCHDAitem(), _
   ByRef errors As Integer() _
) As Integer
C# 
public int ReadRaw( 
   OPCHDAtime startTime,
   OPCHDAtime endTime,
   int numValues,
   bool bounds,
   int[] server,
   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.
numValues
The maximum number of values returned for any item over the time range. If only one time is specified, the time range must extend to return this number of values.
bounds
True if bounding values should be returned.
server
The list of server item handles for the items to be read.
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 phServer. This indicates whether the read succeeded in obtaining a defined value, quality and timestamp. NOTE that any FAILED error code indicates that the corresponding OPCHDA_ITEM struct is undefined.

Return Value

S_OK, S_FALSE, OPC_E_MAXEXCEEDED, E_INVALIDARG, E_FAIL

Remarks

The time domain of the request is defined by StartTime, EndTime, and NumValues; at least two of these must be specified. If EndTime is less than StartTime, or EndTime and NumValues alone are specified, the data will be returned in reverse order, with later data coming first. If all three are specified, the call shall return up to numValues results going from startTime to EndTime, in either ascending or descending order depending on the relative values of StartTime and EndTime.
If numValues is 0, then all the values in the range are returned. A null value for OPCHDAtime (see specification section 5.3.4) is used to indicate StartTime or EndTime is not specified. If either StartTime or EndTime is given in string (relative) format, the absolute time of the OPCHDAtime structure (time) shall be set to the DateTime which the relative time was translated to by the server.

It is specifically allowed for the StartTime and the EndTime to be identical. This allows the client to request just one value. It is specifically not allowed for the server to return E_INVALIDARG if the requested time domain is outside of the server's range. Such a case shall be treated as an interval in which no data exists.

If more than numValues results exist within that time range, the Errors entry for that ItemID shall be OPC_S_MOREDATA. When OPC_S_MOREDATA is returned, clients wanting the next numValues values should call ReadRaw again with the timestamp of the oldest value returned for the item as the new startTime and the original value of EndTime unchanged (reverse StartTime and EndTime if reverse order is needed). Note that the second call will return a duplicate of the last value in the previous call.

If bounding values are requested and a non-zero numValues was specified, any bounding values returned are included in the numValues count. If numValues is 1, then only the start bound is returned (the End bound if reverse order is needed).

If numValues is 2, then the data point, and the start bound is returned (the End bound if reverse order is needed). When bounding values are requested and no bounding value is found, the corresponding array elements in the itemValues will have a quality of OPCHDA_NOBOUND, a timestamp equal to the start or end time, as appropriate, and a VARIANT with a value of VT_EMPTY. How far back or forward to look in history for bounding values is server dependent.

For cases where only one of StartTime or EndTime, and a non-zero numValues is specified, then the last value in history is considered the End bound (the Start bound if reverse order is needed).

For an interval in which no data exists, if bounding values are not requested or are not found, the corresponding errors shall be OPC_S_NODATA, and the OPCHDAItem shall have a count of 0. If bounding values are requested and one or both exist, the Error return is S_OK and the bounding value(s) are returned. And, of course, if any Error code is not S_OK, the HRESULT returned to the client must be S_FALSE.

Requirements

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

See Also

Copyright © 2018 Advosol Inc. All Rights Reserved.