FB_BARShadingCorrectionSouth

Function block for the shading evaluation of a window group on a facade.

This function block is valid only for the southern hemisphere. The valid function block for the northern hemisphere is FB_BARShadingCorrection.

FB_BARShadingCorrectionSouth 1:

The function block FB_BARShadingCorrectionSouth calculates whether a window group lies in the shadow of surrounding objects. The result, which is output at the output bGroupNotShaded, can be used to judge whether sun shading makes sense for this window group.
The function block thereby accesses two lists, which are to be defined:

On the basis of the facade orientation (lrFacadeOrientation), the direction of the sun (lrAzimuth) and the sun elevation (lrElevation), a calculation can be performed for each corner of a window to check whether this lies in a shaded area. A window group is considered to be completely shaded if all corners are shaded.

In the southern hemisphere, the following applies for the facade orientation (looking out of the window):

Line of sight

Facade orientation

South

β=0°

East

β=90°

North

β=180°

West

β=270°

The function block performs its calculations only if the sun is actually shining on the facade. If one regards the drawing presented in the introduction, then this is the case if the following is true:

Facade orientation < azimuth angle < facade orientation + 180°

FB_BARShadingCorrectionSouth 2:

In addition, a calculation is also not required, if the sun has not yet risen, i.e. the sun elevation is below 0°. In both cases the output bFacadeSunlit is set to FALSE.

VAR_INPUT

eDataSecurityType: E_HVACDataSecurityType;
stTimeAct        : TIMESTRUCT;
lrAzimuth        : LREAL;
lrElevation      : LREAL;

eDataSecurityType:if eDataSecurityType:= eDataSecurityType_Persistent, the persistent VAR_IN_OUT variables of the function block are stored in the flash of the computer if a value changes. For this to work, the function block FB_HVACPersistentDataHandling must be instanced once in the main program, which is called cyclically. Otherwise the instanced FB is not internally released.

A change of value can be initiated by the building management system, a local operating device or via a write access from TwinCAT. When the computer is restarted, the saved data are automatically read back from the flash into the RAM.

Application example: FB_BARShadingCorrectionSouth 3:Example_PERSISTENT.zip

If eDataSecurityType:= eHVACDataSecurityType_Idle the persistently declared variables are not saved in a fail-safe manner.

Notice

A cyclically changing variable must never be linked with the IN_OUT variable of a function block, if eDataSecurityType:= eHVACDataSecurityType_Persistent. It would lead to early wear of the flash memory.

stTimeAct: entry of the current time in GMT (Greenwich Mean Time).

rAzimuth: direction of the sun at the time of observation in degrees.

rElevation: sun elevation at the time of observation in degrees.

VAR_OUTPUT

bGroupNotShaded: BOOL;
bFacadeSunlit  : BOOL;
bError         : BOOL;
udiErrorId     : UDINT;

bGroupNotShaded : is TRUE as long as the window group is not calculated as shaded.

bFacadeSunlit: this output is set to TRUE when the sun shines on the facade. See description above.

bError : this output is set to TRUE if an error is detected during the execution of the function block.

udiErrorId : contains the error code if the values entered should be erroneous. See error codes.

VAR_IN_OUT

In order for the registered parameters to be retained beyond a controller failure, it is necessary to declare them as In-Out variables. A reference variable is then assigned to them in the program. Each change of the value of these reference variables is persistently stored in the function block and written back to the reference variable following a controller failure and restart. If the parameters were only declared as input variables, they would not be able to write a reference variable.
Application example: FB_BARShadingCorrectionSouth 4:Example_PERSISTENT.zip.

arrFacadeElement     : ARRAY[1..iColumnsPerFacade, 1..iRowsPerFacade] OF ST_BARFacadeElement;
arrShadingObject     : ARRAY[1..iShadingObjects] OF ST_BARShadingObject;
lrFacadeOrientation  : LREAL;
usiGroupID           : USINT;

arrFacadeElement: list of facade elements.

arrShadingObject: list of shading objects.

lrFacadeOrientation: facade orientation, see figure above.

usiGroupId: window group regarded. The group 0 is reserved here for unused window elements (see FB_BARFacadeElementEntry). A 0-entry would lead to an error output (bError=TRUE). The function block is then not executed any further and bGroupNotShaded is set to FALSE.