This is a sample OEE solution to demo the design pattern. Kepware EX Demo Server is used as the OPC UA Server. The Edge Gateway Device is a Windows 10 PC. Both Kepware and Edge Gateway are installed on the same device for simplicity.
- Windows 10 PC
- Visual Studio Code
- Azure Subscription
This sample uses the Kepware EX Server but you can use any other test server like the OPC PLC server, node-red-contrib-opcua or others.
-
Install Kepware EX Demo Server
-
Setup Kepware OPC UA Configuration
- Open
OPC UA Configration Manager
in KepWare Administration - Make sure
opc.tcp://127.0.0.1:49320
endpoint in Enabled
- Open
-
Open the KepwareEX 6 Configuration, and open the files/FullSimulationDriverDemo.json
- This file contains a new Channel configuration named
OEESample
with 3 tags
- This file contains a new Channel configuration named
IoT Hub is used as the cloud gateway to ingest data from multiple OPC Server
-
Create new IoT Hub or use existing is already created.
-
Create a new IoT Edge device and copy the connection string.
IoT Edge enables store & forward functionality as well as secure connection between the OPC Server and the cloud gateway. For this demo we will use docker desktop but for production consider using EFLOW for running linux containers on windows
-
Install Docker Desktop
-
Create new docker network
docker network create azure-iot-edge
-
Install IoT Edge via IoT Edge Installer
-
Copy edge/publishednodes.json file to
C:\IoTEdgeMapping
and update the EndPointUrl if your OPC Server is on a different box. -
Install OPC Publisher Module using Azure Portal
- Use edge/opcpublisher-container-create-options.txt file for container create options
-
Or you can use the edge/edgeManifest.json to create a new edge deployment.
-
Open
OPC UA Configration Manager
in KepWare Administration -
Click on
Trusted Clients
and Import theMirosoft.Azure.IIoT
certificate fromC:\IoTEdgeMapping\pki\trusted\certs
location. -
Open the KepwareEX 6 Configuration, click Runtime -> Reinitialize
-
Restart OPCPublisher module using
iotedge restart OPCPublisher
Data explorer is the near real time big data store to analyze telemetry coming out of the cloud gateway.
-
Create Data Explorer Cluster with
Workload
asDev/Test
andStreaming Ingestion
set toOn
-
Add database named
opcdb
-
Add data connection in the database with connection type as
IoT Hub
and select the IoT Hub that we created in the previous step.- Shared Access Policy=iothubowner
- Table name= [Blank]
- Data format=MULTILINE JSON
- Mapping name=opcua_mapping
-
Open http://dataexplorer.azure.com/, add you cluster
-
Run the kusto/setup.sql script on the opcdb database.
SQL DB is used to store the aggregated data from OEE calculation to enable basic reporting
-
Create SQL DB and run the sql/dbscript.sql script to create the tables
- Make sure to update the Shift configuration values according to you shift timings & timezone
Python function app (serverless compute) is used as the on demand compute to run OEE calculations. The actual calculation code is inside a python package which can be executed in multiple other computes like databricks, synapse spark or even inside a module on the edge.
-
Open the function folder in VS Code and rename
local.settings.txt
tolocal.settings.json
-
Update configuration values in
local.settings.json
file -
Use Visual Studio Code to test & deploy Azure Function as shown here.
-
Call the Function API few times to generate the OEE data.
-
Test below query in SQL Server DB and make sure it returns some results
SELECT * FROM AssetOEE
-
Download and open OEE Power BI Sample Report
-
Connect to your SQL DB and Refresh the report
- Additionally, you can configure data factory to invoke the Function API on a schedular