Skip to content

digitaltwinconsortium/ManufacturingOntologies

Repository files navigation

OPC UA Reference Solution

Note

This article is the Microsoft OPC UA reference solution, which uses IEC 62541 standard OPC UA PubSub to send telemetry data from the edge to the cloud. It is different from other telemetry configurations of Azure IoT Operations, since Azure IoT Operations also caters for scenarions where no OPC UA-enabled telemetry sources are involved, i.e. OPC UA PubSub is not required between Azure IoT Operations and cloud endpoints. The Azure IoT Operations architecture is described in the Azure IoT Operations Overview.

About this solution

Manufacturers want to use an industrial IoT solution that doesn't lock them in to walled-garden ecosystems. In addition, they want to deploy this solution on a global scale and connect all of their production sites to it to increase efficiencies for each individual site.

These increased efficiencies lead to faster production, better quality and lower energy consumption, which all lead to lowering the cost for the produced goods.

The solution must be as efficient as possible and enable all required use cases such as condition monitoring, overall equipment effectiveness (OEE) calculation, forecasting, and anomaly detection. By using the insights gained from these use cases, manufacturers can then create digital feedback loops, which can apply optimizations and other changes to the production processes fully automatically.

Interoperability is the key enabler for these requirements. The use of open standards such as OPC UA significantly helps to achieve this interoperability, which lead to the establishment of the OPC Foundation Cloud Initiative. This OPC UA reference solution is Microsoft's implementation of the Cloud Initiative's reference architecture.

Prerequisites

This reference solution deploys Azure Arc, which requires the custom-locations application object ID that needs to be passed to the deployment script. You can retrieve it with the following Azure CLI commands:

az login --tenant <tenant_id>
az account set --subscription <subscription_id>
az ad sp show --id bc313c14-388c-4e7d-a58e-70017303ee3b --query id -o tsv

The reference solution also deploys Azure IoT Operations, which requires the following resource providers to be registered in the subscription. Registering a resource provider is a subscription-scope action, so it must be done once by a subscription Owner or Contributor before deployment:

az provider register --namespace Microsoft.ExtendedLocation
az provider register --namespace Microsoft.Kubernetes
az provider register --namespace Microsoft.KubernetesConfiguration
az provider register --namespace Microsoft.IoTOperations
az provider register --namespace Microsoft.DeviceRegistry
az provider register --namespace Microsoft.SecretSyncController

Postrequisites

The reference solution also deploys the Azure IoT Schema Registry, which requires the IoT Operations Arc extension service principal to be granted the Azure Device Registry Administrator role. A subscription Owner or User Access Administrator must create this role assignment by running the following after the deployment completes. Replace <subscription_id> and <resource_group> with your values and <resources_name> with the resourcesName deployment parameter in lowercase:

az role assignment create --assignee a2127957-50f2-44e9-8434-4fed4109fc30 --role "Azure Device Registry Administrator" --scope /subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/Microsoft.DeviceRegistry/schemaRegistries/<resources_name>-schemaregistry

Articles in this reference solution

The following articles describe how to deploy this reference solution as well as how to connect it to various Microsoft services:

Production line simulation

The production line simulation is made up of several stations, using the station OPC UA information model, and a simple manufacturing execution system (MES). Both the stations and the MES are containerized for easy deployment. Their configuration is:

Production Line Ideal Cycle Time (in seconds)
Munich 6
Seattle 10
Shift Name Start End
Morning 07:00 14:00
Afternoon 15:00 22:00
Night 23:00 06:00

Shift times are in local time zone of Seattle and Munich. There are 1 hour breaks between shifts.

The station OPC UA server uses the following OPC UA node IDs for telemetry to the cloud:

  • i=379 - manufactured product serial number
  • i=385 - number of manufactured products
  • i=391 - number of discarded products
  • i=398 - running time
  • i=399 - faulty time
  • i=400 - status (0=station ready to do work, 1=work in progress, 2=work done and good part manufactured, 3=work done and scrap manufactured, 4=station in fault state)
  • i=406 - energy consumption
  • i=412 - ideal cycle time
  • i=418 - actual cycle time
  • i=434 - pressure

The solution uses a digital feedback loop to manage the pressure in a simulated station. To implement the feedback loop, the solution triggers a command from the cloud on one of the OPC UA servers in the simulation. The trigger activates when simulated time-series pressure data reaches a certain threshold. You can see the pressure of the assembly machine in the Azure Data Explorer dashboard. The pressure is released at regular intervals for the Seattle production line. In a real-world deployment, something as critical as opening a pressure relief valve would be done on-premises. This example simply demonstrates how to achieve the digital feedback loop.

OPC UA certificate trust

The simulation stations accept anonymous/untrusted OPC UA sessions only until a CA certificate is pushed to them via OPC UA Part 12 Server Push. After that, each station accepts a client certificate only if its issuer matches a certificate in the station's pki/issuer/certs store. Azure IoT Operation's connector for OPC UA uses a self-signed application instance certificate, so without extra configuration the stations would reject it once provisioned.

The deployment script establishes the required two-way (mutual) trust automatically, after Azure IoT Operations is installed:

  1. Stations trust AIO. AIO's connector certificate is a self-signed, cert-manager-managed application instance certificate stored in the Kubernetes secret aio-opc-opcuabroker-default-application-cert (namespace azure-iot-operations) — you retrieve it, you don't generate it.

    The script copies this certificate into each station's issuer certs and trusted certs store.

  2. AIO trusts the stations. The script adds all CA certificates found in the GDS Certificate Authority (CA) store to AIO's connector trust list.

    AIO stores this in the aio-opc-ua-broker-trust-list secret.

Note

This is the automated equivalent of the mutual-trust procedure in Configure OPC UA certificates infrastructure for the connector for OPC UA.

Access the Arc-enabled Kubernetes cluster from the Azure portal

When you browse the Kubernetes resources of the Arc-enabled cluster (or the Azure IoT Operations instance) in the Azure portal, you are prompted for a service account bearer token. Generate one by logging on to the deployed VM via SSH and then running the following commands:

# Create a service account (in the default namespace).
sudo kubectl --kubeconfig /etc/rancher/k3s/k3s.yaml create serviceaccount arc-portal-user -n default

# Grant it cluster-admin so it can view all resources.
sudo kubectl --kubeconfig /etc/rancher/k3s/k3s.yaml create clusterrolebinding arc-portal-user-binding --clusterrole cluster-admin --serviceaccount default:arc-portal-user

# Create a long-lived token secret for the service account.
sudo kubectl --kubeconfig /etc/rancher/k3s/k3s.yaml apply -f - <<EOF
apiVersion: v1
kind: Secret
metadata:
  name: arc-portal-user-secret
  annotations:
    kubernetes.io/service-account.name: arc-portal-user
type: kubernetes.io/service-account-token
EOF

# Print the token, then paste it into the portal's "Service account bearer token" prompt.
sudo kubectl --kubeconfig /etc/rancher/k3s/k3s.yaml get secret arc-portal-user-secret -o jsonpath='{$.data.token}' | base64 -d

Manufacturing Ontologies

The manufacturing ontologies defined in this repository are described by leveraging the W3C Web of Things (WoT), which is specified here. They were generated by an open-source DTDL-WoT conversion tool available here. A comparison between DTDL and WoT and how the two specs interoperate is described here.

International Society of Automation 95 (ISA 95 / IEC 62264)

ISA95 / IEC 62264 is the manufacturing ontology leveraged by this solution. It is a standard and described here and here. The OPC UA Companion Specification for it is available here and here.

License

Creative Commons License

This work is licensed under a Creative Commons Attribution 4.0 International License.

About

A reference solution for leveraging manufacturing ontologies.

Resources

License

Stars

238 stars

Watchers

14 watching

Forks

Packages

 
 
 

Contributors