Introduction to function block diagram (FBD)
The Function Block Diagram (FBD) language is graphical programming language complying with IEC61131-3
An FBD is a set of interconnected blocks displaying the flow of signals between blocks. It is similar to a ladder logic diagram, except that function blocks replace contact and coils are the output of function blocks.
Elements of function block diagram
A typical function block diagram is composed as follows:- Horizontal and vertical lines
- Functions and function blocks
- Variables
- Parametrization
Below is a sample of a FBD program:
- The “&” block is a logical AND block, and the >=1 block is a logical OR block.
- The number of inputs for each block can be increased.
- The circle at the lower input of the rightmost & block is a logical inversion, equivalent to the NC relay contact.
- The FBD has an implicit feedback path, because the EX101 output of the rightmost & block is also an input to the leftmost & block. The EX101 variable is called the feedback variable.
Execution rules and network evaluation
IEC 61131-3 does not specify a strict order of network evaluation.However, most FBDs are portrayed so that execution generally proceeds from left to right and top to bottom.
The only real exception to this generality is an explicit feedback path.
IEC 61131-3 specifies that network evaluation obey the following rules:
- If the input to a function block is the output from another function block, then it should be executed after the other function block. Reference to the above sample FBD, the execution order is the leftmost &, the >=1, and then the rightmost &.
- The outputs of a function block should not be available to other blocks until all outputs are calculated.
- The execution of an FBD network is not complete until all outputs of all function blocks are determined.
- When data is transferred from one FBD to another, the second FBD should not be evaluated until the values from the first FBD are available.
According to IEC 61131-3, when the FBD contains an implicit feedback path, it is handled in the following manner:
- “Feedback variables shall be initialized by one. The initial value shall be used during the first evaluation of the network.”
- “Once the element with a feedback variable as output has been evaluated, the new value of the feedback variable shall be used until the next evaluation of the element.”
Standard function blocks
Lot of standard function blocks have been made available by IEC61131-3. Below is a listing of function blocks groups or categories:
- Type conversion
- Numeric
- Arithmetic
- Shift
- Bitwise
- Selection
- Comparison
- Strings
- Bistable
- Edge detection
- Counter
- Timer
- Numeric
- Arithmetic
- Shift
- Bitwise
- Selection
- Comparison
- Strings
- Bistable
- Edge detection
- Counter
- Timer
User defined function blocks
One of the most powerful aspects of the FBD language is the use of user defined function blocks to encapsulate standard repetitive operations in order to avoid code duplication.Considering in your application, you have the same repetitive code for each and every motor. Instead of writing the same code several time, a user defined function block can be created and used for every motor. The User defined function block has inputs and outputs which can be assigned to variables
Comments
Post a Comment