AnsweredAssumed Answered

AFSDK equivalent to HDA ReadRaw()

Question asked by mdspath on Jun 15, 2015
Latest reply on Jun 15, 2015 by Rhys Kirk


I'm looking to move away from using the HDA interface to get data from our pi Server to our custom application. There is a function used called ReadRaw that returns an HDA data array, I'm looking to find an AF SDK equivalent.

Below is the description for the method



Package: opc.hda

Read raw data stored over a time range from HDA server




DObj = readRaw(HdaClient, ItmList, StartTime, EndTime)
DObj = readRaw(HdaClient, ItmList, StartTime, EndTime, BoundsFlag)




DObj = readRaw(HdaClient, ItmList, StartTime, EndTime) reads data from the items defined by ItmList, stored on the OPC HDA server connected to OPC HDA Client HdaClient, between StartTime (inclusive) and EndTime (exclusive). The StartTime and EndTime arguments must be date numbers, or strings that can be converted to a MATLAB® date number. DObj is returned as an opc.hda.Data array, with one element per item specified in ItmList.

DObj = readRaw(HdaClient, ItmList, StartTime, EndTime, BoundsFlag) allows you to specify a bounds flag. If BoundsFlag is true, then the first data point on or outside the defined start and end times will be returned. If BoundsFlag is false, then only values that were time stamped between StartTime (inclusive) and EndTime (exclusive) will be included.

Note that one or more time stamps returned for each item may be unique to that item. To retrieve aligned data from an OPC HDA Server, use readAtTime or readProcessed.



Create an OPC HDA Client and connect the client to the server:

hdaObj = opchda('localhost', 'Matrikon.OPC.Simulation'); connect(hdaObj);

Read the last day's data from two items:

DObj = readRaw(hdaObj, {'Random.Real8', 'Random.Real4'}, now-1, now);