21.1 INTRODUCTION
Function Block Diagrams (FBDs) are another part of the IEC 61131-3 standard. The primary concept behind a FBD is data flow. In these types of programs the values flow from the inputs to the outputs, through function blocks. A sample FBD is shown in Figure 299. In this program the inputs A and B are used to calculate a value sin(A) * ln(B). The result of this calculation is compared to C. If the calculated value is less than C then the output X is turned on, otherwise it is turned off. Many readers will note the similarity of the program to block diagrams for control systems.
It is possible to disable part of the FBDs using enables. These are available for each function block but may not be displayed. Figure 300 shows an XOR calculation. Both of the Boolean AND functions have the enable inputs connected to 'enable'. If 'enable' is true, then the system works as expected and the output 'X' is the exclusive OR of 'A' and 'B'. However if 'enable' is off then the BAND functions will not operate. In this case the 'enable' input is not connected to the BOR function, but because it relies on the outputs from the BAND blocks, it will not function, and the output 'X' will not be changed.
A FBD program is constructed using function blocks that are connected together to define the data exchange. The connecting lines will have a data type that must be compatible on both ends. The inputs and outputs of function blocks can be inverted. This is normally shown with a small circle at the point where the line touches the function block, as shown in Figure 301. (Note: this is NOT available for Allen Bradley RSLogix, so BNOT functions should be used instead.)
The basic functions used in FBD programs are equivalent to the basic set used in Structured Text (ST) programs. Consider the basic addition function shown in Figure 302. The ST function on the left adds A and B, and stores the result in O. The function block on the right is equivalent. By convention the inputs are on the left of the function blocks, and the outputs on the right.
Some functions allow a variable number of arguments. In Figure 303 there is a third value input to the ADD block. This is known as overloading.
The ADD function in the previous example will add all of the arguments in any order and get the same result, but other functions are more particular. Consider the circular limit function shown in Figure 304. In the first ST function the maximum MX, minimum MN and test IN values are all used. In the second function the MX value is not defined and will default to 0. Both of the ST functions relate directly to the function blocks on the right side of the figure.