FB_ConstantLightControlEco

FB_ConstantLightControlEco 1:

The function block FB_ConstantLightControlEco() is used for constant light control.

The system tries to match a specified setpoint through cyclic dimming. The control dynamics are determined by a dead time (tDeadTime) and the step size (nStepSize). The dead time specifies the waiting time between the individual steps or increments of the control value, which are determined by the set step size. The smaller the dead time, the faster the control. A freely definable hysteresis (nHysteresis) prevents continuous oscillation around the setpoint. If the actual value is within the hysteresis range around the setpoint, the lamps brightness remains unchanged.

FB_ConstantLightControlEco 2:

If the set step size nStepSize is too large or the hysteresis nHysteresis is too small, the hysteresis range may be "missed". This cannot be prevented by the function block, because the light output nLightLevel is only physically linked to the recorded actual light value, nActualLevel.

VAR_INPUT

bEnable        : BOOL;
bOn            : BOOL;
bOff           : BOOL;
bToggle        : BOOL;
nSetpointValue : UINT := 16000;
nActualValue   : UINT;
nHysteresis    : UINT := 100;
nMaxLevel      : UINT := 32767;
nMinLevel      : UINT := 3276;
nStepSize      : UINT := 10;
tDeadTime      : TIME := t#50ms;
nOptions       : DWORD;

bEnable: Enables the function-block. If this input is FALSE, the inputs bOn, bOff and bToogle are disabled. The control values nLightLevel remains unchanged.

bOn: Switches the addressed devices to nMaxLevel and activates constant light control. Note: an activated but disabled (bEnable = FALSE) function block will automatically resume its functionality, when it´s enabled again.

bOff: Switches the addressed devices off and disables constant light control.

bToggle: The lighting is switched on or off, depending on the state of the reference device.

nSetpointValue: This input is used for specifying the set value.

nActualValue: The actual value is applied at this input.

nHysteresis: Control hysteresis around the set value. If the actual value is within this range, the control values for the lamps remain unchanged.

nMaxLevel: Maximum limit of the control value nLightLevel.

nMinLevel: Minimum limit of the control value nLightLevel. If the light-control requires to dim below this level, nLightLevel is set to "0". The other way around, if nLightLevel is "0", while the control is active, dimming up means setting the lamp to this value first.

nStepSize: Step-Size, by which the control-value nLightLevel is increased/decreased every active dimming-step.

tDeadTime: Dead time between the individual steps dimming up/down the light.

nOptions: Without functionality. Reserved for future developments.

VAR_OUTPUT

nDeviation           : INT;
bControllerIsActive  : BOOL;
bBusy                : BOOL;
bError               : BOOL;
nErrorId             : UDINT;

nDeviation: Current control deviation (set value/actual value).

bControllerIsActive: This output is set once the control is activated.

bBusy: When the control is activated, this output is always set, when the control-value nLightLevel changes.

bError: This output is switched to TRUE if an error occurs during the execution of a command. The command-specific error code is contained in nErrorId. Is reset to FALSE by the execution of an instruction at the inputs.

nErrorId: Contains the command-specific error code of the most recently executed command. Is reset to 0 by the execution of an instruction at the inputs. See Error codes.

VAR_IN_OUT

nLightLevel        : UINT;

nLightLevel: Reference to the actual light-level-output. This output has to be an IN-OUT-Variable, because the function-block demands a read-/write-access.

Operation diagram

The following diagram should make it clear, how the control works in normal operation:

FB_ConstantLightControlEco 3:

First of all, the control will be enabled with a TRUE-signal at the input bEnable. Then, with a rising trigger at bOn the light-level (nLightLevel) will be set to its maximum-value. This has an influence on the surrounding light, measured by nActualValue, as well. With the actual light-level rising above the setpoint-value, the light-level at the output of the control has to be recuced; nLightLevel is now decreased step by step until the measured value nActualValue is within the hysteresis-range (nSetpointValue - 0.5*nHysteresis < x < nSetpointValue + 0.5*nHysteresis).
If the measured light-value decreases eg. by outside influences, the control will increase the light level (nLightLevel) until nActualValue is witlin the hysteresis-range again.

If the Step-size (nStepSize) is too big or the hysteresis too small, the control-value nLightLevel may oscillate around the setpoint-value. The following diagram shows that the actual-value, influenced by the control-value, will always miss the hysteresis-range.

FB_ConstantLightControlEco 4: