You are here: Core Reference > Coding > Logic > Add an Internal Variable to a Function Block Diagram

Add an Internal Variable to a Function Block Diagram

Internal variables are values that are used by the program but are not written to an item in the database. They are used for:

To add an internal variable to a Function Block Diagram:

  1. On the Function Block Diagram display, select the Internal tab on the Variables list.
  2. Right-click in an empty row on the Variables list to display a context sensitive menu.
  3. Select the Add option to display the Add Internal Variable window.
  4. Use the Add Internal Variable window to define the settings for the internal 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 Type combo box to choose the type of value. The value type needs to be appropriate to the internal variable. For more information, please refer to Built-In Data Types.
    • In the Initial Value field, enter the default value for the internal variable. This is the first value of the internal variable. The internal variable will reset to this value for each execution of the Ladder Diagram executes unless the Retained feature is used (see below).
    • Use the Retained check box to determine whether the internal variable is stored and transferred to other servers. For more information on the Retain feature, see Using the RETAIN Keyword in an ST Program.
      • Check the Retained check box to allows the internal variable to be stored and transferred to other servers (in a multi-server setup).
      • Clear the Retained check box to prevent the internal variable from being stored and transferred to other servers. This will result in the internal variable being reset to its initial value each time the Function Block Diagram executes.
  5. Select the OK button to confirm the settings and close the Add Internal Variable window.
  6. Select the internal variable in the Variables list. Keep the left-hand mouse button pressed down.
  7. Drag the internal variable from the Variables list onto the Function Block Diagram.
    A context sensitive menu is displayed.
  8. Select the option that corresponds with the type of internal variable that you are adding to the Function Block Diagram (see Function Block Diagram Components).
    A new variable item is added to the Function Block Diagram.

ClearSCADA 2015 R2