Существует проект под названием OPC-UA издатель.
Издатель OPC-UA - это приложение, которое служит мостом между вашим OPC-сервером и IoT Hub. Он может подписаться на определенные узлы (которые вы выбираете в конфигурации) и опубликовать их в IoT Hub в нужном формате.
Вы можете запустить его как консольное приложение, как контейнер или как контейнер в сочетании с IoT Edge.
Как настроить и как это работает: https://github.com/Azure/iot-edge-opc-publisher
Пример, как создать и запустить локально:
- Перейдите в терминале к папке, в которую вы скачали проект
- сборка докера -t your_container_registry / opcpublisher.
- Не забывайте точку в последней команде
- docker запустите your_container_registry / opcpublisher --dc = "device_connection_string_retrieved_from_iot_hub" --ns = true --ih = Http1 --pf = "C: \\ Users \\ Пользователь \\ Настольный компьютер \\ OPC \\ publnodes.json"
нс - без выключения, издатель пока работает
publnodes.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).
]