opc hda - 历史读取,尝试批量读取时出现 continuationPoint 问题

问题描述 投票:0回答:2

我已使用 opc milo java sdk 连接到 OPCHA 服务器,并尝试通过将 numValuesPerNode 作为 15 传递给 ReadRawModifiedDetails(..) 来批量读取单个节点的历史记录,以批量读取 15 个数据值。但我注意到 continuationPoint 为空。我想设置这个 continuationPoint 来读取剩余的数据值节点。这将循环批量读取 15 个数据值。下面是代码。请您帮忙读取批量数据值和有值的延续点。

    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();

这里historyReadResults返回的ContinationPoint为null。

opc-ua opc
2个回答
0
投票

你这边有一个误解。 如果服务器无法根据请求提供所有值,则会从服务器创建 ContinuationPoint。它并不是为了获取下一个值而设计的。

  • 无论是一次性读完,如果超出限制,服务器都会生成 ContinuationPoints 。
  • 或者将 dateStart 修改为晚于上次调用的最后一个值。

0
投票

numValuesPerNode
结构体中的
ReadRawModifiedDetails
参数不是用于批量读取的,而是告诉服务器你只对一定数量的数据点感兴趣。

在时间范围内任何节点返回的最大值数。如果只指定一个时间,则时间范围应扩展以返回这一数量的值。默认值 0 表示没有最大值。

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

© www.soinside.com 2019 - 2024. All rights reserved.