FB_BA_LightGroupPresence

FB_BA_LightGroupPresence 1:

One or more light actuators are combined in a light zone for simultaneous control, depending on local conditions.

This template represents a light zone (room) that is only switched via presence. Typical applications are sanitary areas or interior corridors.

Function

A rising edge at bPresence switches the light on via the internal light control block LightSwitch.

The output bAutomaticMode changes to TRUE and the light value is output via the function block LightEvent as the telegram ST_BA_Lighting.

On a falling edge at bPresence, the light is first dimmed to a minimum value via a ramp (if parameterized, see FB_BA_LightCtrl) and then switched off. The output bAutmaticMode changes to FALSE and the light telegram is deactivated on the function block LightEvent.

A rising edge at input bResetRoomFunction can be used to achieve premature switch-off and deactivation.

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.

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:

FB_BA_LightGroupPresence 2:

The initialization of the template takes place within the method FB_Init.

Block diagram

FB_BA_LightGroupPresence 3:

Syntax

FUNCTION_BLOCK FB_BA_LightGroupPresence EXTENDS FB_BA_Ext_LightBase
VAR_INPUT
  bResetRoomFunction     : BOOL;
  bPresence              : BOOL;
  stAreaLighting         : ST_BA_Lighting;
  stScene                : ST_BA_Lighting;
  stReferenceFeedback    : ST_BA_LightActuatorFeedback;
END_VAR
VAR_OUTPUT
  stLighting             : ST_BA_Lighting;
END_VAR
VAR_INPUT CONSTANT PERSISTENT
  nSwiTi                 : UDINT;
  nPreOffRampTi          : UDINT;
  fOnVal                 : REAL;
  fPreOffVal             : REAL;
  nPreOffDly             : UDINT;
  fLgtT                  : REAL;
END_VAR
VAR_INPUT CONSTANT PERSISTENT
  LightEvent             : FB_BA_LightingEvt :=( ePrio:= E_BA_LightingPrio.eSimple);
END_VAR
VAR
  LightSwitch            : FB_BA_LightCtrl;
  PrioSwi                : FB_BA_LightingTgmSel4;
END_VAR

FB_BA_LightGroupPresence 4: Inputs

Name

Type

Description

bResetRoomFunction

BOOL

This input switches off the light function block LightSwitch - it is then no longer active (output bAutmaticMode/bManualMode = FALSE). 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. A rising edge switches the light on and a falling edge switches it off. Switching on and off via presence is accompanied by activation and deactivation of the light function block.

stAreaLighting

ST_BA_Lighting

Resulting telegram from the higher levels (area, floor and building), which is formed in the function block FB_BA_AreaLighting.

stScene

ST_BA_Lighting

Reserved telegram input for scene control.

stReferenceFeedback

ST_BA_LightActuatorFeedback

Feedback input of the controlled light actuator or the guide light of the controlled group.

FB_BA_LightGroupPresence 5: Outputs

Name

Type

Description

stLighting

ST_BA_Lighting

Resulting output program.

FB_BA_LightGroupPresence 6: Inputs CONSTANT PERSISTENT

Name

Type

Description

nSwiTi

UDINT

Ramp for the switching functions in seconds, related to a dimming from 0 to 100%. Pre-set to 2 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.

fOnVal

REAL

Switch-on value. Pre-set to 100% in FB_Init.

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.

fLgtT

REAL

Light temperature: Pre-set to 3000 K in FB_Init.

FB_BA_LightGroupPresence 7: Inputs CONSTANT

Name

Type

Description

LightEvent

FB_BA_LightingEvt

Telegram generator for the light values. The priority is pre-set to eManualActuator.

VAR

Name

Type

Description

LightSwitch

FB_BA_LightCtrl

Light control block.

PrioSwi

FB_BA_LightingTgmSel4

Telegram selection.

Requirements

Development environment

Necessary function

TwinCAT from v3.1.4024.56

TF8040 | TwinCAT Building Automation from V5.8.0.0