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
Create a new project with a CODESYS Control Win controller.
Declare some variables of different types in the program
PLC_PRG.Insert a Communication Manager object below the application.
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:
The City location has to be configured for the certificate.
An OPC UA Server certificate has to be generated
The CRL checks EnableCRLChecks have to be enabled.
The CommunicationMode has to be set to
MIN_SIGNEDorSIGNED_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.
[CmpOPCUAServer] NetworkAdapter="eth0"
Key | Default Value | Runtime System (and higher) | Description |
|---|---|---|---|
| 100 | V3.5 SP 17 | Defines the number of nodes which are accepted by the corresponding OPC UA service. The |
| 100 | V3.5 SP 17 | |
| 100 | V3.5 SP 17 | |
| 100 | V3.5 SP 17 | |
| 100 | V3.5 SP 17 | |
| 100 | V3.5 SP 17 | |
| 100 | V3.5 SP 17 | |
| 100 | V3.5 SP 17 | |
| 100 | V3.5 SP 17 | |
| 100 | V3.5 SP 17 | |
| 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. | |
| 4840 | V3.5 SP7 | Configures the port used by the OPC UA Server. |
| 1 | V3.5 SP7 Patch 2 | Adds the loopback adapter as an OPC UA endpoint if it is missing in the configuration. |
| 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. |
| 100 | V3.5 SP15 | Defines the minimum sampling rate of the monitored variables (in ms). |
| -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. |
| 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:
|
| 1 | V3.5 SP17 | Configures the resolution of the scheduler of the OPC UA Server (in ms) |
| 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. |
| 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 |
| 50 | V3.5 SP17 | Maximum possible continuation points per session. The parameter is required so that the client can subsequently browse for information. |
| Unlimited | V3.5 SP17 | Maximum possible publication requests per session |
| Unlimited | V3.5 SP17 | Maximum possible number of subscriptions per session |
| Unlimited | V3.5 SP17 | Maximum number of possible publication messages |