Defining Constants

Constants can be used in SFC actions and transitions, and dataflow diagram. A constant can be structured or not.


Before you begin: The workbench used to edit the logic should be opened.
  1. Click New Constant and select an element of the logic tree.

    The Constant Properties dialog box is displayed.



  2. Change the default name of the constant to Pi.

  3. Enter 3.1416 in the Expression cell.



  4. Click OK.

    The constant Pi is added to the specification tree.

    Note: As we haven't constrained the constant type, the type deduced by the typing mechanism is the class type Floating.

  5. Repeat step 1 to create a new constant.

  6. Change the default name of the constant to I.

  7. Click Add Element .

    The element is converted into a structure.

  8. Click Add Element to add a second element to the structure.

  9. Change the default names and fill the expressions as shown below:



    Tip: The column Tree, Expression, Type and Comment can be sorted by clicking their header.
    Order of the element creation
    Alpha-numerical order
    Revers alpha-numerical order

  10. Click OK. The constant I appears in the tree.



  11. Repeat step 1 to create a new constant.

  12. Select the Text Mode radio button. This mode allows you to enter the constant definition of structured constants in text mode.

    See typical examples below:

    • Single element: 3.1416
    • Tuple: (0,1)
    • Structure: {re=0;im=1}
    • Single element with constrained type: (3.1416 : float32)
    • Tuple with constrained types: ((0 : int32),(1:int32))
    • Structure with constrained types: {re=(0 : int32);im=(1:int32)}


  13. Click Tree Mode. The constant is now displayed in tree mode.