Global Variables device

A Global Variables device is a logical device with no corresponding physical device. The Global Variables device type includes the features to:

  • Define scalar (single) variables of a variety of data types
  • Define array (3 dimensional) variables of a variety of data types
  • Define structures that can be used as a data type to define variables
  • Optionally, have the variables' values be memory resident only or have the variables value persisted to disk. A Global variables persisted variables retain their values across the stop and restart of the device.

Trigger variables

The trigger features: local variables and static variables are also available:

  • A local variable is specific to a single execution of a trigger. Each execution instance of the trigger has its own copy of the local variable, including its value.
  • A static variable can be used to share data between different executions of the same trigger. The static variable is created when the trigger is started and destroyed when the trigger stops.

For more information, see Trigger local variables, static variables, macros and event variables.

Defining a Global Variables device

To define a Global Variables device, follow these steps:

  1. From the Workbench left pane, expand the node where you want to define the Global Variables device.
  2. Select the Devices icon to display the Devices panel, right-click the Devices icon to display its pop-up menu, and then select New.
    You also can select the New button at the bottom of the Devices panel.
  3. Name the device. The device name can be up to 64 characters and include letters, numbers, and the underscore character. Spaces are allowed.
  4. Use the Type down-arrow, locate the System category, and then select Global Variables.

    The Device window changes to accommodate a Global Variables device.

    The following parameters are available under the Configuration section:

    Parameter Description
    Variables Provides the means to define simple variables in the device (scalars and arrays).
    For more information, see Configuring Global Variables device variables.
    Structures Provides the means to create complex structures of data.
    For more information, see Configuring Global Variables device structures.
    Default Value This is the initial memory value of the variables. The default is hexadecimal but you can use standard decimal notation.
    Persist Values Options are False and True.
    A value of True retains variable values across the stopping and starting of the Global Variables device and the starting and stopping of the system.
    Sort Variables Options are False and True.
    A value of True sorts the variables in alphabetic order on the Variables tab when the device is started; otherwise, they will appear in the order that they were created.
    Per Variable Security Select False to disable the allocation of additional memory to track User to Variable access for all Variables in this Device.
    Select True to enable this feature if required. For more information, see Setting up Read Write per device variable.
  5. After adding the desired Variables and Structures, select Validate to have the parameters validated.
  6. Select Save to save the device definition. The device will appear in the Devices window list of devices.
  7. You can now control the device (Start, Stop), access the device's variables by using the Variables window, and build solutions that use the device's resources.

Exporting and Importing Global Variables device data

When a Global Variables device is exported, persisted values for its variables can be optionally exported. The data values are treated as a separate item that can be included.When a Global Variables device is imported, its data values, if exported, can be optionally imported.

The default for a Global Variables device with the Persists Values parameter defined as True is to include the variable data with the export or import.

Data values

When exporting a Global Variables device with its data values from one node and then importing the Global Variables device and the data values into another node, the Endianness of the nodes must be taken into consideration. For example: exporting from a big endian node (Power PC) and then importing into a little endian node (X86). The numeric data values will not be correctly represented in the imported node.

After the import, the Global Variables device should be edited and the data values reviewed and modified.

What's Inside