Professional Documents
Culture Documents
List of Contents
1. Introduction ............................................................................................................................. 2
2. Employed Software and Firmware Revisions ....................................................................... 2
3. Configurations of OPC UA Server in Controllers .................................................................. 2
3.1 Configuration of OPC UA Variables ......................................................................................................... 2
3.1.1 Types of Supported Variables ................................................................................................................. 3
3.1.2 Maximum Count of OPC UA Variables ................................................................................................... 4
3.2 Cybersecurity Configurations .................................................................................................................. 5
3.2.1 Configuring Cryptography in Nexto Controllers ....................................................................................... 5
3.2.2 Example of Configuration of Cryptography in a OPC UA Client (UaExpert) ........................................... 5
3.2.3 Removing Cryptography from a Nexto Controller ................................................................................... 6
4. Basic Concepts for OPC UA Protocol ................................................................................... 6
4.1 Implemented Subset in Nexto Controllers .............................................................................................. 6
4.2 Subscriptions (Variables Reported by Exception) ................................................................................. 7
4.3 Groups of Variables Reported by Polling ............................................................................................... 8
5. Main Communication Parameters Configured in OPC UA Clients ...................................... 8
5.1 Endpoint URL ............................................................................................................................................. 9
5.2 Publishing Interval (ms) and Sampling Interval (ms) ............................................................................. 9
5.3 Lifetime Count and Keep-Alive Count ................................................................................................... 11
5.4 Queue Size and Discard Oldest ............................................................................................................. 12
5.5 Filter Type and Deadband Type ............................................................................................................. 13
5.6 PublishingEnabled, MaxNotificationsPerPublish and Priority ........................................................... 13
6. Performance Analysis .......................................................................................................... 14
6.1 Ethernet Bandwidth Consumption ........................................................................................................ 14
6.2 CPU Processing Consumption .............................................................................................................. 15
6.2.1 Results of Test Scenarios ..................................................................................................................... 16
6.2.2 Qualitative Conclusions Using Test Scenarios ..................................................................................... 17
7. Revisions ............................................................................................................................... 19
1. Introduction
This application note addresses several aspects related to OPC UA communication with ALTUS
controllers that support an OPC UA server, that is, Nexto series controllers.
Among the described aspects the following are addressed:
Configurations of OPC UA server using the Mastertool IEC XE programmer;
Cybersecurity configurations (cryptography);
Main configuration parameters negotiated with OPC UA clients and their effects in the behavior
and performance of communication;
Performance analysis of OPC UA communication, considering CPU processing consumption
and Ethernet communication bandwidth. The goal is to recommend hints for configuration that
optimize performance and allows to forecast the feasibility of applications in conformity with
the expected performance.
4. Select the GVLs and POUs that contain OPC UA variables, marking the corresponding
checkboxes in the Symbol Configuration object;
5. Expanding the checkboxes of specific GVLs or POUs, it is possible to:
a. Select a subset of variables declared insides these GVLs or POUs for OPC UA
communication;
b. Configure access rights for each variable (read-write, read-only, write-only). Default is
read-write.
The following figure shows an example where all variables of GVL_INT were made available for
communication, and where part of variables of POU UserPrg were made available (only variable
DelTime is available).
UDINT / DWORD 4
LINT 8
ULINT / LWORD 8
REAL 4
LREAL 8
STRING Note 2
TIME 4
LTIME 8
Note 1:
The type BIT cannot really be declared as a simple type, but can be declared inside a STRUCT. In the
controller storage it allocates 1 bit, but in the OPC UA Ethernet frame it allocates 1 byte.
Note 2:
The type STRING allocates N bytes in the controller storage for a string declared with N positions.
However, the size allocated in the OPC UA Ethernet frame varies between 4 and N+4 bytes depending
on the value currently assigned to the string (minimum of 4 when string is empty). The 4 additional
bytes are used to indicate the current size of string.
The size of a structured variable is the sum of sizes of variables that compose the STRUCT. For
instance, consider the following structured type INT_REAL:
TYPE INT_LREAL :
STRUCT
VI : INT;
VL : LREAL;
END_STRUCT
END_TYPE
The size of this type is 10 bytes (2 bytes for INT + 8 bytes for LREAL).
Consider an array of type INT_REAL, for instance:
ARRAY_INT_REAL : ARRAY [1 ... 100] OF INT_REAL;
This array, as a whole, allocates 1000 bytes (100 positions * 10 bytes per position).
Each array position counts as one variable for simple types, or as N variables for structured
types. For instance:
o An array of 100 positions of type INT counts as 100 variables;
o An array of 100 positions of structured type INT_REAL counts as 200 variables.
6. Click on icon for generating a certificate and select the following parameters:
a. Key length (bit): 3072
b. Validity period (days): 365 (can be modified if wanted)
7. Wait while certificate is calculated a transferred to controller (this can take some minutes);
8. Restart (power-down and power-up) the controller.
4. In Security Screen, select folder “Quarantined Certificates” bellow Device. In the right panel a
certificate requested by client UaExpert must be displayed;
5. Drag this certificate to folder “Trusted Certificates”;
6. Go back to client UaExpert and select menu Server/Connect. An error screen will open. Mark
checkbox “Accept the server certificate temporarily for this session” and then press button
“Continue”. If a message box opens indicating a connection error, press button “Ignore”;
7. After this an “Adress Space” opens, where it is possible to navigate and select variables for the
subscription. After this moment, everything works the same way it works for non-secure
connections.
7. Click on icon for removing this certificate from the project and from the controller;
8. Restart (power-down and power-up) the controller.
used in the controller application for preventing that small value changes cause transmission of
variables (see section 5.4 about deadbands);
Subscription 4: parameters of SCADA system application (e.g.: setpoints, alarm levels) that
rarely change. Bandwidth is low because these variables rarely change.
Some OPC UA clients may give different names for these parameters. The names in this document are
in conformance with OPC UA specification.
Figure 5-1. Notifications with variables changing faster than Sampling Interval
In packet 379 (t = 0 s), there is a PublishRequest where the client request to server to transmit a
PublishResponse notifying the variables of subscription which values have changed. The moment when
the server will transmit PublishResponse depends on some factors:
Parameter Publishing Interval, that defines the minimum interval between consecutive
PublishResponse packets of same subscription;
Modification of value of at least one variable of subscription. If no variable has changed value
in the subscription, the interval between consecutive PublishResponse packets of same
subscription can be bigger than Publishing Interval;
Parameter Keep-Alive Count, described in section 5.3. It defines the maximum interval between
PublishResponse packets when all variables of a subscription do not change value for a long
time.
In packet 453 (t = 1 s) the PublishResponse is transmitted, 1 second after the PublishRequest that
requested it. This happens because a previous PublishResponse packet had been transmitted few
milliseconds before the PublishRequest in packet 379 (not shown in figure), and it is necessary to keep
a minimum interval of 1000 ms (Publishing Interval) between consecutive PublishResponse packets.
Note that 1 ms after the PublishResponse in packet 453, a new PublishRequest was transmitted in
packet 456, requesting a new PublishResponse that can arrive at least one second later.
The following Wireshark log shows another communication with a subscription which variables are
changing slower than Sampling Interval, and where Publishing Interval is 1000 ms and Sampling
Interval is 500 ms. In this example, variables are changing value every 3 seconds.
This log shows an interval of 3 seconds between PublishResponse packets, in accordance with the
rhythm of modifications in subscription variables.
This demonstrates that when variables of subscription are changing slowly, bandwidth consumption is
reduced.
Moreover, the size of each PublishResponse packet depends on the amount of variables of subscription
that changed value. This way, the bandwidth consumption is also reduced when less subscription
variables have changed value. In the previous example this is not visible (all PublishResponse packets
have the same size) because all variables of the subscription are being change in the test.
Parameters Publishing Interval and Sampling Interval of each subscription must be configured for
achieving the following goals:
Limit the maximum and medium delays between value change of a subscription variable and its
notification through a PublishResponse packet:
o Maximum Delay = Publishing Interval + Sampling Interval
o Medium Delay = Maximum Delay / 2
Limit Ethernet bandwidth consumption (see section 6.1);
Limit CPU processing consumption in controller (see section 6.2).
If PublishRequest packets are not received by server during a time longer than Lifetime Count
multiplied by Publishing Interval, than the server deactivates the subscription. In this case, the client
must recreate the subscription later if wanted.
In situations where all variables of a subscription do not change value, a long time could pass without
the server sending PublishResponse packets, and therefore the client would not send new
PublishRequest packets, causing unexpected deactivation of the subscription. For avoiding this
situation, parameter Keep-Alive Count was created. If values of variables of subscription do not change
during a time longer than Keep-Alive Count multiplied by Publishing Interval, the server will send an
empty and small PublishResponse packet indicating that no variables have changed. This empty
PublishResponse packet authorizes the client to send immediately a new PublishRequest packed.
The value of Keep-Alive Count must be smaller than the value of LifeTime Count to avoid a spurious
deactivation of subscription. It is suggested that Lifetime Count be at least 3 times bigger than Keep-
Alive Count.
The following Wireshark log shows an example where Lifetime Count is 60, Keep-Alive Count is 5,
and Publishing Interval is 1000 ms, and no variables of subscription are changing value.
Figure 5-3. Packets PublishRequest and PublishRequest with variables not changing value
According OPC UA specification, it is possible to define these parameters for each variable. However,
many clients only allow to define common values for these parameters for all variables configured in a
subscription.
Queue Size must be kept with value 1 because there is no support to events in this server
implementation, so event queues are not necessary. If value of Queue Size is increased, communication
bandwidth and CPU processing consumption can increase, so this must be avoided.
Discard Oldest must be kept with value “enable” so that the PublishResponse packets always report the
more recent value change for each variable.
and this value is recommended for allowing all values changes to be reported in a same
PublishResponse packet.
Priority indicates the relative priority of this subscription compared to other subscriptions. If the server
must transmit several PublishResponse packets in a given moment the sequence of transmissions will
be determined by these parameters. If all subscriptions have the same priority, the PublishResponse
packets will be transmitted in a fixed sequence.
6. Performance Analysis
This section analyzes OPC UA communication performance from the following points of view:
Ethernet bandwidth consumption, considering several influence factors;
CPU processing consumption in the controller, necessary for complying with requirements of
delay specified through parameters Publishing Interval and Sampling Interval, and considering
several influence factors.
Each variable with size S byte (e.g.: 8 bytes for a LREAL) is transmitted using “22 + S” bytes (e.g.: 30
bytes for a LREAL), because other information are transmitted along with the value (timestamp, client
handle, type, etc.).
This way, the communication bandwidth in kbits/seconds will be at least:
Calculated Bandwidth (kbps) = (8 * N * (MS + 22) * MPV / (PI * 100))
For instance, for 5000 LREAL variables changing continuously (MPV = 100%) and with Publishing
Interval equal 1000 ms:
Calculated Bandwidth (kbps) = (8 * 5000 * (8 + 22) * 100 / (1000 * 100)) = 1,200 kbps (1.2
Mbps)
In addition, there are some overheads. The following traffics were measured with Wireshark during one
minute:
Upstream (client to server): filter “tcp.port = 4840 and ip.dst == <server IP address>”
Downstream (server to client): filter “tcp.port = 4840 and ip.src == < server IP address >”
The following tables shows the result for tests with 1000, 2000, 3000, 4000 and 5000 LREAL
variables, with 100% of these variables changing values faster than Sampling Interval.
N (LREAL) MS (bytes) MPV (%) PI (ms) Calculated bandwidth (kbps) Real bandwidth upstream (kbps) Real bandwidth downstream (kbps)
1000 8 100,00% 1000 240 6 253
2000 8 100,00% 1000 480 10 500
3000 8 100,00% 1000 720 14 753
4000 8 100,00% 1000 960 19 1007
5000 8 100,00% 1000 1200 24 1258
The following equations can be used for estimating the real bandwidths:
Real Upstream Bandwidth = 0.03 * Calculated Bandwidth
Real Downstream Bandwidth = 1.06 * Calculated Bandwidth
Note:
With cryptography there is no relevant differences in bandwidth, so the previous equations can still be
used.
4. Percentage of subscription variables that are changing faster than parameter Sampling Interval;
5. Publishing Interval;
6. Sampling Interval;
7. Number of OPC UA clients connected;
8. Cycle time of MainTask;
9. Number of subscriptions.
Besides showing the results for the several test scenarios, this section also presents some qualitative
conclusions about performance, related to the influence factors previously listed.
For instance, tests T37, T38 and T39 (5000 INTs) demonstrate an increase from 43% to 55% in
processing consumption, when percentage of variables changing value varies from 0% to 100%.
Influence of Number of Connected OPC UA Clients
In these tests all clients have the same configuration for subscriptions.
Discounting a basic processing consumption common for all clients, the remaining processing
consumption is proportional to the number of connected clients.
For instance, test T45 (a single INT variable) consumes 4.7%, and this can be considered as the basic
processing consumption common for all clients.
From tests T30 (1 client: 27.5 %) and T32 (2 clients: 46.4%) it is possible to note that:
(27.5% – 4.7%) is about the half of (46.4% – 4.7%).
Influence of MainTask Cycle
The MainTask cycle time has a minor influence in results.
This is demonstrated comparing tests T10 (cycle of 100 ms: 16.3%) and T11 (cycle of 10 ms: 15.5%),
that produced similar results.
Influence of Number of Subscriptions
Splitting variables in multiple subscriptions has a minor influence in results. This is demonstrated
comparing tests T30 (2000 variables in same subscription: 27.5%) and T48 (two subscriptions, each
one with 1000 variables: 28%), that produced similar results.
However, there are advantages in dividing variables in multiple subscriptions because it is possible to
select different parameters (Publishing Interval and Sampling Interval) for each subscription.
Comparing tests T50 and T52, note that it was possible to reduce processing consumption from 42% to
34.5% increasing Publighing Interval and Sampling Interval of only one of the two subscriptions. This
measure also reduces Ethernet bandwidth.
7. Revisions
Revision of this document is shown in the header of this document.
Revision: A
Date: 30/11/2018
Author: Osmar Brune
Reviser: Roberto Martiny
Approver: Rafael Lima
Changes history:
First emission of document.
Revision: B
Date: 10/12/2018
Author: Osmar Brune
Reviser: Roberto Martiny