ADD block

Short summary

Name

ADD

→POU type

→function

Category

IEC-block, Numeric

Conform to →IEC-standard

(error) currently restricted
(IEC demands data type ANY_MAGNITUDE for the inputs and the return value, hence the following data type is demanded as well: LTIME. Currently, this data type is not supported for the block.) (IEC demands error handling, if the result of the block exceeds the range of values for the output data type. See "No check of invalid connections" for the behavior in Neuron Power Engineer.)

Graphical interface

Available since

  • version 1.0.0 (for Neuron Power Engineer) – initial variant: ANY_NUM for inputs and return value

  • version 1.64.0 (for Neuron Power Engineer) – enhancement: TIME for inputs and return value

Functionality

The mathematical function addition is called: The block returns the sum of all values connected to the inputs.

No check of invalid connections

For some blocks, invalid connections are not checked by Neuron Power Engineer. Therefore, enter code in your application to detect invalid connections (e.g. IF-statements in the ST-code). See "Examples for invalid Connections".

See "IEC-blocks for the application" for information what the consequences of an invalid connection might be.

Inputs, return value

 

Identifier

→Data type

Description

Inputs:

IN1

REALLREALUSINTUINTUDINTULINTSINTINTDINTLINT oder TIME 

1st value

IN2

REALLREALUSINTUINTUDINTULINTSINTINTDINTLINT oder TIME 

2nd value

... (extensible until)  

IN16

REALLREALUSINTUINTUDINTULINTSINTINTDINTLINT oder TIME 

16th value

Return value:

REALLREALUSINTUINTUDINTULINTSINTINTDINTLINT oder TIME 

 

Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.

See:

Example for usage within ST-editor

PROGRAM Test
   VAR
      result : INT;
   END_VAR
   result := ADD(IN1 := 3, IN2 := 4);    (* The variable 'result' evaluates to '7'. *)
END_PROGRAM

When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.

Examples for invalid connections

 An invalid connection due to →overflows or →underflows might occur during a calculation using ADD.

Examples for invalid connections
ADD(IN1 := SINT#100, IN2 := SINT#50);
    (* Overflow: '100 + 50' would evaluate to '150' but calculates '-106'. Upper limit for SINT is '127'. *)
ADD(IN1 := SINT#-100, IN2 := SINT#-50);
    (* Negative overflow: '-100 + -50' would evaluate to '-150' but calculates '106'. Lower limit for SINT is '-128'. *)