Put words in double quotes to match phrase

Profile™ is a trademark of Ambrit Ltd

Formulas

N.B. This must be performed on the server.

Fields can have formulas associated with them to allow simple arithmetic functions to be applied before they are displayed or written to.

1. Edit the field

See the Adding a Field to a Configuration section for more details.

2. Click the ‘Edit’ button next to the ‘Read Formula’ field

Screen shot 2010-03-29 at 15.02.09

Formulas have the following syntax:

value:=expression

where expression is a mathematical formula, e.g.:

value:=9*4

Any field from any of the RTU can be selected and can be included in the calculation, e.g.:

value:=field("Pressure")

Multiple fields can also be included in the calculation, e.g.:

value:=field("Net Flow Rate")-field(Gross Flow Rate")

Variables can be declared and used as part of the calculation, e.g.:

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 how far a value is outside of its two limit fields:

var temperature := field("Temperature");
var high_temperature := field("Temp Hi-Lim");
if (temperature > high_temperature)
value := temperature - high_temperature;
else
var low_temperature := field("Temp Lo-Lim");
if (temperature < low_temperature)
value := temperature - low_temperature;
else
value := 0;
end if
end if

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
< Less Than
> Greater Than
<= Greater Than or Equal to
>= Less Than or Equal to
|| Logical OR
& Logical AND
| Bitwise OR
&& Bitwise AND
<< Rotate Left
>> Rotate Right
! Not
? Bit Test

3. Type in the formula:

“value:=value/100″

4. Click the ‘Add Field’ button

droppedImage-13

5. Double click on the field to insert it into the formula

Screen shot 2010-03-29 at 16.32.54

6. Click the ‘Validate Formula’ button

If the formula is entered correctly a message will be displayed saying “This formula is OK!”.

Screen shot 2010-03-29 at 16.30.30

7. Click the ‘OK’ button in the dialog

8. Click the ‘OK’ button in the formula window

Note: Write Formulas are exactly the same as read formulas except that the variable used to write the return variable is “writevalue” rather than “value”. The line requires a “;” at the end of the formula. e.g.

writevalue:=writevalue*100;

9. Click the ‘Save’ button to save the field

10. Click the ‘OK’ button

This will return to the main configuration page.

11. Click the ‘Apply’ button

This make the configuration changes active.