Object Parameter List
Symbol:
If you want to configure global constants, which are provided by the library, at a later stage in a PLC project, you can define them in a parameter list. A parameter list is a special type of a global variable list.
Creating an object Parameter List
- A library project is open.
- 1. In the Solution Explorer, select the PLC project <Projectname.project> in the PLC project tree.
- 2. In the context menu select the command Add > Parameter List…
- 3. Enter a name and click Open.
- TwinCAT adds the parameter list to the PLC project tree and opens it in the editor. You can define the global constants between the keywords VAR_GLOBAL CONSTANT and END_VAR.
Example:
A MyLib library provides an ARRAY variable aMyArray, whose size is defined by the global constant nMaxArraySize. The library is integrated in various PLC projects. The PLC projects use different array sizes, and the global constant from the library should be overwritten by a project-specific value.
The global constant nMaxArraySize is defined within a parameter list when the MyLib library is created. First, a Parameter List object with the names MyParameterList is added to the PLC project with the command Add in the context menu. The variable nMaxArraySize is declared in the editor for the object.
The library MyLib is integrated in a PLC project. The library manager is opened to replace the value of the global constant with a project-specific value. The library is selected in the upper section. The function block tree with the parameter list MyParameterList is displayed in the lower section. The parameter list is selected. The Library Parameters tab with the declarations contained in the parameter list opens at the bottom right. The value of the global constant nMaxArraySize to be edited is selected in the column Value (editable). Pressing the space bar opens an input field, where the required new value for nArraySize can be entered. When the input field is closed, the value is applied to the local scope of the library.
Exporting and importing parameters
Available from TwinCAT 3.1 Build 4026 |
Exporting parameters:
- A library with parameter list is selected in the library management.
- 1. In the library management, select the parameter list.
- 2. Select the command Export Library Parameters… from the context menu
- 3. Select a folder, enter a file name and click Save.
- The edited values from the parameter list are saved in a csv file.
Importing parameters:
- A library with parameter list is selected in the library management.
- 1. In the library management, select the parameter list.
- 2. Select the command Import Library Parameters… from the context menu
- 3. Select a csv file with saved parameters and click Open.
- The values stored in the csv file are inserted into the parameter list.