Formula Editor

The formula editor defines a formula for the field.

To enter a formula:

  • Click the 'Edit' button adjacent to the formula field.

Read formulas

Read formulas have the syntax value:=expression where expression is a mathematical formula e.g. value:=value*1000.

Write formulas

Write formulas have the syntax writevalue:=expression where expression is a mathematical formula e.g. writevalue:=writevalue/1000.

Write formulas can only be applied to RTU fields.

Scripting

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:

  • var a := 2;
  • var b := 3;
  • value := a + b;

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

Operators

The calculation can include any of the following operators. A full list is available in the operator popup menu.

+ plus - minus
* multiply / divide
% mod \ integer divide
= equals # not equal to
> greater than < less than
>= greater than or equal to <= less than or equal to
|| Logical OR & Logical AND
| Bitwise OR && Bitwise AND
<< Bit Rotate Left >> Bit Rotate Right
! not ? Bit Test

Inserting a Field Reference into the Formula

To insert a field on the formula entry screen:

  • Click the 'Field' button.

This will display a list of all fields for all the selected flowcomputer:

  • Select the flowcomputer from the 'Flowcomputer' popup menu.
  • Select the field either by typing in the full name, selecting it from the list or by typing a partial name and clicking the 'Go' button.
  • Click on the field in the field list to highlight it
  • Click the 'OK' button.

Testing a Formula

Once 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:

  • Enter the formula.
  • Click the 'Run' button. This will tell you if the formula was valid and will show you the value that was calculated based on current values returned from the flowcomputer
  • Click the 'OK' button.





Acquire™ Editor Manual