Symbol Configuration
Tip
For providing symbols to an OPC UA Server, we recommend using the Communication Manager with the new configuration editor (IEC Symbol Set Configuration) for CODESYS 3.5 SP18 and higher.
The symbol configuration described on this page is outdated and should no longer be used.
Use the symbol configuration to prepare symbols with specific access rights for project variables. You can use these symbols to access the variables externally.
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
proj_xy.PLC1.application.xml
Tip
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. For more information, see: SFC Element Properties
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 always have to provide the complete symbol name in this syntax.
MyApplication.PLC_PRG.a
or MyApplication.SymFB.a
Tip
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 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 Applications 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 the 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.
Important
When attribute pragmas are used for POUs and variables, the behavior of these POUs and variables can change with respect to the symbol configuration.
For more information, see: Attribute Pragmas – Effects on symbols
Creating a symbol configuration
Requirement: The project can be compiled without any errors.
In the device tree, select the Application object.
Click
.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.
In the CODESYS main menu, click .
The
<project name>.<device name>.<application name>.xml
file is generated in the project directory.
CODESYS transmits the symbol configuration to the controller for an application download or online change.
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. For instructions, see the "OPC UA Server" chapter.
As a requirement for creating symbol sets and for granting access rights 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 for the . 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:
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 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 set.
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 set. Save the project.
Click Yes to the prompt of whether or not the application should be downloaded to the device.
to connect the application to the controller. ClickIn the editor of the symbol configuration, click the Configure Symbol Rights button.
The Symbol Rights tab of the device editor opens.
Click the
(Synchronization) button 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 access rights 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.
For more information, see: Handling of Device User Management and OPC UA Server.