简体   繁体   English

将预触发值从OPC UA服务器发布到OPC UA客户端

[英]Publish pre-trigger values from an OPC UA server to a OPC UA client

Can anyone help me out with the following use case for OPC UA?: reading triggered measurements from an OPC UA server with additional measurement values that happened in the period just before the trigger condition occurred. 谁能为我提供以下OPC UA用例的帮助吗?:从OPC UA服务器读取触发的测量值,以及触发条件发生之前一段时间内发生的其他测量值。 This pre-trigger period would be configurable, let's say half a second. 该预触发时间段是可配置的,例如半秒。 This allows seeing what happened just before the trigger of interest occurred. 这样一来,您就可以查看发生兴趣触发之前发生的情况。

How would I go about?: As soon as the trigger happens make the results available for the OPC UA clients and then the client should then act on the same trigger to retrieve the preceding historical measurement values of the period before the trigger happened. 我将如何处理?:触发一发生,将结果提供给OPC UA客户端,然后客户端应作用于相同的触发,以检索触发发生之前一段时间的先前历史测量值。 I hope there is a smarter way so that the client can remain stateless. 我希望有一种更聪明的方法,以便客户端可以保持无状态。 And there is no requirement that the data arrives a bit later so that the pre-trigger values are sent first before the post-trigger values are sent to the client. 并且不要求数据稍晚到达,以便在将触发后值发送到客户端之前先发送触发前值。

Given that the data must be buffered anyhow to make this possible, could this work?: 鉴于必须以任何方式缓冲数据以使之成为可能,这行得通吗?:

  • my back end measurement data provider within the OPC UA server could just start returning data values back to the client starting with the values from half a second earlier (the configured pre-trigger period). 我的OPC UA服务器中的后端测量数据提供者可以开始将数据值从早于半秒(已配置的预触发周期)开始的数据返回给客户端。 Ie not returning the current measurement values but starting with the pre-trigger ones. 即不返回当前测量值,而是从预触发值开始。

I have seen in the Milo server example that within the ExampleNameSpace the AttributeValueDelegate construct is used for dynamic nodes. 我在Milo服务器示例中看到,在ExampleNameSpace中,AttributeValueDelegate构造用于动态节点。 This seems to allow to return data values one at the time including a timestamp. 这似乎允许一次返回一个包括时间戳在内的数据值。 I don't have the proper test tools to see if it works if I start returning relative old values. 我没有适当的测试工具来查看如果我开始返回相对旧的值是否可行。

The other thing is how this relates to monitored items and sampling intervals. 另一件事是这与受监控的项目和采样间隔之间的关系。 If the client, for example, would request a sampling rate of 10 samples per second, would it then check if the returned monitored items are actually within that range? 例如,如果客户将请求每秒10个样本的采样率,那么它将检查返回的监视项目是否确实在该范围内吗? Ie will older values arriving late be discarded or just pulled in by the client? 就是说,较晚到达的旧值会被丢弃还是由客户提取?

No matter what approach you take it's going to require the client to be aware of what you're doing here, so here's an approach that might work: 无论您采用哪种方法,都将要求客户知道您在这里所做的事情,因此这是一种可行的方法:

Create two nodes in the server, a scalar that holds the current measurement value, and an array that holds the last N measurements values. 在服务器中创建两个节点,一个保存当前测量值的标量,一个保存最后N个测量值的数组。

In the client, create a monitored item for the scalar value with MonitoringMode.Reporting, and create a monitored item for the array value with MonitoringMode.Sampling. 在客户端中,使用MonitoringMode.Reporting为标量值创建一个监视项,并使用MonitoringMode.Sampling为数组值创建一个监视项。 Then use the SetTriggering service to create a triggering link between the scalar item and the array item. 然后使用SetTriggering服务在标量项和数组项之间创建触发链接。

What this will result in is you can freely update the array value in the server without the value being reported as changed, but when you update the scalar value and the change is reported, the current value of the array will get reported too. 这将导致您可以自由更新服务器中的数组值,而不会将该值报告为已更改,但是当您更新标量值并报告更改时,也会同时报告该数组的当前值。

As a side note, I'd avoid relying on the AttributeDelegate mechanism for new development. 作为附带说明,我将避免依赖AttributeDelegate机制进行新开发。 It's going to be deprecated and replaced with something else once development on 0.3 starts. 一旦在0.3上开始开发,它将被弃用并替换为其他内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM