Code Monkey home page Code Monkey logo

opc-ua-monitoring's Introduction

OPC UA Remote Monitoring

OPC Unified Architecture (OPC UA) is a machine to machine communication protocol for industrial automation developed by the OPC Foundation. Distinguishing characteristics are: Focus on communicating with industrial equipment and systems for data collection and control. ...OPC Unified Architecture - Wiki

Overview

Make the manufacturuing data available so that it can be visialized and trigger alerts.

  1. OPC UA Demo
  2. OPC UA Server
  3. OPC UA Agent/Client : Presumely it will be deployed on the local network to interact with OPC UA Server(s)
  4. Remote Monitor : Critical information should be delivered for an immediate attention
  5. Visualization

OPC UA Demo

In order to keep the temperature under control, at least two fans should be functional. Otherwise, the temperature goes up gradually (max 100). OPC UA agent sends an alert message at a certain level (re-sends if the temperature is still high after timeout) and waits for the next action (e.g., turn on the backup unit)

  1. OPC UA Agent monitors Temperature and 3 Fans.
  2. Disable Fan #1 from OPC UA Server. (simulating hardware malfunction)
  3. Send an alert message.
  4. Turn on the backup unit (Fan #3). Auto-remediation should be triggered in real world.

OPC UA Server

Install node-red-contrib-opcua from "Manage palette"

104-opcuaserver.js : 4 variables are added for this demo.

           addressSpace.getOwnNamespace().addVariable({
                componentOf: vendorName,
                nodeId: "ns=1;s=Temperature",
                browseName: "Temperature",
                dataType: "UInt16",

                value: {
                    get: function () {
                        return new opcua.Variant({
                            dataType: opcua.DataType.UInt16,
                            value: Temperature
                        });
                    },
                    set: function (variant) {
                        Temperature = opcuaBasics.build_new_value_by_datatype(variant.dataType, variant.value);
                        return opcua.StatusCodes.Good;
                    }
                }
            });

            addressSpace.getOwnNamespace().addVariable({
                componentOf: vendorName,
                nodeId: "ns=1;s=Fan1Status",
                browseName: "Fan1Status",
                dataType: "UInt16",

                value: {
                    get: function () {
                        return new opcua.Variant({
                            dataType: opcua.DataType.UInt16,
                            value: Fan1Status
                        });
                    },
                    set: function (variant) {
                        Fan1Status = opcuaBasics.build_new_value_by_datatype(variant.dataType, variant.value);
                        return opcua.StatusCodes.Good;
                    }
                }
            });
            // Same for ns=1;s=Fan2Status, ns=1;s=Fan3Status

OPC UA Agent/Client

Install node-red-contrib-opcua from "Manage palette"

Remote Monitor and Control

Blynk lets you connect your devices to the cloud, design apps to control them, analyze telemetry data, and manage your deployed products at scale.

Blynk Widget Blynk Pin OPC UA Variable
SuperChart Virtual Pin 0 ns=1;s=Temperature
Button(Switch) Virtual Pin 1 ns=1;s=Fan1Status
Button(Switch) Virtual Pin 2 ns=1;s=Fan2Status
Button(Switch) Virtual Pin 3 ns=1;s=Fan3Status

Only Virtual Pin 3 is writable for this demo.

Visualization

  1. Install node-red-contrib-influxdb from "Manage palette"
  2. Install InfluxDB

$ brew install influxdb

  1. Install Grafana

$ brew install grafana

  1. Start Services ( $ brew tap homebrew/services if necessary )

$ brew services start influxdb grafana

The following data were added to temperature measurement. Use drop measurement <measurement-name> to delete.

Conceptually you can think of a measurement as an SQL table, where the primary index is always time.tags and fields are effectively columns in the table. tags are indexed, and fields are not.

Created multiple regions to visualize the regional data. region east_[2|3|4|5|6] were also simulated. The following msg.payload was sent to influxdb batch node.

return  { payload : [
          {
                      measurement: "temperature",
                      fields: {
                                 temp: value - value2
                      },
                      tags:{
                                 region: "east-2",
                                 ipaddr: "192.123.22.34"
                      }
         },
         {
                      measurement: "temperature",
                      fields: {
                                  temp: value + value2
                      },
                      tags:{
                                 region: "east-3",
                                 ipaddr: "192.123.23.34"
                      }
         },
         ...
         ]       

Related Links

opc-ua-monitoring's People

Contributors

phyunsj avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.