FB_BA_LightCtrl

FB_BA_LightCtrl 1:

The function block is a universal block for the implementation of various lighting functions.

It is used to control one or more lights.

It enables the illumination to be controlled manually via a switch or room control unit or the automatic control of a lighting group by means of presence detection. By connecting the function block accordingly, it can be used for the following functions:

Automatic illumination via presence can be combined with manual operation of the illumination via the inputs bSwi, bSwiUp, bSwiDwn, bOn, bOff. The last state change of one of the inputs mentioned is then valid.

If the illumination is switched on via presence detection at the input bPrc, the illumination can be switched off or changed via the inputs bSwi, bSwiUp or bSwiDwn. The manual intervention is valid until a falling edge at bPrc.

If there is another rising edge at the input bPrc, the illumination is switched on again in automatic mode.

However, the illumination is only switched on automatically via bPrc if the automatic lighting system is in fully automatic mode. However, the illumination is only switched on automatically via bPrc if the automatic lighting system is in fully automatic mode.

If the current control value of the illumination is the result of manual operation, the function block is in manual mode. This is displayed at the bManualMode output. If the current control value of the illumination is the result of a positive or negative edge at input bPrc, the illumination is in automatic mode bAutomaticMode = TRUE. The current control value for the lighting group is output at output fOut from 0% to 100%.

FB_BA_LightCtrl 2: Inputs

VAR_INPUT
  bSwi              : BOOL;
  bSwiUp            : BOOL;
  bSwiDwn           : BOOL;
  bOn               : BOOL;
  bOff              : BOOL;
  fSetVal           : REAL;
  bSetVal           : BOOL;
  bRst              : BOOL;
  bPrc              : BOOL;
  nSwiOvrTi         : UDINT := 250;
  nSwiTi            : UDINT := 2;
  nDimTi            : UDINT := 5;
  nPreOffRampTi     : UDINT := 10;
  fOnVal            : REAL  := 100;
  fPreOffVal        : REAL  := 20;
  nPreOffDly        : UDINT := 20;
  bMemMod           : BOOL;
  eLgtActMod        : E_BA_LightActivationMode;
  fRefLgtVal        : REAL  := -1;
END_VAR

Name

Type

Description

bSwi

BOOL

A short press of the button at the input deactivates the illumination if it is currently switched on.

If the illumination is off, it is switched on by a short press of the button.

A long press of the button causes the lights in the light group to brighten or dim.

bSwiUp

BOOL

A short press of the button switches the illumination on.

A long press of the button will cause the lights to become brighter.

bSwiDwn

BOOL

A short press of the button switches the illumination off.

A long press of the button dims the lights.

bOn

BOOL

Regardless of the current state of the illumination, the light is switched to 100% by an edge at the input.

bOff

BOOL

Regardless of the current state of the illumination, the light is switched to 0% by an edge at the input.

fSetVal

REAL

Manual pre-set value. The value at the input fSetVal is taken over as light output value by a rising edge at bSetVal.

bSetVal

BOOL

Takeover of the manual preset value.

bRst

BOOL

This input resets the manual and automatic operation of the function block. This switches off the illumination.

The output fOut follows a switch-off ramp. See fPreOffVal, nPreOffDly and nPreOffRampT.

bPrc

BOOL

Presence signal input. If the function block is in fully automatic mode, a rising edge can enable the function via this input and a falling edge can disable it. The light is switched on or off.

In semi-automatic mode, only a falling edge at this input disables the function block.

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%.

nPreOffRampTi

UDINT

Ramp used to drive to a base value fPreOffVal before switching off.

fOnVal

REAL

Switch-on value if the "Memory mode" option is not selected via the bMemMod input.

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.

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

E_BA_LightActivationMode

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.

FB_BA_LightCtrl 3: Outputs

VAR_OUTPUT
  fOut              : REAL;
  bAutomaticMode    : BOOL;
  bManualMode       : BOOL;
END_VAR

Name

Type

Description

fOut

REAL

Light output value, 0...100%.

bAutomaticMode

BOOL

The function block was activated via a rising edge at the presence input, which is only possible in "Fully automatic" activation mode.

bManualMode

BOOL

The function block was activated or overridden by a button (bOn, bSwi, bSwiUp, bSwiDwn) or by setting to a value (fSetValMan/bSetValMan).

Requirements

Development environment

Required PLC library

TwinCAT from v3.1.4024.22

Tc3_BA2 from v5.2.5.0