FB_BA_FcdElemEntry

FB_BA_FcdElemEntry 1:

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 inputting element information - not least with regard to using the TC3 PLC HMI. A schematic illustration of the objects with description of the coordinates is given in Shading correction: principles and definitions.

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

VAR_GLOBAL
     arrFcdElem : ARRAY[1..Param.uiMaxColumnFcd, 1..Param.uiMaxRowFcd] OF ST_BA_FcdElem;
END_VAR

Each element arrFcdElem[x,y] contains the information for an individual facade element (ST_BA_FcdElem). The information includes the group affiliation, the dimensions (width, height) and the coordinates of the corners. The function block thereby accesses this field directly via the IN-OUT variable arrFcdElem.

Note: The fact that the coordinates of corners C2 to C4 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_BA_FcdElemEntry 2:

All entries in [m]!

rCnr2X = rCnr1X
rCnr2Y = rCnr1Y + rWdwHght
(window hight)
rCnr3X = rCnr1X + rWdwWdth
(window width)
rCnr3Y = rCnr2Y
rCnr4X = rCnr1X + rWdwWdth
(window width)
rCnr4Y = rCnr1Y

The function block is used in three steps:

Read

The entries udiColumn and udiRow are used to select the corresponding element from the list, arrFcdElem[udiColumn, udiRow]. A rising edge on bRd 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 C2-C4 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 bErr indicates whether the values are valid (bErr=FALSE). If the values are invalid, a corresponding error message is issued at output sErrDescr. See also "Error (bErr=TRUE)" below.

Write

The parameterized data are written to the list element with the index nId upon a rising edge on bWrt, regardless of whether they represent valid values or not. The element structure ST_BA_FcdElem therefore also contains a plausibility bit bVld, which forwards precisely this information to the function block FB_BA_ShdCorr to prevent miscalculations.

This approach is to be regarded only as a proposal. It is naturally also possible to parameterize the function block quite normally in one step and to write the values entered to the corresponding list element with a rising edge on bWrt.

Error (bErr=TRUE)

The function block FB_BA_ShdCorr, 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, it is interpreted as incorrect input, and the error output bErr is set at the function block output of FB_BA_FcdElemEntry. Within the window element ST_BA_FcdElem, the plausibility bit bVld is set to FALSE.
If on the other hand all entries of a facade element are zero, it is regarded as a valid, deliberately omitted facade element:

FB_BA_FcdElemEntry 3:

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

udiColumn : UDINT;
udiRow    : UDINT;
bWrt      : BOOL;
bRd       : BOOL;
udiGrp    : UDINT;
rCnr1X    : REAL;
rCnr1Y    : REAL;
rWdwWdth  : REAL;
rWdwHght  : REAL;

udiColumn: 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 arrFcdElem.

udiRow: ditto. row index. udiRow and udiColumn must not be zero! This is due to the field definition, which always starts with 1; see above.

bRd: A positive edge at this input causes the information of the selected element, arrFcdElem[udiColumn,udiRow], to be read into the function block and assigned to the input variables diGrp to rWdwHght. The resulting output variables are rCnr2X to rCnr4Y. If data are already present on the inputs diGrp to rWdwHght at time of reading, then the data previously read are immediately overwritten with these data.

bWrt: A positive edge writes the entered and calculated values into the selected field element arrFcdElem[udiColumn, udiRow].

udiGrp: Group membership. Internally limited to a minimum value of 0.

rCnr1X: X-coordinate of corner point 1 [m].

rCnr1Y: Y-coordinate of corner point 1 [m].

rWdwWdth: Window width [m].

rWdwHght: Window height [m].

VAR_OUTPUT

rCnr2X   : REAL;
rCnr2Y   : REAL;
rCnr3X   : REAL;
rCnr3Y   : REAL;
rCnr4X   : REAL;
rCnr4Y   : REAL;
bErr     : BOOL;
sErrDesc : T_MAXSTRING;

rCnr2X: Calculated X-coordinate of corner point 2 of the window [m]. See "Note" above.

rCnr2Y: Calculated Y-coordinate of corner point 2 of the window [m]. See "Note" above.

rCnr3X: Calculated X-coordinate of corner point 3 of the window [m]. See "Note" above.

rCnr3Y: Calculated Y-coordinate of corner point 3 of the window [m]. See "Note" above.

rCnr4X: Calculated X-coordinate of corner point 4 of the window [m]. See "Note" above.

rCnr4Y: Calculated Y-coordinate of corner point 4 of the window [m]. See "Note" above.

bErr: Result verification for the entered values.

sErrDesc: Contains the error description.

Error description

01: Error: Index error! udiColumn and/or udiRow are outside the permitted limits, 1.. uiMaxColumnFcd and 1.. uiMaxColumnFcd, respectively. See list of facade elements.

02: Error: The group index is 0, but at the same time another entry of the facade element is not zero. Only if all entries of a facade element are zero is it considered to be a valid, deliberately omitted facade component, otherwise it is interpreted as an incorrect entry. NOTE: Group entries less than zero are internally limited to zero.

03: Error: The X-component of the first corner point (Corner1) is less than zero.

04: Error: The Y-component of the first corner point (Corner1) is less than zero.

05: Error: The window width is less than or equal to zero.

06: Error: The window height is less than or equal to zero.

VAR_IN_OUT

arrFcdElem : ARRAY[1..Param.uiMaxColumnFcd, 1..Param.uiMaxRowFcd] OF ST_BA_FcdElem;

arrFcdElem: List of facade elements (see List of facade elements).

Requirements

Development environment

Required PLC library

TwinCAT from v3.1.4024.7

Tc3_BA from v1.1.6.0