FB_BA_LgtSwi

Switching and dimming function block - function for two light switches

FB_BA_LgtSwi 1:

This function block requires light value feedback at input lrActlLgtLvl, in order to be able to change the light level (toggle command). Without this feedback, which either comes from a single device or as an average from a group, the switch function block does not know the logical state of the light and is unable to toggle to the other state when the keyboard shortcut bSwi is pressed. An example can be found below.

FB_BA_LgtSwi 2:

Functional description

This function block is a combined switch/dimmer.

Various modes (eOnMod) are defined for central switching on at bOn, which can be selected via this enumerator input:

All other commands see below.

The function block sends its commands via the command telegram stLgtCmd.

Inputs/outputs

VAR_INPUT

bSwi         : BOOL;
bSwiUp       : BOOL;
bSwiDwn      : BOOL;
udiSwiOvrTi  : UDINT;
bUp          : BOOL;
bDwn         : BOOL;
bOn          : BOOL;
bOff         : BOOL;
eOnMod       : E_BA_LgtOnMode;
lrOnValue    : LREAL;
bClMinVal    : BOOL;
bClMaxVal    : BOOL;
bSetValDct   : BOOL;
lrSetValDct  : LREAL;
lrActlLgtLvl : LREAL;

bSwi: switch input on/off, dimming up/down: a short signal (< udiSwiOvrTi) turns the light off or on depending on the state. If the switch is kept pressed, the light is alternately dimmed up or down. Dimming up ends when the maximum value is reached, and dimming down ends when the minimum value is reached. The dimming direction is not reversed automatically. If the light is switched off, it is first set to the minimum value, before it is dimmed up.

bSwiUp: switch input On/Off, dimming up: a short signal (< udiSwiOvrTi) turns the light off or on depending on the state. If the switch is kept pressed, the light is dimmed up. Dimming up ends when the maximum value is reached. If the light is switched off, it is first set to the minimum value, before it is dimmed up.

bSwiDwn: switch input On/Off, dimming down: a short signal (< udiSwiOvrTi) turns the light off or on depending on the state. If the switch is kept pressed, the light is dimmed down. Dimming down stops when the minimum value is reached. If the light is switched off, it is first set to the maximum value, before it is dimmed down.

udiSwiOvrTi: switching time [ms] between short/long switch pressing detection, and therefore between switching and dimming.

bUp: dimming up. This input has no switching function and is not affected by the switching time udiSwiOvrTi. The function has no effect when the light is switched off.

bDwn: dimming down. This input has no switching function and is not affected by the switching time udiSwiOvrTi. The function has no effect when the light is switched off.

bOn: central switch-on. The switch-on value depends on the choice of eOnMod, see below.

bOff: central switch-off

eOnMod: selection of the switch-on value (E_BA_LgtOnMode)

lrOnVal: [0...100%] switch-on value, if a central switch-on command comes via bOn and mode eBA_ClOnVal is selected at eOnMod.

bClMinVal: the light actuator function block is instructed to switch to the minimum value.

bClMaxVal: the light actuator function block is instructed to switch to the maximum value.

bSetValDct/lrSetValDct: switches the light actuator function block to the value lrSetValDct [0..100%]. The value lrLgtOffset is applied to this value at the light actuator.

lrActlLgtLvl: [0...100%] this input is used for toggle evaluation. For a group of lamps, it is recommended to create either the average of all actuators or the light value of the group master. The assignment of this input is obligatory, since without this feedback the switch function block does not know the logical light state of the single device or the group.

Sample:

FB_BA_LgtSwi 3:

VAR_OUTPUT

stLgtCmd : ST_BA_LgtCmd;

stLgtCmd: command telegram of type ST_BA_LgtCmd

Requirements

Development environment

Target system

required library

required supplement

TwinCAT 2.11 R3/x64

PC/CX

TcBA library from V1.0.0

TS8040 | TwinCAT Building Automation from V1.0.0