Add Another Instance of a Direct Variable to a Function Block Diagram
You need to use the Variables list to add multiple instances of the same direct variable to a Function Block Diagram. You can add the first instance of the direct variable by dragging the corresponding database item from the Database Bar onto the Function Block Diagram and then configuring the variable settings. For subsequent instances of the direct variable, you need to use the Add option that is available from the Direct tab of the Variables list:
- In the Variables list (above the Function Block Diagram Display), select the Direct tab.
A list of the Ladder Diagram's direct variables is shown. - Right-click on the direct variable that you want to use again.
A context sensitive menu is displayed. - Select the Add option.
The Add Direct Variable window is displayed. - Use the Add Direct Variable window to define the new instance of the variable:
- Enter a Name for the direct variable. The name has to be unique. It cannot have the same name as any variables that are already included in the Function Block Diagram.
- Use the Tag Type combo box to define whether the variable is Read Only, Write Only, or Read/Write.
- Use the browse button feature of the Tag field to select the database property that is the source of the variable's value. The tag can be an OPC tag (for normal, direct variable values) or an OPC Historic tag (see Add Processed Historic Values to Function Block Diagrams).
ATTENTION: If a database item's name includes parentheses ( ), you should ensure that each opening parenthesis is paired with a closing parenthesis. If this is not the case, any Logic programs that reference the database item will not compile successfully. For example, a point named "Analog Point (4" or "Analog Point (4))" will generate a compile error message. Multiple sets of parentheses will compile successfully, including nested parentheses. For example, a Logic program can refer to a point named "Analog Point (4)" or "Analog Point (4(x))". For more information, see Limitation for Database Item Names Referenced in Logic Programs in the ClearSCADA Guide to Logic.
- Use the Type combo box to choose the type of value. The value type needs to be appropriate to the value that is represented by the selected tag. For more information, please refer to Built-In Data Types.
- The Retained feature is designed to be used with internal variables. When selected, it allows the internal variable to be stored and transferred to other servers (in a multi-server setup).
For more information on the Retain feature, see Using the RETAIN Keyword in an ST Program.
- Use the No Cache check box to determine whether the program uses the latest value or the initial value for a variable on each execution. If you check the No Cache check box, the program will use the latest value for the variable rather than the default value. If you clear the No Cache check box, the program will use the default value for the variable on each execution.
The No Cache feature is especially useful with variables that are used as counts. For more information on the No Cache feature, please refer to Using VAR NOCACHE to Prevent Cached Values Being Used in an ST Program.
- Select the OK button to confirm your selection.
The Add Direct Variable window is closed. - Select the new variable in the Variables list. Keep the left-hand mouse button pressed down.
- Drag the new variable from the Variables list onto the Function Block Diagram.
A context sensitive menu is displayed. - Select the option that corresponds with the type of variable that you are adding to the Function Block Diagram (see Function Block Diagram Components).
A new variable is added to the Function Block Diagram, depending on the option you selected.