FB_BARFacadeElementEntry

This function block serves the administration of all facade elements (windows) in a facade, which are saved globally in a list of facade elements. It is intended to facilitate the input of the element information - also with regard to the use of the target visualization. A schematic representation of the objects with description of the coordinates is shown in Shading correction: principles and definitions.

FB_BARFacadeElementEntry 1:


The facade elements are declared in the global variables as a two-dimensional field above the window columns and rows:

 VAR_GLOBAL
     arrFacadeElement : ARRAY[1..iColumnsPerFacade, 1..iRowsPerFacade] OF ST_BARFacadeElement;
END_VAR

Each individual element arrFacadeElement carries the information for one facade element (ST_BARFacadeElement). The information includes the group assignment, the dimensions (width, height) and the coordinates of the corners. The function block thereby accesses this field directly via the IN-OUT variable arrFacadeElement.

FB_BARFacadeElementEntry 2:

The fact that the coordinates of corners 2 to 4 are output values arises from the fact that they are formed from the input parameters and are to be available for use in a visualization.

FB_BARFacadeElementEntry 3:

All data in meters!

lrCorner2X = lrCorner1X
lrCorner2Y = lrCorner1Y + lrWindowHeight (window height)
lrCorner3X = lrCorner1X + lrWindowWidth (window width)
lrCorner3Y = lrCorner2Y
lrCorner4X = lrCorner1X + lrWindowWidth (window width)
lrCorner4Y = lrCorner1Y


The function block is used in three steps:

Read

With the entries in iColumn and iRow the corresponding element is selected from the list arrFacadeElement[iColumn,iRow]. A rising edge on bRead reads the following data from the list element:

These are then assigned to the corresponding input variables of the function block, which uses them to calculate the coordinates of corners 2-4 as output variables in accordance with the correlation described above. It is important here that the input values are not overwritten in the reading step. Hence, all values can initially be displayed in a visualization.

Change

In a next program step the listed input values can then be changed. The values entered are constantly checked for plausibility. The output bValid indicates whether the values are valid (bValid=TRUE). If this is not the case, a corresponding error code is output at the output udiErrorId. See also below "Errors (bValid=FALSE)".

Write

The parameterized data are written to the list element with the index nId upon a positive edge on bWrite, regardless of whether they represent valid values or not. Therefore the element structure ST_BARFacadeElement also contains a plausibility bit, bValue, that relays precisely this information to the function block FB_BARShadingCorrection / FB_BARShadingCorrectionSouth and prevents incorrect calculations there.

Error (bValid=FALSE)

The function block FB_BARShadingCorrection / FB_BARShadingCorrectionSouth, which judges whether all windows in a group are shaded, will only perform its task if all windows in the examined group have valid entries.
This means:

If one of these criteria is not met, this is interpreted as an incorrect entry and bValid is set to FALSE at the function block output of FB_BARFacadeElementEntry and in the window element ST_BARFacadeElement.
If, on the other hand, all entries of a facade element are zero, it is regarded as a valid, deliberately omitted facade element:

FB_BARFacadeElementEntry 4:

In the case of a facade of 6x4 windows, the elements window (2.1), window (3.5) and window (4.4) would be empty elements here.

VAR_INPUT

eDataSecurityType: E_HVACDataSecurityType;
iColumn          : INT;
iRow             : INT;
bWrite           : BOOL;
bRead            : BOOL;
usiGroup         : USINT;
lrCorner1X       : LREAL;
lrCorner1Y       : LREAL;
lrWindowWidth    : LREAL;
lrWindowHeight   : LREAL;

iColumn: column index of the selected component on the facade. This refers to the selection of a field element of the array stored in the IN-OUT variable arrFacadeElement.

iRow: ditto row index.iRow and iColumn must not be zero! This arises from the field definition, see above.

bRead: with a positive edge at this input, the information of the selected element, arrFacadeElement[iColumn,iRow] is read into the function block and assigned to the input variables usiGroup to rWindowHeight. This gives rise to the output variables rCorner2X to rCorner4Y. If data are already present on the inputs usiGroup to rWindowHeight at time of reading, then the data previously read are immediately overwritten with these data.

bWrite: a positive edge writes the entered as well as calculated values into the selected field element arrFacadeElement[iColumn,iRow].

usiGroup: group membership.

lrCorner1X: X-coordinate of corner 1 in meters.

lrCorner1Y: Y-coordinate of corner 1 in meters.

lrWindowWidth: window width in meters.

lrWindowHeight: window height in meters.

VAR_OUTPUT

lrCorner2X : LREAL;
lrCorner2Y : LREAL;
lrCorner3X : LREAL;
lrCorner3Y : LREAL;
lrCorner4X : LREAL;
lrCorner4Y : LREAL;
bValid     : BOOL;
udiErrorId : UDINT;

lrCorner2X: determined X-coordinate of corner 2 of the window in meters. See "Info" above.

lrCorner2Y: determined Y-coordinate of corner 2 of the window in meters. See "Info" above.

lrCorner3X: determined X-coordinate of corner 3 of the window in meters. See "Info" above.

lrCorner3Y: determined Y-coordinate of corner 3 of the window in meters. See "Info" above.

lrCorner4X: determined X-coordinate of corner 4 of the window in meters. See "Info" above.

lrCorner4Y: determined Y-coordinate of corner 4 of the window in meters. See "Info" above.

bValid: result verification for the entered values.

udiErrorId: contains the error code if the values entered are not OK. See error codes.

VAR_IN_OUT

arrFacadeElement : ARRAY[1..iColumnsPerFacade, 1..iRowsPerFacade] OF ST_BARFacadeElement;

arrFacadeElement: list of facade elements.