FB_BA_LightCtrlValue
This function block is used to determine a switch-on value (0..100%) for constant light regulation so that it starts with a brightness close to the setpoint and the light does not have to be adjusted for a long time.
Function
The functions of this function block are only available if it is enabled with a TRUE signal at bEn. Otherwise, the output fOnValue assumes the default value at the input fOnValDefault. If fOnValDefault is not connected, it is set to 50 by initialization.
Teach-in
In the enabled state (bEn = TRUE), the function block can be taught-in. A step sequence is started with a rising edge at bTeach.
The light is first switched off via the light control telegram stTeachLighting. Then wait for the time nBrtnsAdjTi in seconds so that the light sensor can correctly detect the lighting conditions. The brightness value that is read in via the input fBrtns is saved. The light is now set to 100% and nBrtnsAdjTi is waited for in seconds again. The difference between the recorded brightness value and the stored value is the possible gain due to artificial light and is stored as a persistent output variable fBrtnsGain. The light value is set to 0 again at the end of the routine.
The light control telegram stTeachLighting is only active during this teach-in phase and has a high priority with ePrio := E_BA_LightingPrio.eMaintenance over the manual or automatic commands that do not represent an alarm. This function block therefore fulfills the condition of being parallel to the constant light regulation - the respective telegrams can ultimately be routed via a priority switch.
In addition, the bTeaching output is set during the teaching phase. This can be used to query light sensors that do not output a continuous signal more quickly, thereby shortening the teaching process.
Principle of operation
If the function block is enabled (bEn = TRUE) and has been taught at least once so that the output value fBrtnsGain has assumed a value greater than zero, an input value fOnValue is calculated continuously:
The difference between the setpoint and actual value, fSP to fBrtns, is compared to the gain from the artificial light fBrtnsGain using the rule of three. This results in the necessary percentage brightness gain. This is added to the current light value present at the fRefLgtVal input.
A function block that has not been taught in is recognized by the fact that the output fBrtnsGain is still at 0. In this case, the default value fOnValDefault is output even if the function block is enabled (bEn = TRUE).
fRefLgtVal
Light value of a single light actuator representing the light zone. With the actual brightness value and setpoint as well as the determined brightness gain fBrtnsGain, only the percentage increase required to start the constant light regulation close to the setpoint can be determined. If the current light value is known, the absolute switch-on value results from the sum.
In most applications, the light value will be 0% before switching on. However, with lighting controllers using priorities, it is possible for a lighting group to be controlled by a lower priority before constant light regulation is switched on and is therefore already at a certain level.
It is therefore important to know the current light control value.
Inputs
VAR_INPUT
bEn : BOOL;
bTeach : BOOL;
fBrtns : REAL;
fSP : REAL;
nBrtnsAdjTi : UDINT := 5;
fOnValDefault : REAL = 50;
fRefLgtVal : REAL;
END_VAR
Name | Type | Description |
---|---|---|
bEn | BOOL | A TRUE signal at this input enables the function block. If the function block has not yet been taught in, i.e. the brightness gain determined at output fBrtnsGain is still 0, the default value fOnValue is permanently assumed at output fOnValDefault. This value is also set if the function block is not enabled (bEn = FALSE). |
bTeach | BOOL | A rising edge at this input starts the teaching process. |
fBrtns | REAL | Input for the measured brightness value. |
fSP | REAL | Input for the brightness setpoint. |
nBrtnsAdjTi | UDINT | Waiting time in seconds that is waited during the teaching process after a light change in order to receive a correct value from the light sensor. |
fOnValDefault | REAL | Standard output value [0..100%] that is passed through at output fOnVal if the function block is either not enabled (bEn = FALSE) or not taught-in (fBrtnsGain = 0). |
fRefLgtVal | REAL | Light value [%] of a single light actuator representing the light zone. |
Outputs
VAR_OUTPUT
fOnValue : REAL;
bTeaching : BOOL;
stTeachLighting : ST_BA_Lighting;
END_VAR
Name | Type | Description |
---|---|---|
fOnValue | REAL | Determined switch-on value. If the function block is not enabled or not taught-in, the default value fOnValDefault is output here. |
bTeaching | BOOL | A TRUE signal at this output indicates that the teaching process is active. |
stTeachLighting | Light control telegram with the pre-set priority E_BA_LightingPrio.eMaintenance. |
Inputs CONSTANT PERSISTENT
VAR_INPUT CONSTANT PERSISTENT
ePrio : BYTE := E_BA_LightingPrio.eMaintenance;
END_VAR
Name | Type | Description |
---|---|---|
ePrio | Priority of the telegram, pre-set to E_BA_LightingPrio.eMaintenance. |
PERSISTENT outputs
VAR_OUTPUT PERSISTENT
fBrtnsGain : REAL;
END_VAR
Name | Type | Description |
---|---|---|
fBrtnsGain | REAL | Determined brightness gain. This value is related to the difference from a brightness (fBrtns) at a light value of 0% to a brightness at a light value of 100%. |
Requirements
Development environment | Required PLC library |
---|---|
TwinCAT from v3.1.4024.55 | Tc3_BA2 from v5.3.19.0 |