我想在我的工作场所使用Azure连接到现有的OPC。从我看到的情况来看,它需要设置一个天蓝色的物联网中心。我找到了描述如何设置物联网集线器的教程,但没有任何内容演示如何与现有的OPC通信。本质上,我想从OPC读取数据以运行机器学习工具(带有azure ml),然后将该信息发送回OPC。任何指向我正确方向的帮助或想法都将很棒!
答案 0 :(得分:0)
有一个名为OPC-UA发布者的项目。
OPC-UA发布者是充当OPC服务器与IoT中心之间的桥梁的应用程序。它可以订阅某些节点(在配置中选择),然后以所需格式将它们发布到IoT中心。
您可以将其作为控制台应用程序,容器或与IoT Edge结合使用的容器来运行。
如何设置以及如何工作:https://github.com/Azure/iot-edge-opc-publisher
如何在本地构建和运行示例:
ns-没有关闭,发布商暂时在运行
publishednodes.json示例:
[
{
// example for an EnpointUrl is: opc.tcp://192.168.178.26:62541/Quickstarts/ReferenceServer
"EndpointUrl": "opc.tcp://192.168.16.183:4840/freeopcua/server",
// allows to access the endpoint with SecurityPolicy.None when set to 'false' (no signing and encryption applied to the OPC UA communication), default is true
"UseSecurity": false,
"OpcNodes": [
{
// identifies the OPC node to publish in either NodeId format (contains "ns=") or ExpandedNodeId format (contains "nsu=")
"Id": "nsu=http://example.proof.com;i=2",
// specifies the sampling interval OPC Publisher requests the server to sample the node value
"OpcSamplingInterval": 500,
// specifies the publishing interval OPC Publisher requests the server to publish the node value, it will only be published if the value has changed
"OpcPublishingInterval": 500,
// specifies that there should be a heartbeat generated by OPC Publisher, this means that after the given interval the last message will be sent again with an updated SourceTimestamp value.
"HeartbeatInterval": 1000,
// specifies that the first event will not generate a telemetry event, this is useful when publishing a large amount of data to prevent a event flood at startup of OPC Publisher
"SkipFirst": true
},
{
// identifies the OPC node to publish in either NodeId format (contains "ns=") or ExpandedNodeId format (contains "nsu=")
"Id": "nsu=http://example.proof.com;i=3",
// specifies the sampling interval OPC Publisher requests the server to sample the node value
"OpcSamplingInterval": 500,
// specifies the publishing interval OPC Publisher requests the server to publish the node value, it will only be published if the value has changed
"OpcPublishingInterval": 500,
// specifies that there should be a heartbeat generated by OPC Publisher, this means that after the given interval the last message will be sent again with an updated SourceTimestamp value.
"HeartbeatInterval": 1000,
// specifies that the first event will not generate a telemetry event, this is useful when publishing a large amount of data to prevent a event flood at startup of OPC Publisher
"SkipFirst": true
}
]
}
// the format below (NodeId format) is only supported for backward compatibility. you need to ensure that the
// OPC UA server on the configured EndpointUrl has the namespaceindex you expect with your configuration.
// please use the ExpandedNodeId format as in the examples above instead.
/* {
"EndpointUrl": "opc.tcp://<your_opcua_server>:<your_opcua_server_port>/<your_opcua_server_path>",
"NodeId": {
"Identifier": "ns=0;i=2258"
}
} */
// please consult the OPC UA specification for details on how OPC monitored node sampling interval and OPC subscription publishing interval settings are handled by the OPC UA stack.
// the publishing interval of the data to Azure IoTHub is controlled by the command line settings (or the default: publish data to IoTHub at least each 1 second).
]