FB_BA_LgtSwi
Switching and dimming function block - function for two light switches
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. |
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:
- eBA_ClMaxVal : The light level is set directly to the maximum value applicable at the light actuator function block.
- eBA_ClMinVal : The light level is set directly to the minimum value applicable at the light actuator function block.
- eBA_ClOnVal : The light level is set directly to the value that is active at input lrOnVal.
- eBA_ClRstVal : The light level is set directly to the reset value applicable at the light actuator function block. This is the value that was applicable before the last switch-off. Application sample: The light is switched back on again in a conference room after a presentation.
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:
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 |