FB_BA_AnlgLgtActr
Function block for controlling an analog light actuator, e.g. via a KL2751
Functional description
The function block receives its commands via the command telegram stLgtCmd.
As a conventional analog control function block, it has light value outputs as LREAL value [0..100%], as INT value [0..32767] and as Boolean value (ON/OFF), which enables switching of an OFF relay for certain types of lamps.
This function block must be called in every PLC cycle, since the PLC cycle time is included in the calculation of the dimming ramp. |
Inputs/outputs
VAR_INPUT
lrSttupCtrlVal : LREAL;
lrMinCtrlVal : LREAL;
lrMaxCtrlVal : LREAL;
lrLgtOffset : LREAL;
udiDimTi : UDINT;
uiBlinkTi : UINT;
uiOffDly : UINT;
stLgtCmd : ST_BA_LgtCmd;
lrSttupCtrlVal : light value after restart. [lrMinCtrlVal..lrMaxCtrlVal]. Input in percentage (0%..100%). This value is only used in the first call cycle. Incorrect entries less than lrMinCtrlVal or greater than lrMaxCtrlVal are automatically limited.
lrMinCtrlVal: minimum light output value. [1..lrMaxCtrlVal]. Input in percentage (1%..100%). A change in this value takes effect immediately. Incorrect entries less than 1.0 or greater than 100.0 are automatically limited.
For verification, the resulting value is output at lrActlMinCtrlVal; note that value changes via the command telegram stLgtCmd are also accepted. In each case the last change is valid.
lrMaxCtrlVal: maximum light output value. [lrMinCtrlVal..100%]. Input in percentage (1%..100%). A change in this value takes effect immediately. Incorrect entries less than lrMinCtrlVal or greater than 100.0 are automatically limited.
For verification, the resulting value is output at lrActlMaxCtrlVal; note that value changes via the command telegram stLgtCmd are also accepted. In each case the last change is valid.
lrLgtOffset: option to increase or reduce the brightness value. This only takes effect in conjunction with the command bSetCtrlValDct in the command structure stLgtCmd. In this case, the light actuator is set to lrSetCtrlValDct+lrLgtOffset. The value cannot exceed the set maximum value or fall below the minimum value. Switch-off is possible, if lrSetCtrlValDct+lrLgtOffset is less than or equal to zero.
uiDimTi: dimming ramp [ms]: time in which dimming from 0 to 100% takes place.
uiBlinkTi / udiOffDly: these two times [s] can be used to implement a switch-off warning, e.g. for staircase lighting. These two intervals additionally take effect at the time when the lamp usually switches off: the light is switched off for the time uiBlinkTi [s] and switched on again for the time uiOffDly [s].
stLgtCmd: command telegram of type ST_BA_LgtCmd
VAR_OUTPUT
lrActlLgtLvl : LREAL;
iActlLgtLvl : INT;
bLgt : BOOL;
lrActlMinCtrlVal: LREAL;
bMinCtrlValRchd : BOOL;
lrActlMaxCtrlVal: LREAL;
bMaxCtrlValRchd : BOOL;
lrRstVal : LREAL;
bErr : BOOL;
udiErrId : UDINT;
udiErrArg : UDINT;
lrActlLgtLvl: current control value [0..100%]. Calculation see below.
iActlLgtLvl: current control value [0..32767]
bLgt: current control value (ON / OFF)
lrActlMinCtrlVal: current min value (described via input or command structure)
bMinCtrlValRchd: the actuator has reached its minimum value.
lrActlMaxCtrlVal: current max value (described via input or command structure)
bMaxCtrlValRchd: the actuator has reached its maximum value.
lrRstVal: last value before off as resetting value, i.e. the current control value is stored here before switch-off.
bErr: light function block in error state
udiErrId / udiErrArg: error number and argument for determining the cause; see error codes.
Requirements
The warning messages for auto-correcting the minimum and maximum values are only active for one PLC cycle, since the correction function rectifies the error itself. |
Development environment | Target system | required library | required supplement |
---|---|---|---|
TwinCAT 2.11 R3/x64 | PC/CX | TcBA library from V1.0.0 | TF8040 | TwinCAT Building Automation from V1.0.0 |