Arithmetic Module
Module icon
Overview
A wide variety of defined functions are provided, and virtually any type of calculation can be performed.
Many calculations require previous values of a variable in addition to the current value in order to establish a rate of change. The Arithmetic module stores x previous values read at each Source input (the number of previous values, x, depends on the ION device you are using, and these values are easily referenced in Arithmetic module formulas).
Inputs
These are the inputs upon which the Arithmetic module’s calculations can be performed. They can be numeric or Boolean registers from any other module’s outputs. Linking these inputs is optional; any input you do not link will not have a value available for use in calculations. The number of Source 1  n inputs available depends on the device you are using as follows:
Node type  Maximum number of Source inputs 

PM8000 series, ION7400 series, ION9000 series  16 
All other ION meters  8 
Virtual processor  50 
This input enables or disables the Arithmetic module (by setting it to ON or OFF, respectively). Calculations on the formulas contained in the setup registers are not performed when the module is disabled. This input is optional; if you leave it unlinked, the module is enabled by default.
This input resets the Arithmetic module. It can be linked to a pulse output from any other module’s output. This input is optional; if you leave it unlinked, it never receives a pulse. When a reset occurs, all previous Source input values become NOT AVAILABLE, and all previous formula result values are set to zero. Note that the Reset input overrides the Enable input: a reset clears previous values even when the module is disabled.
The Arithmetic module performs the calculations contained in its setup registers when this input is pulsed. This input can be the pulse output of any other module. If CalculateNow is not linked, the formulas contained in the module’s Formula setup registers will be calculated as follows:

For meters, the module calculates once every second (this corresponds to the default update rate of Arithmetic modules).

For the Virtual Processor, the module calculates 10 times per second (this corresponds to the default value for the Virtual Processor’s module update period, 100 milliseconds). If you change the Virtual Processor’s module update period (this is one of the global parameters you can change through the Virtual Processor Setup utility), the calculation frequency will change accordingly. If you want to set the calculation frequency to once every 1 second, create a Periodic Timer module, set its frequency (once per second), and link its output register to the Virtual Processor Arithmetic module’s CalculateNow input.
NOTE: The Virtual Processor’s module update period can be viewed from the Factory module’s Modl Period setup register.
Setup registers
The Arithmetic module has one Formula setup register for each Result output register. The number of setup registers depends on the device; refer to the following table:
Node type  Setup register  Register bounds 

ION meters  Formula 1 to Formula m  Must not exceed 49 characters in length 
Virtual processor  Formula 1 to Formula m  Must not exceed 249 characters in length 
This register defines if and how the module converts Source inputs that are NOT AVAILABLE. If converted, the module performs its calculations using the converted value as the Source input value.
Option  Description 

None  N/A Source inputs are not converted 
Convert to 1  N/A Source inputs are set to 1 
Convert to 0  N/A Source inputs are set to 0 
Convert to 1  N/A Source inputs are set to 1 
Use last value if available, else 1  N/A Source inputs are set to their last good value; if the last good value is not known, the input is set to 1 
Use last value if available, else 0  N/A Source inputs are set to their last good value; if the last good value is not known, the input is set to 0 
Use last value if available, else 1  N/A Source inputs are set to their last good value; if the last good value is not known, the input is set to 1 
Output registers
These output registers contain the results calculated by the formulas in their corresponding setup registers. The number of Result outputs available to an Arithmetic module matches the number of Formula setup registers; refer to Setup Registers above.
Unlike other modules, the Arithmetic module’s output registers do not depend directly on inputs. A Result output will be NOT AVAILABLE only if its corresponding Formula setup register contains one of the following:

a formula that references a Source input that is NOT AVAILABLE

a formula that results in a number that can’t be displayed (such as a complex number)

no formula at all
Any events produced by the Arithmetic module are recorded in the Event register. Possible events and their associated priority numbers are shown in the following table.
Event priority group  Priority  Description 

Reset  5  A module reset has occurred 
Setup Change  10  Input links, setup registers or labels have changed 
Formula rules
Discussions in this section refer to operators and operands. In the simplest form, a formula’s operator is the function being performed, and its operand is the number or expression the function is being applied to. For example, in the formula arcsin(S1), the operator is the function arcsin and the operand is S1, the reference to the value held in Source input 1. Formulas can have multiple operators, and many of the supported operators can have multiple operands.
Certain rules must be followed when entering formulas into the Arithmetic module’s setup registers. In most cases these rules are identical to those followed in conventional mathematics. The following paragraphs detail the rules used in the Arithmetic module, and define the terms used to describe references, functions and syntax errors.
The remainder of this section provides definitions and syntax requirements for the reference operators, functions and constants that can be used in the Arithmetic module.
Numbers, expressions and Booleans
The sections that follow refer to numbers, expressions and Booleans when describing a function’s usage. A number can be a constant or a reference to a Source input, previous Source input, current result or previous result value. In any case, number is defined as any real number.
Expressions are a mathematical “sentence”, containing operators and numbers, that can be evaluated into a number. All of the Arithmetic module’s supported functions accept expressions as well as numbers as valid operands.
Booleans are a special class of number,
representing TRUE
or FALSE
. Any
nonzero number, or expression that equals a nonzero number, is TRUE
. Zero, or any expression that equals zero, is FALSE
. Arithmetic operators will also return TRUE
or FALSE
depending on whether their conditions
are met; for example, S1=S2 will return TRUE
(1)
if S1 is equal to S2, or FALSE
(0) if S1 and S2 are
not equal.
Operator associativity and precedence
The following table shows the associativity and precedence of mathematical operators. Arithmetic module associativity and precedence conforms to that used in conventional mathematics.
Operator  Associativity  Precidence 

+ or  (unary minus)  right to left  first 
power or ^  left to right  second 
* or /  left to right  third 
+ or   left to right  fourth 
=, <, >, <=, >=, <>, !=, ~=  left to right  fifth 
Syntax errors in formulas
After the formula is entered it must be sent to the device to be checked for syntax errors. It is recommended that a Send & Save operation is performed after each formula is written.
The following examples show formulas with syntax errors and their resulting error messages. The brackets containing the error will appear in the formula near where the error was detected.

This statement has a minus sign in the wrong place:
sum(p1(1:10),p2(1:10),p3(1:4))
and results in the following error message:
"sum(p1(1:10),p2(1:10) {Syntax error near here} ,p3(1:4))"

This statement uses an unsupported previous level; namely 0:
sum(p1(1:10),p2(1:10),p3(0:4))
and results in the following error message:
"sum(p1(1:10),p2(1:10),p3(0:4) {Previous level, 0, is not supported} )"

This statement uses an unsupported previous level; namely 11. This happens to be larger than the level set for the device being used.
sum(p1(1:10),p2(1:11),p3(1:4))
and results in the following error message:
sum(p1(1:10),p2(1:11) {Previous level, 11, is not supported} ,p3(1:4))"

This statement’s syntax is correct, but it needs too much internal storage. This is because the Arithmetic module expands all address ranges and previous ranges.
sum(p1(1:10),p2(1:10),p3(1:10),p4(1:10))
and results in the following error message:
"Expanded address ranges caused overflow in internal storage."
Reference definitions
References allow you to use values from Source inputs, previous Source inputs, formula results and previous formula results in your formulas. Ranges of values can also be referenced. Definitions and syntax requirements for the supported references and reference operators are provided in this section. The following table summarizes the available reference operators:
Reference  Description  Usage 

S  Source input value  Sinput# 
:  address range  Sinput#1:Sinput#2 
P  previous Source input value  Pinput#(previous#) or Pinput#(previous range) 
:  previous range  previous#1:previous#2 
R  current formula result  Rformula# 
PR  previous formula result  PRformula# 
Referencing source input values:

Current values held in Source inputs Source 1 through Source n are referenced in formulas using the letter S and the number of the input. For example, Source 1 is referenced by the expression S1, and Source 8 is referenced with S8. The letter S can be uppercase or lowercase. The address range operator can be used to simplify formulas when referencing Source input values.
S (Source input)

Syntax: Sinput#

Where input# is the Source input number.

Example: S1 references Source input 1
: (address range)

The Address Range operator provides a way to specify a sequential range of Source input references without having to type each one into the formula.

Syntax: Sinput#1:Sinput#2

Sinput#1 is the beginning of the sequential range of Source inputs.
Sinput#2 is the end of the sequential range of Source inputs.

Example: SUM(S1:S5) returns the sum of the range S1, S2, S3, S4, S5
Referencing Previous Source Inputs Values

A number of previous Source input values are stored in the device’s memory and are available for use in Arithmetic module formulas (the number of previous values retained in memory depends on the device you are using).
Node type Previous values held in buffers ION meter up to 10 Virtual processor up to 60 NOTE: By default, Source input values shift to previous values at the update rate of the ION device (usually once per second). When a current Source shifted to previous input 1, all existing previous values shift one step back, and the last previous value is discarded. You can control when input values shift to previous values by linking the CalculateNow input to another module’s pulse output register. See the CalculateNow input description for details. 
Source input values are shifted to previous values in one of two ways, depending on whether the CalculateNow input is linked or unlinked. If CalculateNow is unlinked, input values shift one step back at the update rate of the device (see Setup Registers). If CalculateNow is linked, input values shift one step back only when the CalculateNow input is pulsed.

Previous values are referenced using the form Px(y), where x represents the Source input number and y is the number of steps back from the current value. For example, P3(2) calls the second previous value from Source input 3.

Range operators can be used to simplify formulas when referencing previous Source input values.
P (previous)
The Previous operator allows you to specify the value held by a Source input in previous calculation cycles.

Syntax: Pinput#(previous#)

Where input# is the Source input number.
previous# is the number of steps back from the current Source input value.

Examples: P1(1) calls the value from input 1, 1 step back from the current value
P5(6) calls the value from input 5, 6 steps back from the current value
SUM(P3(1:4)) will return the sum of previous values 1 through 4 from Source input 3 (see previous range function)
: (previous range)

The Previous Range operator provides a way to specify a sequential range of previous Source input values inside the Previous function without having to type each value into the formula.

Syntax: previous#1:previous#2

previous#1 is the first in the sequential range of previous Source input values.
previous#2 is the last in the sequential range of previous Source input values.

Example: P1(1:4) references the Source input 1 previous values 1, 2, 3 and 4 steps back from the current value (see the Previous function)
Referencing Current and Previous Formula Results
A Result reference provides the result of the formula in another setup register, evaluated in the current calculation cycle of the module. To use Result, the formula referenced must be in a ‘preceding” setup register; for example, a formula in setup register 5 can reference the result from formulas in setup registers 1, 2, 3 or 4. It cannot reference results from formulas in setup registers 6 or higher. This is because the module evaluates the formulas in sequence, from setup register 1 on.
Similar to Result, the Previous Result operator allows you to reference the result of a formula that was evaluated in the previous calculation cycle of the module. This is especially useful for calculating accumulations. Previous Result only goes back one step; no facility exists to reference previous formula results from 2 or more steps back.
R (result)
The Result operator allows you to call results from formulas in other setup registers. Results are returned from formulas evaluated in the current calculation cycle.

Syntax: Rformula#

Where formula# is the Result output number.

Examples: R4 calls the value from Result output register 4 (valid only if used in setup register 5 or higher)
R6 calls the value from Result output register 6 (valid only if used in setup register 7 or higher)
PR (previous result)
The Previous Result
operator allows you to call previous results from formulas in other
setup registers. Previous results are returned from formulas evaluated
in the previous calculation cycle. Note that the Previous Result operator
will return zero if the previous result referenced is a NOT
AVAILABLE
value. Previous result operators can be used in
all formulas (unlike Result operators).

Syntax: PRformula#

Where formula# is the Result output number.

Examples: PR4 calls the previous value from Result output register 4.
S1 + PR1 in the Formula 1 setup register will accumulate the values appearing at Source input S1 in the Result output register 1. The values at S1 are accumulated every time the module updates.
Function definitions
There are four types of functions that can be used in the Arithmetic module, classified by the number of operands they may contain. Syntax requirements for each function are detailed in this section.
Singleoperand functions
Singleoperand functions operate on a single number, expression or Boolean operand. The following table summarizes the available functions.
Singleoperand function  Description  Usage 

abs  absolute value  abs(number) 
arccos  arccosine function  arccos(number) 
arcsin  arcsine function  arcsin(number) 
arctan  arctangent function  arctan(number) 
C_to_F  temperature conversion  C_to_F(number) 
Ceil  integer ceiling function  ceil(number) 
cos  cosine function  Cos(number) 
F_to_C  temperature conversion  F_to_C(number) 
Floor  integer floor function  floor(number) 
ln  natural logarithm  ln(number) 
log10  base 10 logarithm  log10(number) 
not  Boolean NOT  not(Boolean) 
sin  sine function  sin(number) 
sqrt  square root  sqrt(number) 
tan  tangent function  tan(number) 
  unary minus  number or (expression) 
Type_J  linearization  Type_J(number) 
Type_K  linearization  Type_K(number) 
Type_R  linearization  Type_R(number) 
Type_RTD  linearization  Type_RTD(number) 
Type_T  linearization  Type_T(number) 
ABS
Returns the absolute value of a number or expression.

Syntax: ABS(number)

Where number is the real number for which you want the absolute value.

Examples: ABS(50) equals 50
ABS(50) equals 50
ARCCOS
Returns the arccosine of a number or expression. Arccosine is the inverse of cosine; the angle returned from the arccos function is the angle whose cosine is the original number entered into the function. The angle returned from the arccos function is given in radians, and will be in the range 0 <= x <= PI.

Syntax: ARCCOS(number)

Where number is the cosine of the angle you want and must be in the range 1 <= number <= 1.

Examples: ARCCOS(0.5) equals 2.094395 (2PI/3 radians)
ARCCOS(0.5)*180/PI equals 120 (degrees)
ARCSIN
Returns the arcsine of a number or expression. Arcsine is the inverse of sine; the angle returned from the arcsine function is the angle whose sine is the original number entered into the function. The returned angle is given in radians in the range PI/2 <= x <= PI/2.

Syntax: ARCSIN(number)

Where number is the sine of the angle you want, and must be in the range 1 <= number <= 1.

Examples: ARCSIN(0.5) equals 0.5236 (PI/6 radians)
ARCSIN(0.5)*180/PI equals 30 (degrees)
ARCTAN
Returns the arctangent of a number or expression. Arctangent is the inverse of tangent; the angle returned from the arctan function is the angle whose tangent is the original number entered into the function. The returned angle is given in radians in the range PI/2 < x < PI/2.

Syntax: ARCTAN(number)

Where number is the tangent of the angle you want.

Examples: ARCTAN(1) equals 0.785398 (PI/4 radians)
ARCTAN(1)*180/PI equals 45 (degrees)
C_to_F
Returns the temperature in degrees Fahrenheit for each number in degrees Celsius.

Syntax: C_to_F(number)

Where number is the temperature in Celsius for which you want the Fahrenheit equivalent.

Example: C_to_F(16.6) equals 61.88
CEIL
Returns the closest integer value that is greater than or equal to number.

Syntax: ceil(number)

Where number is the value you want the ceiling of.

Examples: Ceil(12.73) equals 13
Ceil(5.5) equals 5
Ceil (6.0) equals 6.0
COS
Returns the cosine of a number or expression.

Syntax: COS(number)

Where number is the angle in radians for which you want the cosine.

Examples: COS(1.047) equals 0.500171
COS(60*PI/180) equals 0.5, the cosine of 60 degrees
F_to_C
Returns the temperature in degrees Celsius of a number in degrees Fahrenheit.

Syntax: F_to_C(number)

Where number is the temperature in Fahrenheit for which you want the Celsius equivalent.

Example: F_to_C(61.88) equals 16.56
Floor
Returns the closest integer value that is less than or equal to number.

Syntax: Floor(number)

Where number is the value for which you want the floor of.

Examples: Floor(12.73) equals 12
Floor (5.7) equals –6.0
Floor (6.0) equals 6.0
LN
Returns the natural logarithm of a number or expression.

Syntax: LN(number)

Where number is the positive real number for which you want the natural logarithm.

Example: LN(86) equals 4.454347
LOG10
Returns the base 10 logarithm of a number or expression.

Syntax: LOG10(number)

Where number is the positive real number for which you want the base 10 logarithm.

Examples: LOG10(86) equals 1.934498451
LOG10(10) equals 1
LOG10(10^5) equals 5
NOT
Returns the reverse value of a Boolean. If the Boolean is FALSE, NOT returns TRUE; if the Boolean is TRUE, NOT returns FALSE.

Syntax: NOT(Boolean)

Where Boolean can be evaluated to TRUE (nonzero) or FALSE (0).

Examples: NOT(0) equals TRUE
NOT((1+1)=2) equals FALSE
SIN
Returns the sine of the number or expression.

Syntax: SIN(number)

Where number is the angle in radians for which you want the sine.

Examples: SIN(PI) equals 1.22E16, which is approximately zero (the sine of PI is zero)
SIN(PI/2) equals 1
SIN(30*PI/180) equals 0.5, the sine of 30 degrees
SQRT
Returns the square root of a number or expression.

Syntax: SQRT(number)

Where number is the positive number for which you want the square root. If number is negative, the associated Result output register will be
NOT AVAILABLE
. 
Examples: SQRT(16) equals 4
SQRT(16) makes the associated Result output
NOT AVAILABLE
TAN
Returns the tangent of a number or expression.

Syntax: TAN(number)

Where number is the angle in radians for which you want the tangent.

Examples: TAN(0.785) equals 0.99920
TAN(45*PI/180) equals 1
 (unary minus)
Returns the arithmetic inverse of a number or expression.

Syntax: number, (expression)

Where number is the positive real number for which you want the arithmetic inverse.
Where expression you want the inverse of must be enclosed in parentheses.

Examples: 56 equals “minus 56” (the arithmetic inverse of 56)
(SIN(13.265)) equals the arithmetic inverse of SIN(13.265)
Type_J (thermocouple linearization)
Returns the linearized (corrected) value for a Type J thermocouple measurement. The ScaledValu output of an Analog Input module must be referenced, and the setup registers for the Analog Input module must be left at their default values. Linearized temperature is returned in degrees Celsius.

Syntax: Type_J(S#)

Where # is the number of the Source input that is connected to the Analog Input module’s ScaledValu output.

Example: Type_J(S1) returns the linearized measurement of the Type J thermocouple connected to an input device monitored by and Analog Input module. The Analog Input module’s ScaledValu output is connected to the Arithmetic module’s Source input #1.
Type_K (thermocouple linearization)
Returns the linearized (corrected) value for a Type K thermocouple measurement. The ScaledValu output of an Analog Input module must be referenced, and the setup registers for the Analog Input module must be left at their default values. Linearized temperature is returned in degrees Celsius.

Syntax: Type_K(S#)

Where # is the number of the Source input that is connected to the Analog Input module’s ScaledValu input.

Example: Type_K(S2) returns the linearized measurement of the Type K thermocouple signal linked to Source input 2
Type_R (thermocouple linearization)
Returns the linearized (corrected) value for a Type R thermocouple measurement. The ScaledValu output of an Analog Input module must be referenced, and the setup registers for the Analog Input module must be left at their default values. Linearized temperature is returned in degrees Celsius.

Syntax: Type_R(S#)

Where # is the number of the Source input that is connected to the Analog Input module’s ScaledValu input.

Example: Type_K(S1) returns the linearized measurement of the Type R thermocouple signal linked to Source input 1
Type_RTD (RTD linearization)
Returns the linearized (corrected) value for a Resistance Temperature Detector measurement. The ScaledValu output of an Analog Input module must be referenced, and the setup registers for the Analog Input module must be left at their default values. Linearized temperature is returned in degrees Celsius.

Syntax: Type_RTD(S#)

Where # is the number of the Source input that is connected to the Analog Input module’s ScaledValu input.

Example: Type_RTD(S4) returns the linearized measurement of the Resistance Temperature Detector’s signal linked to Source input 4
Type_T (thermocouple linearization)
Returns the linearized (corrected) value for a Type T thermocouple measurement. The ScaledValu output of an Analog Input module must be referenced, and the setup registers for the Analog Input module must be left at their default values. Linearized temperature is returned in degrees Celsius.

Syntax: Type_T(S#)

Where # is the number of the Source input that is connected to the Analog Input module’s ScaledValu input.

Type_T(S3) returns the linearized measurement of the Type K thermocouple signal linked to Source input 3
Binary or TwoOperand Functions
Binary functions operate on two numbers, expressions or Booleans. The following table summarizes the available functions.
Binary function  Description  Usage 

/  division  number/number 
DIV  integer divide  Div(number, number) 
=  equals  number=number 
>  greater than  number>number 
>=  greater than or equal  number>=number 
<  less than number  number < number 
<=  less than or equal  number<=number 
MOD  modulus  Mod(number, number) 
  minus  numbernumber 
*  multiplication  number*number 
<>, ~=, !=  does not equal 
number<>number number~=number number!=number 
+  addition  number+number 
POWER, ^  exponent 
POWER(number, number) number^number 
= (equals)
The equals operator is used to test if one number or expression is equal to another.

Syntax: number1=number2

The result will be TRUE if number1 is equal to number2, and will be FALSE if number1 does not equal number2.
/ (divide)
The divide operator is used to divide one number or expression by another.

Syntax: number1/number2

Where number1 is the original value (dividend).
number2 is the value that number1 is divided by (divisor).
NOTE: If number2 is zero (0), the corresponding Result output will become NOT AVAILABLE.
DIV (integer divide)
The divide operator will return the integer portion of the result of dividing one number by another.

Syntax: Div(number1,number2)

Where number1 is the number you want to be divided.
number2 is the number you want to divide by.

Examples: Div(10.5,10) equals 1
Div(27.25,5) equals 5
Div(10,2.5) equals 4
> (greater than)
The greater than operator is used to test if one number or expression is greater than another.

Syntax: number1>number2

The result will be TRUE if number1 is greater (larger) than to number2, and will be FALSE if number1 is less than or equal to number2.
>= (greater than or equal)
The greater than or equal operator is used to test if a number or expression is greater than or equal to another.

Syntax: number1>=number2

The result will be TRUE if number1 is greater (larger) than or equal to number2, and will be FALSE if number1 is less than number2.
< (less than)
The less than operator is used to test if one number or expression is less than another.

Syntax: number1<number2

The result will be TRUE if number1 is less than number2, and will be FALSE if number1 is greater than or equal to number2.
<= (less than or equal)
The less than or equal operator is used to test if one number or expression is less than or equal to some other number or expression.

Syntax: number1<=number2

The result will be TRUE if number1 is less than or equal to number2, and will be FALSE if number1 is greater than number2.
 (minus)
The minus operator is used to subtract one number or expression from another.

Syntax: number1number2

Where number2 is subtracted from number1.
MOD (modulus)
The modulus operator will give you the remainder of a divide operation.

Syntax: Mod(number1,number2)

Examples: Mod(10.5,10) equals 0.5
Mod(27.25,5) equals 2.25
Mod(10,2.5) equals 0
* (multiply)
The multiplication operator is used to multiply one number or expression by another.

Syntax: number1*number2

Where number1 and number2 are multiplied together.
<> (not equal)
The not equal operator is used to test if one number or expression is not equal to another.

Syntax: number1<>number2
number1~=number2
number1!=number2

The result will be TRUE if number1 does not equal number2, and will be FALSE if number1 does equal number2.
+ (plus)
The addition operator is used to add one number or expression to another.

Syntax: number1+number2

Where number1 and number2 are added together.
power
Raises a number or expression to the power of another number or expression.

Syntax: POWER(number1, number2)
number1^number2

Where number1 is the base number.
number2 is the exponent.

POWER(6,2) equals 36
6^2 equals 36
4^5/4 equals 5.656854
Tertiary or threeoperand functions
Tertiary functions operates on three operand expressions. The IF function is the only tertiary operator supported in the Arithmetic module.
Tertiary Function  Description  Usage 

IF  if conditional  IF (Boolean, number, number) 
IF
Returns one number if the Boolean test evaluates TRUE (evaluates to a nonzero number), and another number if it evaluates FALSE (evaluates to 0).

Syntax: IF(Boolean, number1, number2)

Where: Boolean can be evaluated to TRUE (nonzero) or FALSE (0).
number1 is the value that is returned if Boolean is TRUE.
number2 is the value that is returned if Boolean is FALSE.

Example: IF(S1>S2, S3, S4) returns S3 if S1>S2, or returns S4 if S1<=S2
Multipleoperand functions
Multipleoperand functions operate on a list of operands. The following table summarizes the available functions.
Multipleoperand function  Description  Usage 

AND  Boolean AND  AND(Boolean1, Boolean2…Boolean n) 
AVG  average  AVG(number1, number2…number n) 
MAX  maximum  MAX(number1, number2…number n) 
MIN  minimum  MIN(number1, number2…number n) 
OR  Boolean OR  OR(Boolean1, Boolean2…Boolean n) 
RMS  root mean square  RMS(number1, number2…number n) 
SUM  summation  SUM(number1, number2…number n) 
SUMSQ  square of the sum  SUMSQ(number1, number2…number n) 
AND
Returns TRUE if all Booleans are TRUE; returns FALSE if one or more Booleans is FALSE.

Syntax: AND(Boolean1,Boolean2, ...)

Where Boolean1,Boolean2, ... are 1 to n conditions you want to test that can be either TRUE (nonzero) or FALSE (0).

Examples: AND(1, 1) equals TRUE
AND(1, 0) equals FALSE
AND(2+2=4, 2+3=5) equals TRUE
If S1:S3 contains the values that evaluate to TRUE, FALSE, and TRUE, then: AND(S1:S3) equals FALSE
AVG
Returns the average (arithmetic mean) of the numbers or expressions.

Syntax: AVG(number1, number2, ...)

Where number1, number2,... are 1 to n numbers for which you want the average.

Examples: If S1:S5 contains the numbers 10, 7, 9, 27, and 2, then:
AVG(S1:S5) equals 11
AVG(S1:S5, 5) equals 10
MAX
Returns the maximum value in a list of numbers or expressions.

Syntax: MAX(number1, number2, ...)

Where number1, number2,... are 1 to n numbers for which you want the maximum.

Examples: If S1:S5 contains the numbers 12, 7, 9, 27, and 2, then:
MAX(S1:S5) equals 27
MIN
Returns the minimum value in a list of numbers or expressions.

Syntax: MIN(number1, number2, ...)

Where number1, number2,... are 1 to n numbers for which you want the minimum.

Examples: If S1:S5 contains the numbers 42, 7, 9, 27, and 2, then:
MIN(S1:S5) equals 2
MIN(S1:S5, 0) equals 0
OR
Returns TRUE if any Boolean is TRUE; returns FALSE if all Booleans are FALSE.

Syntax: OR(Boolean1,Boolean2,…)

Where Boolean1,Boolean2, ... are 1 to n conditions that can be either TRUE (nonzero) or FALSE (0).

Examples: OR(1) equals TRUE (nonzero)
OR(1+1=1,2+2=5) equals FALSE (0)
RMS
Returns the Root Mean Square of the numbers or expressions.

Syntax: RMS(number1, number2, ...)

Where number1, number2,... are 1 to n numbers for which you want the Root Mean Square.

Example: RMS(2,3) equals 2.549510
SUM
Returns the sum of the numbers or expressions.

Syntax: SUM(number1, number2, ...)

Where number1, number2,... are 1 to n numbers for which you want the sum.

Examples : SUM(3, 2) equals 5
SUM(S2:S5) equals the sum of Source inputs 2, 3, 4 and 5
SUMSQ
Returns the sum of the squares of the numbers or expressions.

Syntax: SUMSQ(number1, number2,...)

Where number1, number2,... are 1 to n numbers for which you want the sum of the squares.

Example: SUMSQ(3, 4) equals 25
Constants
Arithmetic module formulas can include the following constant:
Constant  Description 

PI  The constant PI: the relationship of a circle’s circumference to its diameter. 
PI
The constant PI is equal to 3.14159265358979, accurate to 15 digits.

Syntax: PI

Example: 4*PI equals 4 times PI, or 12.5664
Detailed Module Operation
The Arithmetic module is capable of a wide variety of calculations with seven digit precision. To illustrate a typical application, the following example shows how to use the Arithmetic module to calculate the cost of fuel per kilowatt ($/kW) and the cost of fuel per kilowatthour ($/kWh) for a simple mechanical generation system comprised of a diesel generator. The cost per second ($/second) consumed by the system is also included.
Before programming the module, create your formulas on paper and test them. Remember to check the units of the quantities used in the formula to ensure they are balanced correctly.
The first step is to identify the components of your formula; the constants and variables required to achieve the results. In this example, the $/kW and $/kWh values are based on the cost of fuel, the fuel flow rate, and the instantaneous kW. These values are as follows:
Formula component  Source  Units 

fuel cost  constant, currently 0.30  $/l 
fuel flow rate  analog input attached to a flow sensor on the generator’s fuel line  l/min 
instantaneous kW  Power Meter module’s kW total output  kW 
Next, the modules must be linked to provide the fuel flow rate and the kW total. The resulting framework will look like this:As the fuel cost is constant, it can be entered directly into the formula as a numeric value. The fuel flow rate will be read at Source input 1, so it will be referenced in formulas as S1. Note that S1 has units of l/min which must be converted to l/sec to balance with the units of the other quantities (dividing by 60 will convert l/min to l/ sec). The instantaneous kW will be read at Source input 2, so it will be referenced as S2.
To generate the results, $/kW, $/kWh, and $/second being consumed by the system, setup registers must be programmed with the appropriate formula for each result we want. The formulas you need are as follows:
Setup Register  Formula 

1  (S1/60) * .3 / S2 
2  (S1/60) * .3 
3  ((S1/60) * .3) * 3600/S2 
Thermocouple linearization
The Arithmetic module’s thermocouple operators are designed for use with Grayhill type J, K, R, T thermocouples, and RTD input devices, that have zeroscale and fullscale temperatures that match those shown in the following table.
Type  Zero Scale (°C)  Full Scale (°C)  Lowest Valid Output (°C)  Highest Valid Output (°C) 

J  0  700  0  760 
K  100  924  0  1370 
R  0  960  0  1000 
T  200  224  160  400 
RTD  50  350  50  350 
In addition to a properly rated thermocouple or RTD, linearization also requires the following:

An ION7700 with external Grayhill analog input devices

Designer software
Use the following procedure to get a linearized temperature measurement from one of the supported thermocouples or RTD:

Connect the appropriate thermocouple to a Grayhill analog Input device, and connect this input device to the ION7700 meter’s external I/O board.

Using Designer software, add an Analog Input module to the ION7700.

Configure the Port setup register of the Analog Input module appropriately for the hardware port where you have connected the thermocouple or RTD. Leave the Zero Scale and Full Scale setup registers at their default values. The default values are: Zero Scale = 0, Full Scale = 1.

Connect the ScaledValu output register of the Analog Input module to one of the Source inputs of the Arithmetic module.

Create a formula in an Arithmetic module setup register that uses the linearization operator for the type of thermocouple you are using. The operator should reference the source input you have linked to the ScaledValu output register of the Analog Input module.

Save the changes you’ve made to the ION7700 and exit Designer.
Time of use framework
Below is another typical application for the Arithmetic module.
This illustrates how a simple timeofuse framework can be implemented to calculate the cost of energy consumption. Let’s say your power provider charges you different energy rates during different times of the day:
Time of day  Rate ($/kWh) 

12:00 AM to 8:00 AM  $0.05 
8:00 AM to 5:00 PM  $0.12 
5:00 PM to 12:00 AM  $0.08 
In this example, the Scheduler module’s Output Profile #1 to #3 setup registers are set to turn ON during the times listed above.
The Integrator modules are linked to the kW tot output of the Power Meter module — these Integrators calculate energy (kWh). The Enable input of each Integrator is linked to the Scheduler’s Status output #1 through #3, respectively. Each Integrator therefore monitors the kWh use ONLY during the time periods assigned to them by the Scheduler.
The Arithmetic module’s Formula #1 to #4 setup registers are set to calculate the cost during each time period, as well as the total cost:
Formula  Result 

S1*.05  Energy cost during 12:00 AM to 8:00 AM 
S1*.12  Energy cost during 8:00 AM to 5:00 PM 
S1*.08  Energy cost during 5:00 PM to 12:00 AM 
SUM(R1:R3)  Total energy cost for above (Result 1 through 3) 
The External Pulse module is linked to the Reset inputs of the Integrator modules. This allows you to manually clear the Integrators (for example, you may want to clear it on a daily, weekly or monthly basis).
Responses to Special Conditions
The following table summarizes how the Arithmetic module behaves under different conditions.
Condition  Response of output register 

If the Source inputs are NOT AVAILABLE 
Any formulas that reference a NOT AVAILABLE Source input will return a NOT AVAILABLE value to the corresponding Result output. NOTE: The IF function can reference NOT
AVAILABLE inputs and still provide a valid Result output. Refer to the IF function description for details.

If the Enable input is OFF  The Result output registers hold the last calculated values. 
After the module is relinked or its setup registers are changed  The Result output registers are NOT AVAILABLE, until the formulas are recalculated. 
When the device is started or poweredup (either the first time, or after a shutdown)  The Result output registers are NOT AVAILABLE, until the formulas are recalculated. 