FB_BA_LightCtrlConst
This function block is a constant light regulation with manual override.
It can be in the following operating states as described in VDI 3813 sheet 2:
- Disabled: Outputs bControlMode = FALSE and bManualMode = FALSE
- Control mode: Outputs bControlMode = TRUE and bManualMode = FALSE
- Manual override: Outputs bControlMode = FALSE and bManualMode = TRUE
In the active states (control mode, manual override), the light output value fOut can assume any values from 0...100 %, in the non-active state it is fixed at 0 %.
The distinction between "active" and "not active" is important when several light control functions access actuators in alternation.
This makes the function block suitable for interaction with other lighting functions in a priority selection in which the output fOut is regarded as a valid control value depending on the operating status outputs.
The light control function works with an input for the brightness state of a reference lamp due to the possible interaction with other light control functions. If several lighting functions control the same lamp or the same lighting group independently of each other by priority control, the function block does not know whether it is the active one. With the help of the reference input, however, it is always possible to synchronize to the current value before each switching action and to assess before a toggle action whether the light should be switched on or off in the next step.
If it is ensured that the function is the only one that controls the light, the input is not to be assigned. It is pre-initialized with the value -1, which indicates to the function block that the input is not linked.
However, this also means that it is not possible to delete an input link online without distorting the functioning of the function block!
Function
From the non-activated state, this function block operates in two steps: Short button presses at bSwi, bSwiUp or bSwiDown as well as rising edges at bOn, bSetCtrlMod or bPrc initially switch the function to control mode. However, the presence signal input bPrc is only active in full automatic mode.
The operation mode fully automatic or semi-automatic can be parameterized at the input (eMode).
Switch-on behavior
The light control is first switched to the value fOnValCtrl.
The switching of the light takes place with a ramp, which is specified at nSwiTi in seconds related to 0...100%.
If the selected light value is reached, the control remains at this value for the time nBrtnsAdjTi [s] so that the light sensor detects the correct value.
Already during this waiting time, the function can be switched to manual override.
Control behavior
The control now attempts to maintain this setpoint: If the daylight incidence increases, the light control value at the output fOut is reduced. If the total brightness becomes weaker, the light control value is increased. The change also follows a ramp, which is specified at nRampTi in seconds related to 0...100%. The constant light control is a simple I-controller.
To prevent the ramp block from constantly specifying new light values, a hysteresis range can be specified at the fHys input.
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 of the hysteresis depend on the light sensor.
Minimum value of the control
Changes in the lower brightness range are often perceived as annoying.
It can therefore be useful to limit the light control to a minimum control value and then switch off the light completely when the outdoor brightness is very high.
If the control has reached its minimum control value fMinVal and is to regulate down further, it remains at the minimum value for the time nOffDly [s] and then switches to the output value 0.
The measured brightness value is stored before and after switching. The difference resulting from this is the brightness gain by switching on to the minimum value.
The new threshold for switching on again is now the control setpoint minus the brightness gain. If the measured brightness reaches or falls below this threshold value for the time nOnDly [s], the light is switched on again and then controlled to the setpoint.
The choice of this threshold value is illustrated in the following diagram:
- The measured brightness fBrtns initially moves within the tolerance limits around the setpoint fSP. Towards the end of this phase, the brightness exceeds the tolerance range.
- The light control dims the light (control value fOut) until the light setpoint is reached or the light level falls just below in the PLC cycle. The measured light value fBrtns can therefore be slightly below the setpoint, but this is accepted in order to avoid continuous readjustment.
- The measured brightness fBrtns is again within the tolerance limits, as in phase 1.
- It is controlled again, this time to the minimum output control value, which brings the total measured brightness back into the tolerance range.
- The measured brightness increases again due to outdoor brightness and exceeds the tolerance range.
- The measured brightness fBrtns remains above the tolerance range, the internal time nOffDly [s] expires.
- The light is switched off (fOut = 0). The difference between the measured brightness before and after switching off is recorded internally as a brightness gain by switching on the light to the minimum control value. The new threshold that must now be undershot is the control setpoint minus the brightness gain. The choice of this threshold is based on the following considerations:
- Switching the light on again must not result in the measured brightness subsequently being above the tolerance range again, as this could result in the light continuously being switched on and off.
- This threshold is realistic, i.e. > 0: at the start of phase 5, the outdoor brightness was already so high that the control was set to the minimum value. Before the light is switched off in phase 7, more outdoor brightness was added. In the diagram it is clear that the new threshold is reached when the increase in outdoor brightness from the start of phase 5 to the end of phase 6 has passed again – a realistic scene. To be on the safe side, however, an internal check is made not only for falling below the threshold value but also for reaching it (less than or equal to).
- The threshold value is undershot for the time nOnDly [s].
- The light is again first switched to the minimum value and then dimmed up until the measured brightness corresponds to the setpoint fSP.
- The measured brightness fBrtns is again within the tolerance limits around the setpoint fSP.
Manual override
From the control mode the following actions let the function change to the manual mode (outputs bControlMode = FALSE and bManualMode = TRUE):
- Short button presses at the inputs bSwi, bSwiUp and bSwiDwn switch the light on and off alternately.
- With bOn and bOff, targeted switching on or off occurs.
- A long button press at the input bSwi alternately dims the light up and down. Dimming takes place via a ramp, which is specified at nDimTi in seconds related to 0...100%.
- A long button press on the input bSwiUp dims the light up specifically. Dimming takes place via a ramp, which is specified at nDimTi in seconds related to 0...100%.
- A long button press at the input bSwiDwn dims the light down specifically. Dimming takes place via a ramp, which is specified at nDimTi in seconds related to 0...100%.
- A change to the input fSetValMan. This value is then adopted as the new light output value.
"Off" in manual mode means that the overall function is still active!
A positive edge at bRstManMod or bSetCtrlMod switches from manual override back to control mode.
Memory mode
If memory mode is enabled at input bMemMod, the value that the function block had before the last manual switch-off is stored internally. This value is then adopted the next time the system is switched on in manual mode.
If memory mode is disabled, switching on in manual mode always takes place with the value fOnValMan.
Disabling the function
From control mode or manual mode, two events cause the function to change to the disabled state (outputs bControlMode = FALSE and bManualMode = FALSE):
- a falling edge at the input bPrc.
- a TRUE signal at input bRst. This input is intended for central deactivation of the function block or in case there is no occupancy sensor.
On deactivation, a ramp nPreOffRampTi (in seconds related to 100% to 0%) is used to dim down to a base value fPreOffVal. This value represents the time nPreOffDly [s] at the output before switching off. The function block is then deactivated.
During the switch-off phase, the function block can be enabled again to return to normal operation.
Enabling takes place via short button presses on bSwi, bSwiUp or bSwiDown and rising edges on bOn or bPrc. However, the presence signal input bPrc is only active in full automatic mode.
If the light output value before deactivation is already smaller than the mentioned base value, the switch-off routine is skipped and switched off immediately. |
Inputs
VAR_INPUT
bSwi : BOOL;
bSwiUp : BOOL;
bSwiDwn : BOOL;
bOn : BOOL;
bOff : BOOL;
fSetValMan : REAL;
bSetValMan : BOOL;
bSetCtrlMod : BOOL;
bRstManMod : BOOL;
bRst : BOOL;
bPrc : BOOL;
fBrtns : REAL;
fSP : REAL;
fHys : REAL := 50;
nSwiOvrTi : UDINT := 250;
nSwiTi : UDINT := 2;
nDimTi : UDINT := 5;
nRampTi : UDINT := 60;
nPreOffRampTi : UDINT := 10;
nBrtnsAdjTi : UDINT := 5;
fOnValCtrl : REAL := 50;
fOnValMan : REAL := 100;
fPreOffVal : REAL := 20;
nPreOffDly : UDINT := 20;
fMinVal : REAL;
nMinOffDly : UDINT := 300;
nMinOnDly : UDINT := 300;
bMemMod : BOOL;
eLgtActMod : E_BA_LightActivationMode;
fRefLgtVal : REAL := -1;
END_VAR
Name | Type | Description |
---|---|---|
bSwi | BOOL | If the constant light control function block is not yet active, a short button press first switches the control on, then further signals cause the function block to switch to the manual mode and the following applies: short button press: on / off, long button press: alternately dimming up or down. |
bSwiUp | BOOL | If the constant light control function block is not yet active, a short button press first switches the control on, then further signals cause the function block to switch to the manual mode and the following applies: short button press: on / off, long button press: selective dimming up. |
bSwiDwn | BOOL | If the constant light control function block is not yet active, a short button press first switches the control on, then further signals cause the function block to switch to the manual mode and the following applies: short button press: on / off, long button press: selective dimming down. |
bOn | BOOL | If the constant light control function block is not yet active, a TRUE signal first switches on the control, then this input only refers to switching on in manual mode. |
bOff | BOOL | Switches the light off, the constant light control function block is still in manual mode. If the constant light control function block was previously in control mode, it is now in manual mode. |
fSetValMan | REAL | Manual pre-set value. The values at input fSetValMan are adopted as the light output value by a rising edge at bSetValMan. When the function block is set, it switches directly to manual mode, regardless of whether it was previously in control mode or in the disabled state. |
bSetValMan | BOOL | Adoption of the manual pre-set value, see fSetValMan. |
bSetCtrlMod | BOOL | A rising edge puts the function block directly into control mode, regardless of whether it was previously in the deactivated state or in manual mode. |
bRstManMod | BOOL | This input allows the constant light control function block to switch back to automatic mode if it is in manual mode. |
bRst | BOOL | This input switches off the constant light control function block. The shutdown is done by ramping and dwell time on a base light value, see below: fPreOffVal, nPreOffDly and nPreOffRampT. |
bPrc | BOOL | Presence signal input. If the constant light control function block is configured in fully automatic mode, a rising edge can activate the function via this input if it was not previously activated and a falling edge can disable it. In semi-automatic mode, only a falling edge at this input disables the constant light function block. "Activating" here means that the function is switched on in manual mode (outputs bControlMode = TRUE and bManualMode = FALSE). Deactivating means: the function is not active in manual or control mode (outputs bControlMode = FALSE and bManualMode = FALSE). |
fBrtns | REAL | Current brightness for constant light automatic: Range and unit depend on the light sensor. |
fSP | REAL | Brightness setpoint for the constant light automatic: An adjustment with fBrtnsSen is aimed at. The range and unit therefore depend on the light sensor. |
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. |
nSwiOvrTi | UDINT | Time [ms] for differentiating between short and long button presses. |
nSwiTi | UDINT | Ramp for the switching functions in seconds, related to a dimming from 0 to 100%. |
nDimTi | UDINT | Ramp for the dimming functions in seconds, related to a dimming from 0 to 100%. |
nRampTi | UDINT | Control ramp of the constant light automatic in seconds, related to a dimming from 0 to 100%. |
nPreOffRampTi | UDINT | Ramp used to drive to a base value fPreOffVal before switching off. |
nBrtnsAdjTi | UDINT | Waiting time [s] after switching on the light for the light sensor to detect the correct value. |
fOnValCtrl | REAL | Switch-on value for control operation, this should be activated with the function previously switched off. |
fOnValMan | REAL | Switch-on value of the manual function, if "Memory mode" is not selected via the parameter eOperationalMode. |
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. |
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 regulation switches the light off after nOffDly [s] has elapsed. If the light is switched off and the controller detects a light demand above the minimum value again, the controller switches the light on again after nOnDly [s] to initially fMinVal. |
nMinOffDly | UDINT | Constant light automatic: Switch-off waiting time in seconds, see fMinVal. |
nMinOnDly | UDINT | Constant light automatic: Switch-on waiting time in seconds, see fMinVal. |
bMemMod | BOOL | Memory mode: When the light is switched on in manual mode, the light assumes the value that the function had before it was last switched off. If the "Memory-Mode" is not active, the switch-on value is defined via fOnValMan. |
eLgtActMod | Activation mode of the light control function. Fully automatic: The light control function is activated by detected presence and deactivated by absence of presence. Button presses can also activate the function. Semi-automatic: Activation of the light control function only by pressing a button; it is automatically deactivated when not occupied. | |
fRefLgtVal | REAL | Light value of a single light actuator representing the light zone. This input is used to assess whether in manual mode the next button press switches on or off, or from which value dimming is to take place. This input is pre-initialized with "-1". If it is not assigned, this is recognized and it is assumed that this function is the only one for controlling the lights. Thus, the output value fOut is used as the light value to assess the next switching actions. |
Outputs
VAR_OUTPUT
fOut : REAL;
bControlMode : BOOL;
bManualMode : BOOL;
bAdjusting : BOOL;
nRemTiminOff : UDINT;
nRemTiminOn : UDINT;
END_VAR
Name | Type | Description |
---|---|---|
fOut | REAL | Light output value, 0...100%. |
bControlMode | BOOL | Indicates whether the function block is operating in control mode. |
bManualMode | BOOL | Indicates whether or not the function block is working. |
bAdjusting | BOOL | The constant light control function block is in regulation 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. |
nRemTiMinOff | UDINT | Control output: The control output is at the minimum value and the timer runs until switching to "0%". This output shows the remaining seconds. |
nRemTiMinOn | UDINT | Control output: The constant light regulation has switched off the light due to sufficient ambient light, but now light is required again and the timer runs down until it is switched on again. This output shows the remaining seconds. |
Requirements
Development environment | Required PLC library |
---|---|
TwinCAT from v3.1.4024.55 | Tc3_BA2 from v5.3.19.0 |