You are here: Core Reference > Coding > Logic > ADD

ADD

Function Name

ADD

ST Operator

+

Description

Provides a sum total of the 2 inputs.

Arguments

Input 1 - Input n{ANY_MAGNITUDE}

The ADD function can have 2 or more inputs and these can be of any type within the ANY_MAGNITUDE category (see Data Type Hierarchy).

Returns

Total {Same type as input}

The total value of the inputs combined (Input 1 + Input 2 + Input 3 and so on). The type of output is dependent on the inputs.

Example:

Function Block Diagram - ADD:

The ADD function is used to provide a total of 2 inputs. In this case, Input 1 is 2 and Input 2 is 5. The ADD function returns 7 (2+5=7)

ST Program - ADD:

The ADD function is used to provide the total value of 3 inputs. In this case, Input 1 is 2, Input 2 is 5, and Input 3 is 17. The ADD function returns 24 (2+5+17=24):

Output := ADD (Input 1, Input 2, Input 3);


Where Output, Input 1, Input 2 and Input 3 are defined as variables earlier in the ST program.

Alternatively, the same calculation can be made by using the following syntax:

Output := Input 1 + Input 2 + Input 3;

Again, where Output, Input 1, Input 2 and Input 3 are defined as variables earlier in the ST Program.


ClearSCADA 2015 R2