[!NOTE]: Special thanks to Joey Lorich for sharing his original version of this module. You can find his repository here.
Many of the new Azure IoT Services, such as IoT Central, Azure Digital Twins, and the Time Series Insights require data to conform to a well-defined model. This model is described using the open-source Digital Twins Definition Language, which is a core part of IoT Plug & Play.
The data emitted by the OPC Publisher does not immediately conform data that can be described in this model so an additional module is used to make some simple transformations.
The opcPublisher
emits data in this format:
{
"NodeId": "OPC_NODE_ID",
"ApplicationUri": "OPC_APPLICATION_URI",
"DisplayName": "TAG_DISPLAY_NAME",
"Status": "TAG_STATUS",
"Value": {
"Value": "TAG_VALUE",
"SourceTimestamp": "TAG_SOURCE_TIMESTAMP"
}
}
The opcToDtdl
module is a simple Azure Function takes this data and emits the following schema:
{
"NodeId": "OPC_NODE_ID",
"ApplicationUri": "OPC_APPLICATION_URI",
"Status": "TAG_STATUS",
"SourceTimestamp": "TAG_SOURCE_TIMESTAMP",
"TAG_DISPLAY_NAME": "TAG_VALUE"
}
By using a key: value method for tag name and tag it becomes easier to model this data in the DTDL spec, meaning it's compatible with all the modern Azure IoT Services.
The Docker image is available at Docker Hub, but you can customize and build your own here.
[!NOTE:] This edge module is not required to have a production environment for Industrial IoT applications. Hopefully, as technology progresses and OPC UA implementations at the edge keep maturing, there will be better seamless compatibility between those data formats and cloud services. This tutorial just wants to demonstrate that this is one of the many data manipulation methods available to you.