FB_BA_Facade_SunProtection

Sub-template Automatic sun protection.
This template calls up a sun protection function with fixed position and lamella setpoint tracing.
In the upper part, the brightness for the facade under consideration is first interpolated using the facade orientation (north = 0°, east = 90°, south = 180°, west = 270°) and the 4 light sensors (BrtnsCardinal interpolation).
As the glare effect of the sun also depends on the height of the sun, 7 brightness values are used for the switch-on and switch-off threshold of the sun protection. These are defined as AV objects and describe threshold values at 0°, 15°, 30°, 45°, 60°, 75° and 90° sun elevation.
The switch-on and switch-off thresholds are each interpolated with a function block FB_BA_Chrct07 based on the current sun elevation.
The calculated threshold values for On and Off are each made available via an AV object in BACnet.
In the subsequent section, a hysteresis block generates the actual enable for the sun protection function.
The actual value used for this is the interpolated brightness based on the cardinal points.
In addition, a time delay of the limit values is programmed to take account of a rapid change in brightness.
Enabling sun protection function block is restricted by the criterion "bFcdInSun" (facade is in the sun area) and then indicated in BACnet via a BV object. The global data for the sun protection function - date/time, positioning interval, longitude and latitude of the property - comes from the local variable list Site, while facade orientation, facade inclination, lamella width and lamella spacing come as inputs from the higher-level FB_BA_Facade as parameters. The determined blind angle and position are indicated as analog objects in BACnet.
![]() | The initialization of the template takes place within the method FB_Init. |
Block diagram

Syntax
FUNCTION_BLOCK FB_BA_Facade_SunProtection EXTENDS FB_BA_View
VAR_INPUT
bFcdInSun : BOOL;
fFcdOrtn : REAL;
fFcdAngl : REAL;
fLamWdth : REAL;
fLamDstc : REAL;
END_VAR
VAR_OUTPUT
stSunbld : ST_BA_SunBld;
bSunPrtcActv : BOOL;
END_VAR
VAR_INPUT CONSTANT
SunPrtcValOn00deg : FB_BA_AV_Op;
SunPrtcValOn15deg : FB_BA_AV_Op;
SunPrtcValOn30deg : FB_BA_AV_Op;
SunPrtcValOn45deg : FB_BA_AV_Op;
SunPrtcValOn60deg : FB_BA_AV_Op;
SunPrtcValOn75deg : FB_BA_AV_Op;
SunPrtcValOn90deg : FB_BA_AV_Op;
SunPrtcValOff00deg : FB_BA_AV_Op;
SunPrtcValOff15deg : FB_BA_AV_Op;
SunPrtcValOff30deg : FB_BA_AV_Op;
SunPrtcValOff45deg : FB_BA_AV_Op;
SunPrtcValOff60deg : FB_BA_AV_Op;
SunPrtcValOff75deg : FB_BA_AV_Op;
SunPrtcValOff90deg : FB_BA_AV_Op;
SunPrtcValOnCalc : FB_BA_AV_Op;
SunPrtcValOffCalc : FB_BA_AV_Op;
SunPrtcDlyOn : FB_BA_AV_Op;
SunPrtcDlyOff : FB_BA_AV_Op;
SunPrtcState : FB_BA_BV_Op;
SunPrtcPos : FB_BA_AV_Op;
SunPrtcAngl : FB_BA_AV_Op;
SunPrtc : FB_BA_SunPrtc;
END_VAR
VAR
aBrtnsDirection : ARRAY[1..32] OF REAL :=[0.0, 90.0, 180.0, 270.0, 360.0];
aBrtnsAtDirection : ARRAY[1..32] OF REAL;
BrtnsCardinalInterpolation : FB_BA_Chrct32;
SunPrtcValOn : FB_BA_Chrct07;
SunPrtcValOff : FB_BA_Chrct07;
SunPrtcValOnOff : FB_BA_Swi2P;
END_VAR
Inputs
Name | Type | Description |
---|---|---|
bFcdInSun | BOOL | The facade is located in the sun area in relation to the current sun elevation and sun direction. This criterion is generated in the higher-level FB_BA_Facade. |
fFcdOrtn | REAL | Facade orientation northern hemisphere: north=0°, east=90°, south=180°, west=270°, in the southern hemisphere applies: south=0°, east=90°, north=180°, west=270°. |
fFcdAngl | REAL | Inclination of the facade [°]. Inclined downwards, the angle is smaller, upwards it is greater than zero. |
fLamWdth | REAL | Lamella width [mm]. |
fLamDstc | REAL | Lamella spacing [mm]. |
Outputs
Name | Type | Description |
---|---|---|
stSunBld | Parking position telegram. | |
bSunPrtcActv | BOOL | Control output "Sun protection active". |
Inputs CONSTANT
Name | Type | Description |
---|---|---|
SunPrtcValOn00deg … SunPrtcValOn90deg | Brightness thresholds for sun protection On [lx] for elevations of 0°, 15°, 30°, 45°, 60°, 75° and 90°. | |
SunPrtcValOff00deg … SunPrtcValOff90deg | Brightness thresholds for sun protection Off [lx] for elevations of 0°, 15°, 30°, 45°, 60°, 75° and 90°. | |
SunPrtcValOnCalc | Calculated brightness threshold value for sun protection On [lx] for display in BACnet. | |
SunPrtcValOffCalc | Calculated brightness threshold value for sun protection Off [lx] for display in BACnet. | |
SunPrtcDlyOn | Delay sun protection on [s]. | |
SunPrtcDlyOff | Delay sun protection off [s]. | |
SunPrtcState | Display object state sun protection. This object indicates whether the release of the sun protection on the part of the facade is given. Whether the blinds actually assume the sun protection position depends on criteria within the room zones (e.g. presence). | |
SunPrtcPos | Calculated sun protection position [%] for display in BACnet. | |
SunPrtcAngl | Calculated sun protection angle [°] for display in BACnet. | |
SunPrtc | Calculation block for sun protection. |
Variables
Name | Type | Description |
---|---|---|
aBrtnsDirection | ARRAY[1..32] OF REAL | Preset field of cardinal points for weighting the brightness. |
aBrtnsAtDirection | ARRAY[1..32] OF REAL | Input field for the brightness related to the above mentioned cardinal points. |
BrtnsCardinalInterpolation | Calculation block for brightness. | |
SunPrtcValOn | Calculation block for the elevation-dependent brightness threshold On. | |
SunPrtcValOff | Calculation block for the elevation-dependent brightness threshold Off. | |
SunPrtcValOnOff | FB_BA_Swi2P | Hysteresis block for switching on/off the sun protection. |
Requirements
Development environment | Necessary function |
---|---|
TwinCAT from v3.1.4024.56 | TF8040 | TwinCAT Building Automation from V5.8.0.0 |