The OPC Twin module runs on the edge and provides serveral edge services to the OPC Twin and Registry Services.
Core of the module is the Supervisor identity. The supervisor manages endpoint "twins", which correspond to OPC UA server endpoints that are activated using the corresponding OPC UA registry API. These endpoint twins translate OPC UA JSON received from the Twin micro service running in the cloud into OPC UA binary messages which are sent over a stateful secure channel to the managed endpoint.
The supervisor also provides discovery services which send device discovery events to the OPC UA Device Onboarding service for processing, where these events result in updates to the OPC UA registry.
The OPC Twin module can be deployed in an IoT Edge gateway. For development and testing purposes it can also be run standalone following the instructions below.
This module is part of our suite of Azure IoT Industrial components.
A pre-built image exits in Microsoft's container registry and can be obtained by running docker pull mcr.microsoft.com/iotedge/opc-twin:latest
.
To use it follow the instructions on how to deploy the module to IoT Edge:
- Instructions on how to deploy a module to one or a set of IoT Edge targets.
- Instructions on how to install IoT Edge on Linux and on Windows.
Install one IoT Edge gateway and module per factory network. Make sure you run one or more OPC UA servers in the same network to utilize the OPC Twin capabilities.
To build and run the module yourself, clone the repository. Then...
- Install .NET Core 2.1+ if you want to build the services locally.
- Install Docker if you want to build and run the services using docker-compose.
- Install any recent edition of Visual Studio (Windows/MacOS) or Visual Studio Code (Windows/MacOS/Linux).
- If you already have Visual Studio installed, then ensure you have .NET Core Tools for Visual Studio 2017 installed (Windows only).
- If you already have VS Code installed, then ensure you have the C# for Visual Studio Code (powered by OmniSharp) extension installed.
Follow the instructions here to deploy all required services for local development. Copy the resulting .env
file into this repository's root (or into the parent folder).
- Make sure the Prerequisites are set up.
- Change into the repo root and ensure the .env file containing an entry for
PCS_IOTHUB_CONNSTRING
exists. - Start the module by running
docker-compose up
.
Also, make sure you run one or more OPC UA servers in a network reachable from your development machine to utilize the OPC UA Twin capabilities.
- To build your own module container image and deploy it make sure the Prerequisites are set up.
- Change into the repo root and run
docker build -f docker/linux/amd64/Dockerfile -t azure-iiot-opc-twin-module .
- Then push the module to an accessible registry, e.g. Azure Container Registry, or dockerhub.
- Follow the instructions on how to deploy the module to IoT Edge [here][#Using-the-module].
- Make sure the Prerequisites are set up.
- Change into the repo root and ensure the .env file containing an entry for
PCS_IOTHUB_CONNSTRING
exists. - Open the
azure-iiot-opc-twin-module.sln
solution file in Visual Studio or VS Code - Configure the
Microsoft.Azure.IIoT.Modules.OpcUa.Twin.Cli
project properties to pass--host
as command line argument when starting. - Set the
Microsoft.Azure.IIoT.Modules.OpcUa.Twin.Cli
as startup project and start debugging (e.g. by pressing F5).
Refer to our contribution guidelines.
Please enter issues, bugs, or suggestions as GitHub Issues here.
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License.