opc hda - History Read, issue with continuationPoint when trying to read in batches

98 Views Asked by At

I have connected to OPC HDA Server using OPC milo java SDK and trying to read history in batches for single node by passing numValuesPerNode as 15 to ReadRawModifiedDetails(..) to read only 15 data values in batches. But I have noticed continuationPoint is null. I want to set this continuationPoint to read remaining data values nodes. this will be in loop to read 15 data values in batches. Below is the code. Can you please help to read data values in batches and continuationPoint having values?

    HistoryReadDetails historyDetails = new ReadRawModifiedDetails(
            false,
            dateStart,
            dateEnd,
            UInteger.valueOf(15),
            true
    );
    HistoryReadValueId nodeId= new HistoryReadValueId(
            new NodeId(1, 22),
            null,
            QualifiedName.NULL_VALUE,
            ByteString.NULL_VALUE
    );
    List<HistoryReadValueId> nodesToRead = new ArrayList<>();
    nodesToRead.add(nodeId);
    HistoryReadResponse historyReadResponse = client.historyRead(
            historyReadDetails,
            TimestampsToReturn.Both,
            false,
            nodesToRead
    ).get();

    HistoryReadResult[] historyReadResults = historyReadResponse.getResults();

Here historyReadResults returning continuationPoint as null.

2

There are 2 best solutions below

3
Schroeder On BEST ANSWER

There is a miss understanding on your side. ContinuationPoints are created from the server, if they can't supply all values in on request. It's not designed to get the next values.

  • Either you read all at once, the server will generate ContinuationPoints , if it's limit is exceed.
  • Or modifiy dateStart to be later then the last value from the previous call.
3
Kevin Herron On

The numValuesPerNode parameter of the ReadRawModifiedDetails structure isn't for reading in batches, it's to tell the server you're only interested in a certain number data points.

The maximum number of values returned for any Node over the time range. If only one time is specified, the time range shall extend to return this number of values. The default value 0 indicates that there is no maximum.

https://reference.opcfoundation.org/Core/Part11/v104/docs/6.4.3