Engee documentation

Add

Adds or subtracts input signals.

Add

add

Sum of Elements

sum of elements

Description

The Add block performs addition or subtraction of input signals. This block can add or subtract scalar, vector or matrix signals. It can also sum the elements of the signal.

The operations of the block are specified using the List of signs parameter. Available operations and symbols:

  • Addition ( +).

  • Subtraction ( -).

  • The number of + and - symbols is equal to the number of input ports of the unit.

    For example, if you specify +-+ for the *List of signs parameter,* the block will have three input ports. The block subtracts the second (middle) input signal from the first (top) and then adds the third (bottom).

  • If only addition is performed, a numeric value equal to the number of inputs can be set.

Calculating the output value

Calculation of the output value for the Add block depends on the number of block inputs and the sign of the input ports:

If the block And…​ Formula for calculating the output value…​ Where…​

One input port

Input port sign +

y = e[0]+e[1]+e[2]…​+ e[m]

e[i] is the i`th element of the input `u

Input port sign -

y = 0.0-e[0]-e[1]-e[2]…​-e[m]

Two or more input ports

All characters of the input port are -

y = 0.0-u[0]-u[1]-u[2]…​-u[n]

u[i] is the input to the `i`th input port

The k-th input port is the first port with the + sign

y = u[k]-u[0]-u[1]-u[2]-u[k-1] (+/-) u[k+1]…​ (+/-) u[n]

Ports

Input

Port_1 - first input signal
scalar | vector | matrix

Input signal for addition or subtraction operation. If there is only one input signal, the addition or subtraction is performed for all its elements.

Data types: Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Bool.

Support for complex numbers: Yes

Port_n - nth operand input signal
scalar | vector | matrix

n-th input signal for operations. The number of input signals corresponds to the number of signs in the List of signs parameter. The block applies operations to the input data in the specified order.

All non-scalar input data must have the same dimensions. Scalar input data is expanded to have the same dimensions as other input data.

Data types: Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Bool.

Support for complex numbers: Yes

Output

Port_1 - output signal
scalar | vector | matrix

Output signal obtained as a result of addition and/or subtraction operations. The output signal has the same size as the input signals.

Data types: Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Bool.

Parameters

Main

List of signs - operations performed on the input data
++ (by default)` | + | - | integer positive scalar'`

Enter the addition and subtraction operations performed on the input data. An input port is created for each operation.

Addition is the operation by default. The operations are performed in the order specified.

For a single vector input, + or − adds or subtracts elements across all dimensions.

If only addition is performed, you can specify a numeric value equal to the number of inputs.

Usage in program code

Block parameter

Inputs

Values

+ | - | Integer

By default

++

Output data type - output data type
Float 64 (by default) | Float 32 | Float 16 | Int16 | UInt16 | Int32 | Int64 | UInt64 | UInt32 | complexF64 | complexF32 | complexF16

Select the type of data to output.

Usage in program code

Block parameter

OutDataTypeStr

Values

Float 64 | Float 32 | Float 16 | Int16 | UInt16 | Int32 | Int64 | UInt64 | UInt32 | complexF64 | complexF32 | complexF16

* By default*

Float 64

Output data type method - method for specifying the output data type
Internal rule (by default) | Same as input | Specified

Specify the method of setting the output data type.

Usage in program code

Block parameter

OutDataTypeStr

Values

Internal rule | Same as input | Specified

By default

Internal rule

Additional options

C code generation: Yes