This functionality is only available for certain module packages.

You are here: EEC > PLC > Program code > Passing variables when code is inserted in accordance with the Plug-Socket principle

Passing variables when code is inserted in accordance with the Plug-Socket principle

If the code of one component is inserted into another in CoDeSysV3 in accordance with the Plug-Socket principle (e.g., insert networks), in addition to the inserted code, all of the variables not already present in the variable declaration of the inserting component are passed. An already declared variable is not written again, regardless of what declaration area (e.g., VAR_INPUT) it is located in or which data type the variable has in the two components.

All of the variables are passed, regardless of whether these are used in the inserted code or not.

Variable declarations with comment in the same line are passed completely into the code of the inserted component. This also applies for block comments that begin in the same line of the variable declarations.

If all of the variables for which there is no declaration area in the inserting component are inserted, the declaration area, including the variable declaration, is inserted.

Declaration areas with flags (CONSTANT, PERSISTENT, and/or RETAIN) are handled as standalone declaration areas, with the following declaration equations applying:

PERSISTENT <=> PERSISTENT RETAIN <=> RETAIN PERSISTENT

Examples for explaining declaration equalities/inequalities:

VAR_INPUT does not equal VAR

VAR does not equal VAR CONSTANT

VAR_OUTPUT PERSISTENT RETAIN equals VAR_OUTPUT PERSISTENT