System Model > Equipment > Configure Equipment in Citect Studio > Calculator Examples
Calculator Examples

The following examples demonstrate five cases where the calculator function could be applied to an equipment XML template. In each case, you need to add an additional line to the XML template:

<calculator>{parameter} + 1</calculator>

  1. Calculator based on string parameter in the input section of the XML. This is only recommended if the calculated parameter is constant for each instance of equipment for this type; however, this is not a typical scenario.
  2. <string name="MyString">1000</string>

    <calculator name="MyCalc">{MyString} + 1</calculator>

    See Example 1.

  3. Calculator based on equipment field, for example, {equipment.Custom1}.
  4. <calculator name="MyCalc">{equipment.Custom1} + 1</calculator>

    See Example 2.

  5. Calculator based on ungrouped parameter (defined in Equipment Editor).
  6. <calculator name="MyCalc">{equipment.param_list[Param1]} + 1</calculator>

    See Example 3.

  7. Calculator based on grouped parameter (defined in Equipment Editor).
  8. <calculator name="MyCalc">{equipment.ParamGroup[Param2]} + 1</calculator>

    These can then be used in fields for an element:

    <field name="addr">MW_{MyCalc}_2</field>

    See Example 3.

  9. Calculator based on grouped parameter (in the output section).
  10. <output name="Element" file="variable.dbf" filter="'{equipment.type}={type.name}'">
    <calculator name="TagAddress">{equipment.TagAddressing[StructOffset]} + 0</calculator>
    ...
    </output>

    These can then be used in fields for an element:

    <field name="addr">MW_{MyCalc}_2</field>

    See Example 4.

See Also

Published June 2018