Opto22#Let’s use OPC UA Server in Groov EPIC Controller with Ctrlx OPC UA Client App!

This will be the fourth episode of opto22. This time we will show you how to set up an OPCUA Server with the opto22 EPIC Controller and access it via the OPC UA Clients app in UaExpert and Ctrlx.

Let’s get started!

OPC UA and OPTO22

The groov EPIC system and the groov RIO module can communicate by  using the OT standard OPC UA. In addition, each server is independent and served by software running in EPIC or RIO. Multiple servers can be used simultaneously to meet project requirements.

Native embedded OPC UA server (groov EPIC/RIO firmware 3.4 or later) – authenticated OPC UA clients can access I/O values, PID values, scratchpad areas, and in groov EPIC, PAC Control strategies.

CODESYS- If you are running CODESYS in groov EPIC, you can use the CODESYS server to provide OPC UA access to CODESYS programs and I/O. groov View can also be used as a client of this server.

OPC UA Client APP and ctrlX

The ctrlX OPC UA Client runs as a separate app within ctrlX CORE.

By installing the app in ctrlX CORE, it can connect to the OPC UA server and provide its data to other apps. This allows standardized access to other devices in the network (e.g., other control devices) using OPC UA.

Data from the “OPC UA” server connected by the OPC UA Client App is served by ctrlX CORE using the Data Layer of the ctrlX backend. all data from the OPC UA Client App is available to all Apps in ctrlX CORE. All data in the OPC UA Client App will be available to all Apps in ctrlX CORE.

The ctrlX OPC UA Client App is not installed by default in ctrlX CORE. Therefore, you must first install that App in ctrlX CORE.

Reference Link

Opto22

http://soup01.com/en/category/opto22_en/

Ctrlx

http://soup01.com/en/category/bosch_en/ctrlx-en/

Implementation-1

For the first connection test, I would like to launch the OPC UA Server from Opto22 and access it from UaExpert.

Configuration

Access GroovManage from the Web Browser and open Data Service.

Click “Add OPC UA” from the OPC UA Server Field.

The OPC UA Server configuration screen appears.

TCP Port

This Field is used to configure the OPC UA Server Port number of the Groov CPU.

Discovery Endpoint

The Endpoint URL Configuration when OPC UA Client accesses OPC UA Server of Groov CPU.

Enable

Of course, you must enable Groov’s OPC UA Server feature.

Allow Anonymous Access

By Default, Anonymous access is prohibited. Leave that setting at Default.

Save

Press the Save button to save your settings.

Result

Start UaExpert, enter the Discovery Endpoint configured in Groov Manage in the Custom Discovery section, and search for the OPC UA Server.

Enter your Username and Password.

The certificate authentication screen will appear and please trust it.

Done!We accessed the OPC UA Server on the Groov CPU.

Implementation 2

Next, we will install OPC UA Client Apps on Bosch rexroth’s Ctrlx and try to make a security connection to the OPC UA Server on the Groov EPIC CPU.

APP Installation

To install OPC UA Client Apps on Ctrlx, access Ctrlx’s Web Server and open Settings.

Click on Apps.

Switch Runtime Mode to Service to install Apps.

Proceed with Continue.

Press the “Install from file” button to install Apps.

Select OPC UA Client Apps > Open to proceed.

Uploading the File to Ctrlx Runtime…

Proceed with Install.

wait a second..

Done!Apps has been installed.

OPC UA Field has been added to the left Slide Bar.

When you open the OPC UA Field, you will see Client. That is the OPC UA Client.

Then click on Client to go to the configuration screen of the OPC UA Client.

Add Client

Click Add OPC UA Client to set up the OPC UA connection for the Groov EPIC CPU.

Configuration

Session name

Session name is the name of the OPC UA Server session to be connected.

Authentication

This is the authentication method setting when connecting to the Server.

Groov EIPC CPU has been configured with Anonymous Login disabled.

Therefore, Authentication should be set to Username.

Endpoint URL

The Endpoint URL should match the OPC UA Server on the Groov EPIC CPU web server. Finally, put in the Persistent Checkbox and save the configuration with the Save button.

Done!Groov EIPC CPU connection was added.

But..

But the connection failed.” An Error Occurredverifying security. In other words, there is a security-related problem.

Once back in Groov Manager and open Data Service.

Open OPC UA Server>Client Certificates.

Under Rejected Client Certificates, you will find certificates that have been rejected by the Groov EIPC CPU.

If you examine the corresponding certificate, you will see in the Subject Alternative Name that it is a Ctrlx certificate.

Click on Trust Certificate to trust the certificate.

Done!Now Ctrlx’s certificate has been moved to the Trusted side.

Result

Looking at the Ctrlx side one more time, it changed to State=CONNECTED.

Let’s check the Node actually accessed from the Data Layer by opening the Settings tab.

Open the Data Layer.

There is a Nodes called opcuaclient.

When you expand it, you will see that you can access the module state of the Groov EPIC CPU.

Implementation3

The last step is to make the data taken by OPC UA Client Apps readable by Ctrlx PLC.

But…DataLayer_RealTime has no data for Opcua Client Apps. 

Because ctrlX PLC Engineering’s DataLayer_Realtime Node is only valid for real-time data provided via the ctrlX data layer, and the OPC UA Client Apps only provide non-real-time data.

Add Library

Then let’s use the Ctrlx library to access the Non-Realtime Node.

Open Library Manager.

Click Add Library.

Import a library called CXA_DataLayer.

Inside is the DL_ReadNode Function Block used in this project.

DL_ReadNode

This function block provides easy access to generic data types from a given node. Any IEC variable of any integer, real, or string type can be passed as a value parameter.

VAR_INPUT

NameTypeDescription
ExecuteBOOL1=Execute
ClientIdIL_HANDLEClient ID of Data Layer
NodeNameREFERENCE TO STRING(255)Node name to access
Value__SYSTEM.AnyTypeValue returned by node

VAR_OUTPUT

NameTypeDescription
DoneBOOL1 = Successful execution
ActiveBOOL1=Executing
ErrorBOOL1=Error exists
ErrorIDERROR_CODEError class
ErrorIdentERROR_STRUCTError Information
SizeDINTNode data size

Get the NodeName

The next step is to obtain the Path of the required Node from the Data Layer screen.

Double-click the Node you wish to access>Actions>Copy ICON.

The Path of the Node is displayed.

Or select the required Node and click directly on the Copies path.

Program

This program on the Ctrlx side uses DL_ReadNode Function Block and CASE statements to repeatedly access the Data Layer Node of the OPC UA Client.

PROGRAM PLC_PRG
VAR
DL_ReadNode :DL_ReadNode;

NodeNameList :ARRAY[0..3]OF STRING(100);
Analog1Value,Temperature1Value:REAL;
Switch1,Switch2 :BOOL;

istep:INT;
END_VAR



//Configure the NameList
NodeNameList[0]:=’opcuaclient/opto/i=85/ns=2;s=Devices/[myid]/OptoMMP/Modules/Channels/Analog1/Value’;
NodeNameList[1]:=’opcuaclient/opto/i=85/ns=2;s=Devices/[myid]/OptoMMP/Modules/Channels/Temperature1/Value’;
NodeNameList[2]:=’opcuaclient/opto/i=85/ns=2;s=Devices/[myid]/OptoMMP/Modules/Channels/switch1/State’;
NodeNameList[3]:=’opcuaclient/opto/i=85/ns=2;s=Devices/[myid]/OptoMMP/Modules/Channels/switch2/State’;


CASE istep OF

0:
DL_ReadNode(Execute:=FALSE);
IF NOT DL_ReadNode.Error AND NOT DL_ReadNode.Active THEN
istep:=10;
END_IF
10:
DL_ReadNode(
Execute:=TRUE
,NodeName:=NodeNameList[0]
,Value:=Analog1Value
);
IF DL_ReadNode.Done OR DL_ReadNode.Error THEN
IF NOT DL_ReadNode.Error THEN
DL_ReadNode(Execute:=FALSE);
istep:=20;
ELSE
istep:=990;
END_IF
END_IF
20:
DL_ReadNode(
Execute:=TRUE
,NodeName:=NodeNameList[1]
,Value:=Temperature1Value
);
IF DL_ReadNode.Done OR DL_ReadNode.Error THEN
IF NOT DL_ReadNode.Error THEN
DL_ReadNode(Execute:=FALSE);
istep:=30;
ELSE
istep:=991;
END_IF
END_IF
30:
DL_ReadNode(
Execute:=TRUE
,NodeName:=NodeNameList[2]
,Value:=Switch1
);
IF DL_ReadNode.Done OR DL_ReadNode.Error THEN
IF NOT DL_ReadNode.Error THEN
DL_ReadNode(Execute:=FALSE);
istep:=40;
ELSE
istep:=992;
END_IF
END_IF
40:
DL_ReadNode(
Execute:=TRUE
,NodeName:=NodeNameList[3]
,Value:=Switch2
);
IF DL_ReadNode.Done OR DL_ReadNode.Error THEN
IF NOT DL_ReadNode.Error THEN
DL_ReadNode(Execute:=FALSE);
istep:=0;
ELSE
istep:=993;
END_IF
END_IF
END_CASE

Result

Done!We are able to access the Data Layer Node!

We read all analog values, temperature values, and Nodes of digital inputs!

Footer_Basic

Please Support some devices for my blog

Amazon Gift List

Find ME

Twitter:@3threes2
Email:soup01threes*gmail.com (* to @)
YoutubeChannel:https://www.youtube.com/channel/UCQ3CHGAIXZAbeOC_9mjQiWQ

シェアする

  • このエントリーをはてなブックマークに追加

フォローする