Подключитесь к существующему OPC с помощью Azure iot Hub - PullRequest
0 голосов
/ 05 апреля 2019

Я хочу использовать Azure для подключения к существующему OPC на моем рабочем месте.Из того, что я вижу, это требует установки лазурного центра.Я нашел учебные пособия, описывающие, как настроить iot-концентратор, но ничего, что демонстрирует, как общаться с существующим OPC.По сути, я хочу прочитать данные из OPC, чтобы запустить инструменты машинного обучения (с помощью azure ml), а затем отправить эту информацию обратно в OPC.Любая помощь или идеи, чтобы указать мне правильное направление, были бы великолепны!

1 Ответ

0 голосов
/ 11 апреля 2019

Существует проект под названием OPC-UA издатель.

Издатель OPC-UA - это приложение, которое служит мостом между вашим OPC-сервером и IoT Hub. Он может подписаться на определенные узлы (которые вы выбираете в конфигурации) и опубликовать их в IoT Hub в нужном формате.

Вы можете запустить его как консольное приложение, как контейнер или как контейнер в сочетании с IoT Edge.

Как настроить и как это работает: https://github.com/Azure/iot-edge-opc-publisher

Пример, как создать и запустить локально:

  1. Перейдите в терминале к папке, в которую вы скачали проект
  2. сборка докера -t your_container_registry / opcpublisher.
  3. Не забывайте точку в последней команде
  4. 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).
]
...