Example: ExtensionModules
Product: CODESYS Application Composer
This example shows how to use extension modules. Extension modules are employed when existing modules do not correspond to the defined demands in a specific project.
Description
This example consists of a library with module declarations which are used in a project with a module tree and an application.
Extension modules are used to create copies, derivations, or variations of modules in order to adapt or extend existing modules to a special case. You can use extension modules, for example, if you need to add functions which are only relevant for a specific project.
In this example, a module is extended for such a special case.
![]() |
For more information, see: Command: Create extension module.
Additional information
The module tree of the sample project contains an nearly complete fire engine. Only the water tank is missing. Now an extension module should be used for the water tank.
In the module tree, select the integrated water tank slot and execute the Create Extension Module command in the context menu (1).
The New extension module dialog opens.
In the Variation of list box (2), all modules are listed which fulfill the interface of the selected slot. An option is also provided for not creating any variation. Modules from the project-specific POU pool are considered just as those which are defined in available libraries.
Select whether the extension module should be derived from the existing module in the library or whether its entire source code should be copied into the project and edited there later
The code of the extension module is created in the POU pool of the project. The module declaration is displayed for extension modules not as text, but with the help of a special editor which allows for limited editing of the module declaration by means of menus. More or fewer changes can be made to this extension module depending on the creation type.
For derived modules, methods and properties can be overridden.
The copied source code can be modified as needed.
If no variation of an existing function block is desired, then a new function block is created which fulfills the slot interface. Then you need to program out the methods and properties of this function block.
System requirements and restrictions
Programming system | CODESYS Development System (version 3.5.17.0 or higher) |
Runtime system | CODESYS Control Win (version 3.5.17.0) |
Add-on components | CODESYS Application Composer |
Note
DOWNLOAD Projects