Skip to content

Code-and-Compile/OPC-UA-Server-Simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OPC UA Server Simulation

About repository

In this repository you will find an example of OPC UA Server simulation where Node-RED act as OPC UA Server. Required nodes:

This respository is part of OPC UA Course published at ✅ https://codeandcompile.com/course/learn-opc-ua-with-node-red

What you can do with this repository?

  • Simulating OPC UA Server using flow variables Testing 3rd party OPC
  • UA client for read and write operations Creating a layer of OPC UA
  • over non OPC UA devices like Arduino, relay based PLC etc.

How to use this repository with PLC or Arudino?

  • Read the controller (PLC or Arduino) using Serial or MODBUS TCP/IP communication.
  • Store the information in the flow variables by replacing the timestamp (test values).
  • That's it, your device is ready to be accessed via OPC UA client

Understanding flow:

OPC UA variable declaration

OPC UA variables are defined in the following node. Open this node and check the Address space to see the variable declaration

image

Write to OPC UA Input variables

In this example, inject nodes with regular interval are used to inject random values to the flow variables which are used in the OPC UA input variable declaration.

image

Write to OPC UA Output variables

In this example, random math function is used to write random values to the flow variables which are used in the OPC UA output variable declaration.

image

Data flow Case 1: Using random values

graph LR
A[Random values] --Write--> B[Node-RED flow variables] --Write Input variables--> C[OPC UA Server] 
B --Write Output variables--> C
Loading

Data flow Case 2: Using Arduino values

Read data

graph LR
A[Arduino I/Os] --Reads via Serial--> B[Node-RED flow variables] --Write to variables--> C[OPC UA Server] 
Loading

Data flow Case 3: Using PLC values

Read data

graph LR
A[PLC I/Os] --Reads via MODBUS--> B[Node-RED flow variables] --Write to variables--> C[OPC UA Server] 
Loading

Reading OPC UA variables using UaExpert

image