Use the symbol configuration for preparing symbols with specific access rights for project variables. You can use these symbols to access the variables externally.
For providing symbols to an OPC UA Server, we recommend using the new configuration editor (IEC Symbol Set Configuration) for CODESYS 3.5 SP18 and higher.
When generating code, CODESYS also generates a symbol file (*.xml) which includes the description of the symbols.
The symbol file is stored in the project directory. The name of the symbol file is
composed as follows: <project name>.<device name>.<application name>.xml
Example
proj_xy.PLC1.application.xml
You can also generate the symbol file with the “Generate Code” command. This is very useful when downloading to the PLC is not possible.
The variables that you export as symbols can be bundled in the symbol configuration
editor or defined in the variables declaration using the {attribute 'symbol'}
pragma. Another option is using the element in the SFC editor, where you can define
the implicitly generated element variables that should be exported to the symbol configuration.
The name of the symbol is generated in the symbol configuration in the following syntax:
<application name>.<POU name>.<variable name>
. When accessing the variable, you must always provide the complete symbol name in
this syntax.
Example
MyApplication.PLC_PRG.a
or MyApplication.SymFB.a
As a rule, read-only access applies to symbols for input addresses and for variables that are mapped to input channels. Write access is possible for testing purposes in simulation mode only.
The number of symbols which can be exchanged via OPC UA is limited based on the used PLC type. OPC UA symbols can be configured via two ways:
-
Select the symbols in the “Symbol Configuration” object and enable the flag “Support OPC UA features”. All selected symbols are counted for the OPC UA tag limitation.
-
Define the symbols in the “Symbol Set” object(s) below “Communication Manager OPC UA Server”. All defined symbols are counted for the OPC UA symbol limitation, independently if they are defined in several “Symbol Set” objects.
In case both ways are used in parallel the sum of the symbols is considered for the OPC UA symbols limitation.
The symbol file is downloaded together with the application to the PLC. Depending on the device description, this file can be generated as an additional (child) application. This application is then listed on the “Application” tab of the device editor.
Syntax: <application name>._symbols
.
The symbol application is regarded as a "normal" application with respect to the maximum number of applications on the PLC.
If your controller has a user management, then you can assign different access rights to a symbol to the individual user groups (clients). To do this, place the same symbol in different symbol sets and allow the individual user groups (clients) either to access a symbol set or not. An on-site operator or an operating data record, for example, receives more information and access to the same symbols as remote maintenance.




NOTICE

When attribute pragmas are used for POUs and variables, the behavior of these POUs and variables can change with respect to the symbol configuration.
See also
-
linktarget doesn't exist but @y.link.required='true'
Creating a symbol configuration
Requirement: The project can be compiled without any errors.
-
Select the “Application” object in the device tree.
-
Click “Project Add Object Symbol Configuration”.
The “Symbol Configuration” object is added to the device tree and the objects editor opens.
-
Open the “View” menu of the editor and activate the categories of variables that should be provided in the configuration editor. Click “Build” in the symbol configuration editor.
All variables (according to the currently defined filter in the “View” menu) are displayed in a tree structure.
-
Select the check boxes of individual variables.
Note: Pay attention to the current settings (see the “Settings” button in the menu bar of the editor).
In the field below the menu bar of the editor, information is provided about the current situation with accompanying instructions, as well as controls for corrective actions.
-
Follow the prompt in the field below the menu bar. In the following case, this should be only the information that the modified symbol configuration is transferred with the next download or online change.
Click “Build Generate Code” on the CODESYS menu bar.
The
<project name>.<device name>.<application name>.xml
file is generated in the project directory.
CODESYS transmits the symbol configuration to the PLC for an application download or online change.
See also
Creating symbol sets with different access rights for different control clients
A symbol set is a defined set of symbols. If supported by the target device, you can combine different symbol sets from the symbols of the application in the symbol configuration editor. The information about the symbol sets is downloaded to the controller. Then you can define the user group that has access to each symbol set. Rights are assigned on the “Symbol Rights” tab of the device editor.
As a result, symbol sets allow different client-specific access rights to a symbol in the controller.
You can download changes to a symbol set definition to the controller in an online change. When the application is deleted on the controller, the symbol sets are also deleted. When building the application, you can create and save a symbol file in XML format for each symbol set.
When symbol sets should be used with OPC UA, it is a requirement that a certificate has to be stored for OPC UA.
As a requirement for creating symbol sets and for granting permissions on the controller, the user management has to be configured both for optional and for forced device user management:
-
In the editor of the controller, open the “Users and Groups” tab and click the
button.
-
When the user management is still not enabled, first click [Yes] to acknowledge the prompt about enabling the user management. In the “Add Device User” dialog, specify a new user name and a password for a user of the Administrator group. Then confirm the password and click [OK].
-
In the “Device User Logon” dialog, specify the “User name” and “Password”. Then click [OK]. The user and groups are displayed on the “Users and Groups” tab.
In the following section, you will see an example of steps for creating symbol sets and the assignment of rights on the controller.
Requirements
-
The application has a defined symbol configuration in the project.
-
A user management is configured for the controller (see above). For the example here, there should be a user group that has the necessary rights for the servicing of the plant. By default, this type of user group, named "Service", is already created.
-
The “Enable symbol sets” option is enabled in the settings of the symbol configuration.
-
The connection to the controller is configured in the “Communication Settings” of the device editor.
-
Click the
button in the editor of the “Symbol Configuration” in order to create a new symbol set. In the “Add New Symbol Set” dialog, specify "Startup" as the name for the group.
-
In the toolbar of the dialog, click the
button ([Build]) in order to display all symbols which are available in the project. Select the users who should belong to the group. Save the project.
-
Click Online → Login to connect the application to the controller. Click [Yes] to the prompt of whether or not the application should be downloaded to the device.
-
In the editor of the symbol configuration, click the [Configure Symbol Rights] button. The “Symbol Rights” tab of the device editor opens.
-
Click the
button([Synchronization]) to synchronize the display of the symbol sets with the device.
In “Symbol Sets”, you see all sets that have currently been downloaded for the application (for this example, at least "Startup"). In “Rights”, a table shows the user groups that are created in the user management of the controller. In the example, we assume that the default groups “Administrator” and “Service” have been created. When a symbol set is selected on the left, you see on the right the permissions of the individual user groups to this symbol set (
access granted;
access denied). The possible type of access is already defined for each symbol in the symbol configuration (read, write, execute).
-
On the left, select the [Startup] symbol set and double-click the preset minus sign for "Administrator" as well as for "Service".
The symbol changes into a plus sign. The "Administrator" and "Service" groups now have access to the symbols in the [Startup] symbol set.