Formula EditorThe formula editor defines a formula for the field. To enter a formula:
Formulas have the syntax: value:=expression where expression is a mathematical formula. eg value:=9*4. Any field from any of the flowcomputers can be selected and can be included in the calculation. eg value:=field("[Omni]STR01 Pressure") Multiple fields can also be included in the calculation: eg value:=field("[Omni]STR01 Gross Flowrate")+field([Omni]STR02 Gross Flowrate") These fields can also come from multiple flowcomputers: eg value:=field("[Omni 1]STN01 Gross Total")+field([Omni 2]STN01 Gross Total") Variables can be declared and used as part of the calculation:
If statements can also be written to display a value based on a Boolean expression being satisfied. The following formula returns the difference between the limit
var temperature := field("[Omni 6000]Temperature");
var high_temperature := field("[Omni 6000]Temp Hi-Lim");
if (temperature > high_temperature)
value := temperature - high_temperature;
else
var low_temperature := field("[Omni 6000]Temp Lo-Lim");
if (temperature < low_temperature)
value := temperature - low_temperature;
else
value := 0;
end if
end if
RecursionIf you need to reference a field from within its own formula use 'value' rather than the direct field reference in order to prevent recursion. Use the following script for the definition of "myfield":
rather than:
Warning: Be careful of introducing recursion. ie a = b and b = a. Acquire will automatically substitute any reference to the field with the reference 'value' but it will not return a value for a field should it detect a recursive script. OperatorsThe calculation can include any of the following operators. A full list is available in the operator popup menu.
Inserting a Field Reference into the FormulaTo insert a field on the formula entry screen:
This will display a list of all fields for all the selected flowcomputer:
Testing a FormulaOnce you have written your formula, you can test it to make sure that the formula's syntax is correct and that it returns the correct value.To test the formula:
Entering Text DescriptionsAcquire™ allows fields to have text values to be associated with the numeric values that are returned from the flowcomputer. eg 1 = Open, 2 = Closed etc. To add a Text Description:
This will open the text description window:
In the above example, the text "Valid" will be used in place of the value "1" whenever the field is displayed in Acquire™. Note: Field Values do not need to be sequential. |
||||||||||||||||||||||||||||||||||||||||
Acquire™ Editor Manual |