FB_BA_LightGroupDaylight
This template represents a daylight-dependent light control that automatically switches on and off depending on occupancy. It is intended for corridors and passageways. An upstream, optimizing switch-on function FB_BA_LightCtrlValue ensures the specification of a light switch-on value that switches the downstream constant light regulation close to the desired setpoint. As soon as the light is switched on via occupancy, it is automatically readjusted according to the setpoint.
Function
In contrast to the FB_BA_LightGroupConstant template (constant light regulation), only the control mode of the function block FB_BA_LightCtrlConst is used here. It is not necessary to manually override the constant light regulation for corridors and passageways, which is why there is no switch input. If manual switch-on is nevertheless required, the switch should be treated as an occupancy sensor and not linked to the inputs bSwi, bSwiUp or bSwiDwn, as these trigger the override without control.
A rising edge at bPresence activates the function block and it is set directly to the switch-on value optimized by FB_BA_LightCtrlValue.
On a falling edge at the template input bPresence or by setting bResetRoomFunction, the light control block is disabled, whereby, if selected, it still announces its shutdown via a switch-off ramp with a dwell time at a pre-switch-off value. The function is then inactive and the output bControlMode is deleted.
In addition to the internal telegrams from LightEvent and OnValue (teach-in function), the input-side stAreaLighting and stScene are also routed to the selector (PrioSwi).
Here, stArea represents the resulting telegram from the higher levels (area, floor and building), while stScene is reserved for any lighting scene to override the constant light regulation.
The OnValue.stTeachLighting telegram is only active during the teach-in process of OnValue (FB_BA_LightCtrlValue).
The telegram selector (PrioSwi) forwards the telegram with the highest priority - with the same priority, the last telegram sent (last writer wins).
The setpoint for constant light regulation is set using an analog object SpBrightness.
Input stReferenceFeedback
Information about the controlled light actuator or the reference actuator of a group is fed back into the light control function via this input.
The light value of the reference actuator is of particular importance here: If the light actuator is already controlled by another function of the same or lower priority and the template described here now "takes over" control, it must control the actuator based on its existing light value.
The light preset block fOnValue also requires information on the current light value of the controlled group. Since it can only determine the increase in brightness itself, it can only specify the increase on the current light value - the absolute value is the sum of the current light value and the increase.
In addition, current values and states are transmitted and can be displayed via the HMI.
Data exchange HMI
The data exchange with the HMI is realized here in the base class FB_BA_Ext_LightBase (internal function block). The use of the following variables is visible in this template:
- bLightOn_Out: Output information "Light On" to the HMI.
- bErr_Out: Output information "Reference actuator faulty" to the HMI.
- eActualPrio_Out: Currently controlling telegram priority to the HMI.
The initialization of the template takes place within the method FB_Init. |
Block diagram
Syntax
FUNCTION_BLOCK FB_BA_LightGroupDaylight EXTENDS FB_BA_Ext_LightBase
VAR_INPUT
bResetRoomFunction : BOOL;
bPresence : BOOL;
bTeachOnValue : BOOL;
fBrightness : REAL;
stAreaLighting : ST_BA_Lighting;
stScene : ST_BA_Lighting;
stReferenceFeedback : ST_BA_LightActuatorFeedback;
END_VAR
VAR_OUTPUT
stLighting : ST_BA_Lighting;
bAdjusting : BOOL;
END_VAR
VAR_INPUT CONSTANT PERSISTENT
fHys : REAL;
nRampTi : UDINT;
nPreOffRampTi : UDINT;
nBrtnsAdjTi : UDINT;
fPreOffVal : REAL;
nPreOffDly : UDINT;
fMinVal : REAL;
nMinOffDly : UDINT;
nMinOnDly : UDINT;
fLgtT : REAL;
END_VAR
VAR_INPUT CONSTANT
SpBrightness : FB_BA_AV_Op;
OnValue : FB_BA_LightCtrlValue := ( ePrio := E_BA_LightingPrio.eMaintenance);
LightEvent : FB_BA_LightingEvt := ( ePrio := E_BA_LightingPrio.eSimple);
END_VAR
VAR
ConstLgtCtrl : FB_BA_LightCtrlConst;
PrioSwi : FB_BA_LightingTgmSel4;
END_VAR
Inputs
Name | Type | Description |
---|---|---|
bResetRoomFunction | BOOL | This input switches off the constant light control function block. Switch-off takes place via a ramp and dwell time on a basic light value, see parameters: fPreOffVal, nPreOffDly and nPreOffRampT. |
bPresence | BOOL | Presence signal input. In the template, the constant light control block is preconfigured in fully automatic mode so that a rising edge at this input switches the function on and a falling edge switches the function off. |
bTeachOnValue | BOOL | Starts the teach-in process on the function block FB_BA_LightCtrlValue. A light control telegram with priority eMaintenance is used to switch the light once to 0% and once to 100%. Due to the high priority of the telegram (eMaintenance), manual and automatic telegrams on the priority switch PrioSwi are overridden. |
fBrightness | REAL | Current brightness for constant light automatic: Range and unit depend on the light sensor. |
stAreaLighting | Resulting telegram from the higher levels (area, floor and building), which is formed in the function block FB_BA_AreaLighting. | |
stScene | Reserved telegram input for scene control. | |
stReferenceFeedback | Feedback input of the controlled light actuator or the guide light of the controlled group. |
Outputs
Name | Type | Description |
---|---|---|
stLighting | Resulting output program. | |
bAdjusting | BOOL | The constant light control block is in regulation mode or the switch-on function is in teach-in mode. This signal can be used to query light sensors, which do not operate in analog mode but via communication, more frequently and thus achieve a more favorable control behavior. |
Inputs CONSTANT PERSISTENT
Name | Type | Description |
---|---|---|
fHys | REAL | Constant light automatic: Hysteresis band. The constant light regulation controls the output up or down until the measured brightness reaches or slightly exceeds or falls below the target value. The light is then considered as adjusted. Only when the measured brightness exceeds or falls below the setpoint by fHys/2, it is readjusted again. The range and unit depend on the used light sensor, see above: fBrtnsSP and fBrtnsSen. Pre-set to 50 in FB_Init. |
nRampTi | UDINT | Control ramp of the constant light automatic in seconds, related to a dimming from 0 to 100%. Pre-set to 60 s in FB_Init. |
nPreOffRampTi | UDINT | Ramp used to drive to a base value fPreOffVal before switching off. Pre-set to 2 s in FB_Init. |
nBrtnsAdjTi | UDINT | Waiting time in seconds after switching on the light for the light sensor to detect the correct value. Is used both by the light preset function OnValue and by the light control block ConstLgtCtrl. |
fPreOffVal / nPreOffDly | REAL / UDINT | Base value and hold time at this value before switching off the overall function. If the current light value already falls below the base value, this function is not active and it is switched off immediately. Pre-set to 4% and 10 s in FB_Init. |
fMinVal | REAL | Constant light automatic: Minimum output value. If this value has fallen below internally (i.e. it is bright enough that no artificial light is needed), the constant light control switches the light off after nOffDly (in seconds) has elapsed. If the light is switched off and the control detects the need for light above the minimum value again, the control switches the light on again after nOnDly (in seconds) to initially fMinVal. Pre-set to 4% in FB_Init |
nMinOffDly | UDINT | Constant light automatic: Switch-off waiting time in seconds, see fMinVal. Pre-set to 300 s in FB_Init. |
nMinOnDly | UDINT | Constant light automatic: Switch-on waiting time in seconds, see fMinVal. Pre-set to 300 s in FB_Init. |
fLgtT | REAL | Light temperature: Pre-set to 3000 K in FB_Init. |
Inputs CONSTANT
Name | Type | Description |
---|---|---|
SpBrightness | Analog input object: Setpoint of the control [lx]. | |
OnValue | Optimizing switch-on function | |
LightEvent | Telegram generator for the light values. The priority is pre-set to eManualActuator. |
VAR
Name | Type | Description |
---|---|---|
ConstLgtCtrl | Constant light control block. | |
PrioSwi | Telegram selection. |
Requirements
Development environment | Necessary function |
---|---|
TwinCAT from v3.1.4024.56 | TF8040 | TwinCAT Building Automation from V5.8.0.0 |