Import and display controller variables

Import variables from a controller and graphically display the variables in the FactoryTalk Optix Application
Import variables from a controller to graphically display the value of a variable in the FactoryTalk Optix Application graphical interface. In subsequent modules, configure the display of alarms and configure recipes. To simulate the change of the variable value on the controller, configure a graphical object to change the value manually at runtime.
This is the result:
Step #1: Import the controller variables
To design applications that exploit the variables on the controllers, import the variables to the project. Import using a direct connection to the controller on the network (
online
mode) or import a variable file exported from the controller (
offline
mode). For simplicity, import the variables from an XML file.
Configure a specific
driver
object for the protocol of interest and a
station
object for each specific controller that uses the same protocol.
To create the objects and import the variables:
  1. In
    Project
    , right-click the
    CommDrivers
    folder, then select
    New
    >
    CODESYS driver
    :
    DriverCodesys1
    appears in
    CommDrivers
    . This object represents the CODESYS protocol.
  2. Right-click
    DriverCodesys1
    and select
    New
    >
    CODESYS Station
    :
    CodesysStation1
    appears in
    DriverCodesys1
    . This object represents the controller. The connection parameters are available in the properties.
  3. In
    Project
    , expand
    CodesysStation1
    and select
    TagImporter
    . this is the object to import the variables in online or offline mode.
  4. Set the
    Mode
    property to
    Offline
    ,. In the
    File path
    property select
    Browse
    and select the codesysTags.xml file downloaded previously.
  5. Double-click
    TagImporter
    to open the editor. Expand the nodes to display all variables present in the XML file.
  6. In the
    controller_PRG
    node, select the
    Ingredient01
    ,
    Ingredient02
    ,
    Ingredient03
    ,
    Motor1Alarm
    and
    Temperature
    variables, then select
    Synchronize
    . The variables are imported in the project, inside
    CodesysStation1
    >
    Tags
    .
Step #2: Organize the graphical objects
In
Page1 (type)
, create a label and a text box respectively, to describe and display the value of the controller variable. Next, create a linear gauge with to simulate the change of the controller variable value at runtime.
  1. In
    Project
    , right-click
    Page1 (type)
    , then select
    New
    >
    Basic controls
    >
    Label
    :
    Label1
    appears in
    Page1 (type)
    .
  2. Repeat the procedure for the text box (
    Basic controls
    >
    Text box
    ).
  3. Double-click
    Page1 (type)
    to display the panel in the editor.
  4. Drag the objects to tile as shown.
  5. In
    Project
    , right-click
    Page1 (type)
    , then select
    New
    >
    Basic controls
    >
    Linear gauge
    :
    LinearGauge1
    appears in
    Page1 (type)
    and in the editor.
  6. In the editor, position the linear gauge as shown in the example.
Step #3: Display the value of a controller variable
To display the value of the imported
Temperature
variable, set a dynamic link between the
Text
property of
TextBox1
and the value of the variable.
  1. In
    Project
    , double-click
    Page1 (type)
    to display in the editor.
  2. Drag the
    Temperature
    variable value to display in the text box. The text box appears in the editor.
    NOTE: This method sets a dynamic link in the
    Text
    property of the text box.
    .
  3. Double-click
    Label1
    to update the text.
Step #4: Simulate the value change of the controller variable
The value of the
Temperature
variable is static, because the controller is not connected. To simulate the variable value change at runtime, configure
LinearGauge1
.
  1. In
    Project
    , select
    LinearGauge1
    .
  2. In its
    Value
    property, set a dynamic link with the
    Temperature
    variable.
  3. Select
    Emulator
    and wait for the runtime window to appear.
  4. To simulate the change in value of the
    Temperature
    variable on the controller, drag and release the linear gauge cursor. The updated
    Temperature
    value displays in the text box.
  5. Close the application window.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.