Pilz#Let’s try using PITReader’s OPCUA interface!

This article describes the procedure to access Pilz’s PITReader from CDP Studio to OPC UA Server. reComputer R1025-10 from SEEED STUDIO and ert3 from Yokogawa Electric are used as Runtime for CDP Studio.

Come on, let’s enjoy FA.

Reference Link

http://soup01.com/en/category/iec61499_en/cdpstudio-en/

Pilz#Let’s use PITReader’s REST API!
CDPStudio#Let’s play with Yokogawa Electric’s ert3!

OPCUA with PITreader

PITreader OPC Server UA is an embedded OPC server, available in a variety of device types and versions.

The PITreader OPC UA server provides process and device data from PITreader to the visualization system. The OPC UA server can also read data from PITreader.

Note that a maximum of one client connection can be established at a time to PITreader’s OPC UA server, and the OPC UA client can be, for example, the OPC UA client of the visualization system PASvisu or a third-party OPC UA-enabled client. The OPC UA client can be, for example, the OPC UA client of the visualization system PASvisu or a third-party OPC UA-enabled client.

Properties

PITreader OPC Server UA supports the following OPC UA properties for access from OPC UA clients:

  • UA Binary Protocol via TCP
  • The Format of the OPC UA Url EndPoint is as follows
    • opc.tcp://<IP address>:<Port>
      • <IP address>
        This will be the IP address of the PITreader including the PITreader OPC Server UA.
      • <Port>
        Port number of PITreader OPC server UA
      • Default setting 4840
    • Example: opc.tcp://192.168.0.12:4840

Limits of the PITreader OPC Server UA

PITTreader’s Messe Event Hall Publishing Interval Min. 500 ms, max. 15000 ms. In the Subscription, if the OPC UA client uses a value less than 500 ms for “PublishingInterval”, the PITreader OPC Server UA will use the minimum value of 500ms for the PublishingInterval. Also, if a value greater than 15000 ms is used for “PublishingInterval”, the PITreader OPC server UA will use the maximum value of 15000 ms for “PublishingInterval”.

Client certificate

Client certificates must meet the following requirements

  • DER or PEM format certificates
  • RSA certificates with a key length of 2048 bits and SHA2 (256 bit)
  • The certificate must include the client’s application URI in the “Subject Alternative Name” field.

DER and PEM are encoding formats for digital certificates and cryptographic keys, which are widely used, especially in handling X.509 certificates.

DER (Distinguished Encoding Rules)

DER Binary Format, a binary format for data structures described in ASN.1. It is typically used in applications where a strict binary format is required.

Usage Example:

  • Java environments and other systems requiring binary data
  • Mobile platforms like iOS and Android

File extensions are .der, .crt, and .cer (binary format).

PEM (Privacy Enhanced Mail):

PEM is Base64-encoded text. PEM encodes certificates in DER format in Base64 and adds header and footer lines to make them easier to read and transmit in a text-friendly environment.

Usage Example:

  • Web Servers
  • E-mail system

File extensions are pem, .crt, .cer, and .key (text format).

Namespace

Here is PITReader’s Namespcae list.

Address space

Here is only the Address space used in this article.

Nameplate

The Nameplate Address space is the information for the corresponding PITTreader product.

Network

The Nameplate Address space is the network information for the corresponding PITTreader product.

PITreader/Transponder

The Nameplate Address space is the information of the Transponder plugged into the corresponding PITTreader.

PITreader/LED

The Nameplate Address space is a function to change the LED information and LED status of the corresponding PITTreader.

Implementation

ert3 Side

The first step is to build from Yokogawa ert3.

Generate the certification

This section describes how to create a configuration file to include the Application URI when using OpenSSL to generate a self-signed certificate and private key for OPC UA. Follow these steps to generate the necessary certificate and key for OPC UA.

Create an ssl Folder.

mkdir ssl
cd ssl

First, generate an RSA private key. Normally, 2048 bits are selected.

openssl genpkey -algorithm RSA -out server_private_key.pem -pkeyopt rsa_keygen_bits:2048

Generate an RSA private key. Normally, 2048 bits are selected.

nano openssl_csr.cnf

The subjectAltName = URI:foobar will need to be adjusted to the CDP Studio settings later.

[ req ]
default_bits       = 2048
distinguished_name = req_distinguished_name
prompt             = no
req_extensions     = v3_req

[ req_distinguished_name ]
C  = JP                           #
ST = Tokyo                        #
L  = Minato
O  = Your Organization             #
OU = Your Unit
CN = yourdomain.com
emailAddress = youremail@example.com  #

[ v3_req ]
keyUsage = digitalSignature, keyEncipherment
extendedKeyUsage = serverAuth, clientAuth
subjectAltName = URI:foobar

Generate CSRs using the configuration file. Execute the following command

openssl req -new -key server_private_key.pem -out server_request.csr -config openssl_csr.cnf

Next, a self-signed certificate is created using the CSR.

openssl x509 -req –in server_request.csr -signkey server_private_key.pem -out server_certificate.pem -days 365 -extensions v3_req -extfile openssl_csr.cnf

If necessary, certificates and keys can be converted to DER format.

openssl x509 -req –in server_request.csr -signkey server_private_key.pem -out server_certificate.pem -days 365 -extensions v3_req -extfile openssl_csr.cnf

Add OPC-UA Client

Next, create a new project from CDP Stuido and add Resources>Search OPC>OPC-UA-Client to the project.

Done!Block for OPC-UA-Client has been added.

End Point

The End Point is the IP address of PILZ’s PITReader.

Port

The Port should match the Port used by the OPC UA Server in PILZ’s PITReader; on Default, the OPCUA Server uses Port 4840.

ClientAppURI

The ClientAppURI must match the URI set in the certificate earlier.

SecurityMode/SecurityPolicy

PITReader by PILZ supports only Sign&Encrypt/Basic256Sha256.

TLS Certificate /Key File

This is the place to set the File name of the Certificate and Private Key for OPCUA communication with PITReader from ert3. Enter the name of the certificate and key generated in the previous step.

AllowURIMissmatch

Finally, depending on the OPC UA Server you are connecting to, put in the Checkbox option of TLSAllowURIMatch.

Add your Certification File

Now add the certificate generated by Yokogawa ert3 to the project.

Click Code>Project>Add Existing Files…. Click Code>Project>Add Existing Files….

Let’s store the certificate and Key generated by Yokogawa ert3 in the Folder of project name>Application.

Done!Certificates and Keys have also been added.

Configure Nodes

Next, open the Block of OPC-UA-Client and build the Node that you want to access the OPCUA Server of PITreader in PILZ.

Nameplate

First,We would like to get the information of the “Nameplate”.

Add ClienObjectNode

Add ClientObjectNode from OPC-UA-IO in Resources on the right in the Block of OPC-UA-Client.

Done!

Next, open the ClientObjectNode you just added.

Example:Add String Node

It is difficult to explain how to add and configure all Nodes, so I will explain how to configure some Objects and Nodes in PITreader.

Let’s add OPC-UA-IO>ClientVariableNode>ClientVariableNode<String> in the OPC-UA-Client Block.

Done!To connect the ClientVariableNode to the OPC UA Server’s Node, a minimum configuration is described.

Name

Nam sets the display name of the corresponding ClientVariableNode. Set the name here to a name that is easy to understand.

IDType

ID Type is the type of OPC UA Server node identifier. In this case, since we will be accessing by numbers, please set it to “Numeric”.

Id

Id is the way Node is expressed when using uaExpert, like ns=2,i=2000. That i=2000 corresponds to the Id in CDP Studio.

Namespaceindex

Namespaceindex is how Node is expressed when using uaExpert, like ns=2,i=2000. That ns=2 corresponds to NamespaceIndex in CDP Studio.

Result

All the Nodes in the Nameplate Namespace have now been added.

Example:PITReader

Finally, here is another configuration example: the Namespace of PITreader contains many Objects and is deeply structured. This example shows how to access these deeply structured OPC UA Objects.

Add PITrader Object

First, add a PITreader Object.

The PILZ instruction manual says Identifier=1001, Identifier Type=Numeric, and the type is Basic Node, so set CDP Studio to match those parameters.

So, ClientObjectNode is set as shown in the figure below.

  • Name=PITreader(It is OK if the display on CDP Studio makes it easy to understand)
  • IdType=Numeric
  • Id=1001
  • Namespace=4
Add LED

Now add the LED Object under PITreader.

The PILZ instruction manual says Identifier=1004, Identifier Type=Numeric, and the type is Structure Node, so set CDP Studio to match those parameters.

Add ClientObjectNode.

ClientObjectNode is set as shown in the figure below.

  • Name=LED (It is OK if it is displayed on CDP Studio and is easy to understand)
  • IdType=Numeric
  • Id=1004
  • Namespace=4
Add State

Add a State Node under LED Object.

Add a ClientObjectNode in the LED’s Block.

The PILZ instructions say Identifier=1009, Identifier Type=Numeric, and the type is Structure Node, so set CDP Studio to match those parameters.

ClientObjectNode is set as shown in the figure below.

  • Name=State(It is OK if it is easy to understand in the display on CDP Studio)
  • IdType=Numeric
  • Id=1009
  • Namespace=4
Add Colour/Flash Mode

Add a Colour Node under State Object.

The PILZ instruction manual says Identifier=2053/2054, Identifier Type=Numeric, and the type is UInt32 Node, so set CDP Studio to match those parameters.

Add a ClientVariableNode<unsigned Int> in the Block of Colour.

ClientObjectNode is set as shown in the figure below.

  • Name=Colour(It is OK if it is easy to understand in the display on CDP Studio)
  • IdType=Numeric
  • Id=2053
  • Namespace=4

ClientObjectNode is set as shown in the figure below.

  • Name=FlashMode (just use the display on CDP Studio to make it easier to understand)
  • IdType=Numeric
  • Id=2054
  • Namespace=4
Add OverWrite

The last section presents the procedure for setting up the OPC UA Server to override the current value of the Node.

LED Blockの中にClientObjectNode “Overwrite”を追加します。

ClientObjectNodeは下図のように設定します。

  • Name=Overwrite (just display on CDP Studio for clarity)
  • IdType=Numeric
  • Id=1010
  • Namespace=4

Add three Nodes, Colour, Actiaveted, and FlashMode.

Set them according to the actual Node Identifier and Identifier Type, etc.

Set up the following diagram so that each Node can be written.

  • Input=True
  • Bidirectional=True

Result

Done!The ert3 side of Yokogawa Electric is now ready.

Pilz PITReader Side

The next step is to set up a PITreader for PILZ.

OPC UA Server

The next step is to configure the OPC UA Server. We will not use the OPC UA Server in this article, but will only explain how to enable the relevant features.

When you click on OPC UA Server, the end point of PITreader is displayed in the WebServer.

Click Generate new certificate to generate a certificate for OPC UA Server.

Please wait a moment…

Done!

Upload 

Select the certificate generated by Yokogawa Denkiert3 for Upload client certificate and upload it to PITreader.

Done!

Seeed Studio Side

The last step is to build the SeeedStudio side: using SeeedStudio’s reComputer R1025-10, create a GUI application inside CDPStudio and access CDPStudio’s Runtime variable in ert3.

Add GUI Project

Right-click on the project>Add New.

Select CDP Application and go to >Chhose.

The default Application Type is Console.

Change its Application Type to GUI and proceed with Next>.

Create your project with Finish.

Done!GUI project added.

Configure Toolkit

SeeedStudio’s Recomputer R1025 is a 64-bit OS Raspberry Pi, so set the Toolkit to “ARMv86 64 bit (Debian 11)”.

Create your GUI Application

Next, click on the Design button to create a GUI screen.

This is the GUI screen to be run on SeeedStudio’s Recomputer R1025. Please refer to the Reference Link for detailed screen creation. Only a few important settings are introduced here.

Label

This section describes the Field that is set to change the display of the Label component.

This section describes the Field that is set to change the display of the Label component.

Lamp

This section describes the Field to be set to trigger the ON/OFF color of the Lamp component.

Assign the appropriate variables to cdpStyleRouting.

Button

The last section describes the settings for changing the current value of a variable after the Button component is clicked.

For CDPBaseButtonMsg, set the following settings according to your application.

  • cdpRouting:Variable whose current value you want to change
  • cdpParameter:Write value

Download

Finally, let’s download the project to Yokogawa’s ert3 and SeeedStudio’s Recomputer R1025 at the same time.

Result

You can see the actual operation in this video.

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

シェアする

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

フォローする