Skip to main content

Configuration and commissioning of the OPC UA Server

The OPC UA Server can be adapted to different environments, which may require different levels of security. For this purpose, the OPC UA Server provides various configurable security features.

Important

Changing these settings always requires the PLC to be restarted.

These values can be set by means of the Device Security Settings (OPC UA Server) of the PLC.

For more information, see the following: Using a Secure OPC UA Server

Creating a project for OPC UA access

  1. Create a new project with a CODESYS Control Win controller.

  2. Declare some variables of different types in the program PLC_PRG.

  3. Insert a Communication Manager object below the application.

  4. You can configure the server either based on the information model or as an OPC UA Server (with an implicit information model).

    • If you want to publish data of an OPC UA information model, then add an OPC UA Information Model object below the Communication Manager object.

      The next steps can be found under Using OPC UA Information Models.

    • If you want to exchange IEC variables of the application with other OPC UA Clients via the OPC UA Server, then add an OPC UA Server object below the Communication Manager object.

      The next steps can be found under IEC Symbol Set Configuration.

Specification-compliant configuration of the OPC UA Server

To operate the OPC UA Server according to the OPC UA specification, the following settings are required:

  1. The City location has to be configured for the certificate.

  2. An OPC UA Server certificate has to be generated

  3. The CRL checks EnableCRLChecks have to be enabled.

  4. The CommunicationMode has to be set to MIN_SIGNED or SIGNED_AND_ENCRYPTED.

Configuration settings of the OPC UA Server

To allow an OPC UA Client to access IEC variables, you need to configure the OPC UA Server. This is done in the configuration file CODESYSControl.cfg which is stored in the installation directory of CODESYS in the \GatewayPLC directory.

Example 8. Sample configuration
[CmpOPCUAServer]
NetworkAdapter="eth0"

Key

Default Value

Runtime System (and higher)

Description

MaxNodesPerRead

100

V3.5 SP 17

Defines the number of nodes which are accepted by the corresponding OPC UA service. The OperationLimits of the OPC UA address space are also taken into account. For more details, see the OPC UA specification.

MaxNodesPerHistoryReadData

100

V3.5 SP 17

MaxNodesPerHistoryReadEvents

100

V3.5 SP 17

MaxNodesPerWrite

100

V3.5 SP 17

MaxNodesPerHistoryUpdateData

100

V3.5 SP 17

MaxNodesPerMethodCall

100

V3.5 SP 17

MaxNodesPerBrowse

100

V3.5 SP 17

MaxNodesPerRegisterNodes

100

V3.5 SP 17

MaxNodesPerTranslateBrowsePathsToNodeIds

100

V3.5 SP 17

MaxNodesPerNodeManagement

100

V3.5 SP 17

NetWorkAdapter

V3.5 SP7

Configures the network adapter which should be used by the OPC UA Server.

Example: "eth0", "Ethernet Adapter"

If a configuration does not exist, then all network adapters with a valid IP address are used.

NetworkPort

4840

V3.5 SP7

Configures the port used by the OPC UA Server.

UseLoopback

1

V3.5 SP7 Patch 2

Adds the loopback adapter as an OPC UA endpoint if it is missing in the configuration.

AdapterUpdateRate

5000

V3.5 SP15

Defines the interval in which the OPC UA Server reacts to changed network adapters. Ports are opened or closed depending on whether a network adapter is reconnected or has lost the connection.

ItemMinSamplingRate

100

V3.5 SP15

Defines the minimum sampling rate of the monitored variables (in ms).

NumOfWorkerTasks

-1

V3.5 SP16

Configures the number of worker tasks to be created. The default value -1 generates between 1 and (<number of CPU cores> - 1) worker tasks. The worker tasks are responsible for sampling the monitored variables.

WorkerTasksDynamic

2

V3.5 SP18

Defines whether OPC UA Server worker tasks should be created dynamically depending on the load or statically in order to optimize the start behavior:

  • 0: Static

  • 1: Generate, but pause and resume depending on the load

  • 2: Generate and end depending on the load

SchedulerResolution

1

V3.5 SP17

Configures the resolution of the scheduler of the OPC UA Server (in ms)

SessionsMax

100

V3.5 SP17

Maximum possible number of sessions (only effective if greater than the start size). A session is an online connection of a client.

SecureChannelsMax

50

V3.5 SP19

Maximum number of communication channels supported by the server. Some channels may contain multiple sessions. If the number exceeds the value SOCKET_FDSET_SIZE - <number of open ports>, then not all channels can be used.

ContinuationPointsPerSessionMax

50

V3.5 SP17

Maximum possible continuation points per session. The parameter is required so that the client can subsequently browse for information.

PublishRequestsPerSessionMax

Unlimited

V3.5 SP17

Maximum possible publication requests per session

SubscriptionsPerSessionMax

Unlimited

V3.5 SP17

Maximum possible number of subscriptions per session

PublishNotificationsMax

Unlimited

V3.5 SP17

Maximum number of possible publication messages