Подключитесь к существующему OPC с помощью azure iot hub.

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


person SamC    schedule 05.04.2019    source источник
comment
что означает OPC в вашем контексте?   -  person silent    schedule 10.04.2019


Ответы (1)


Есть проект под названием OPC-UA Publisher.

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

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

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

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

  1. Перейдите в терминале в папку, в которую вы скачали проект.
  2. docker build -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\\User\\Desktop\\OPC\\publishednodes.json"

ns - без выключения, издатель пока работает

Пример публикации nodes.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).
]
person kgalic    schedule 11.04.2019