Skip to content

Latest commit

 

History

History
129 lines (67 loc) · 5.67 KB

OEEEngineSample.md

File metadata and controls

129 lines (67 loc) · 5.67 KB

⚠️ In progress

OEE Solution with Near Real Time Availability and Quality

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.

OEE Sample Solution

Prerequisites

  • Windows 10 PC
  • Visual Studio Code
  • Azure Subscription

Install and Configure Demo OPC UA Server

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.

Create and Configure Azure IoT Hub

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.

Install and Configure IoT Edge on Windows 10 PC

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

  • Or you can use the edge/edgeManifest.json to create a new edge deployment.

    IoT Ege List

  • Open OPC UA Configration Manager in KepWare Administration

  • Click on Trusted Clients and Import the Mirosoft.Azure.IIoT certificate from C:\IoTEdgeMapping\pki\trusted\certs location.

  • Open the KepwareEX 6 Configuration, click Runtime -> Reinitialize

  • Restart OPCPublisher module using iotedge restart OPCPublisher

Create and Configure Azure Data Explorer

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 as Dev/Test and Streaming Ingestion set to On

  • 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.

Create and Configure Azure SQL DB

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

Create and Configure Azure Function

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 to local.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

Setup OEE Dashboard

[Optional] - Create and Configure Azure Data Factory

  • Additionally, you can configure data factory to invoke the Function API on a schedular

Additional Resources