Skip to main content

Example: Decoupled Modules

Product: CODESYS Application Composer

This example shows how to use decoupled modules. Decoupled modules can be both employed as top-level modules as well as inserted in slots as children of other modules.

Description

The example describes a building which contains rooms. These rooms have switches and lights, each of which is available in two variants. The lights (blinking or steady) can be linked to switches or -buttons. A switch or-button can be linked to several lights. For example, if a light is equipped with both a switch and buttons, then the switch behaves as a main switch which must be pressed before the lights can be operated with the push-buttons. If only switches are installed, then these switch the referencing light. A blinking light automatically switches between on and off when it is switched on.

In the example, the decoupled module describes a shed which is applied both as part of the house and as a top-level module. The application of the shed can be executed on a separate controller, regardless of its use.

. The sample project includes the following:
  • Module declarations

  • Function block declarations

  • Device tree

  • Module tree

_ex_ac_img_decoupled_modules1.png

For more information, see: Decoupled section and Proxies section.

To generate this example, the Standard generator option must be selected.

In order to communicate with the different controllers, the application target of the shed must be set accordingly in the instances of the shed.

_ex_ac_img_decoupled_modules3.png

Three interconnected controllers are required for executing this sample application. For example, the CODESYS Control Win (SoftPLC) product can be used as a second and third controller on a configured virtual machine. If the decoupled module is applied as a submodule but it runs on a separate controller, then the communication takes place via the list of network variables and proxy instances.

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

_example_icon.png DOWNLOAD Projects