Step 2: Create Submodule "Switch"
The next step is to declare a module for the switch of the room. Again, a module declaration and a function block must be created. Here, both are called Switch
, where the declaration has to be implemented by the function block. The module declaration of Switch
does not need a toplevel section, because it will be added below the module Light
(described later) in no toplevel position. As it is mandatory for all module implementing function blocks, the function block Switch
has to extend AC.Module
, too. For the case at hand, the function block also implements an interface ISwitch
, which has to be created. This interface itself must implement the interface IModule
, which is provided by the library AC_ModuleBase
. However, the interface ISwitch
remains "empty" – no properties or functions are declared.
Further the switch needs an input signal (probably from an external source / physical switch) to indicate when it is tapped. This signal is declared in the IO section using the variable xIn
of the function block which implements this module. Furthermore, a reference time is needed to distinguish the two functions of the switch: Pressing the switch for the time duration tTimer
starts the dimming function - a shorter press only switches the light on or off. This variable tTimer
(also being part of the module implementing function block) will be declared as a parameter of the module (section Parameters
), which eventually can be easily edited when using the module.
Switch

The referenced variables xIn
and tTimer
are both defined as Inputs of the function block Switch
, where the parameter tTimer
gets an initial default value of 500ms. So, when the user pushes the Switch
longer than 500ms, the light will be dimmed.
Switch
function block
Also the text lists and the image pool have to be extended to include the needed description texts of the input and the parameter.
