Add
Performs addition or subtraction of input signals.
|
|
|
Description
Block Add 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 block operations are specified using the parameters List of Signs. 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 parameters List of Signs value +-+, 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 a block Add 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 |
|
|
Input port sign |
|
||
Two or more input ports |
All characters of the input port are |
|
|
The k-th input port is the first port with the |
|
Ports
Output
#
OUT_1
—
output signal
scalar
| vector
| matrix
Details
An output signal resulting from addition and/or subtraction operations. The output signal has the same size as the input signals.
Data types |
|
Complex numbers support |
Yes |
Input
#
In_1
—
first input signal
scalar
| vector
| matrix
Details
Input signal for an addition or subtraction operation. If there is only one input signal, the addition or subtraction is performed for all its elements.
Data types |
|
Complex numbers support |
Yes |
#
In_n
—
nth input signal of the operand
scalar
| vector
| matrix
Details
n-th input signal for operations. The number of input signals corresponds to the number of characters in the parameters List of Signs. 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 |
|
Complex numbers support |
Yes |
Parameters
Main
# List of Signs — operations performed on input data
Details
Enter the addition and subtraction operations performed on 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.
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
Yes |
Accumulator settings
#
Accumulator data type —
drive data type
Inherit: auto
| Same as first input
| Float64
| Float32
| Float16
| Int8
| UInt8
| Int16
| UInt16
| Int32
| UInt32
| Int64
| UInt64
| Int128
| UInt128
| Fixed-point
Details
Select the data type for the drive.
Values |
|
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
No |
#
Accumulator fixed-point type —
fixed-point data type for the drive
Data type
Details
Specify the fixed-point data type for the drive.
Dependencies
To use this parameter, set the parameters to Accumulator data type value Fixed-point
.
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
Yes |
Output settings
#
Output data type —
output data type
Inherit: auto
| Same as accumulator
| Same as first input
| Float64
| Float32
| Float16
| Int8
| UInt8
| Int16
| UInt16
| Int32
| UInt32
| Int64
| UInt64
| Int128
| UInt128
| Fixed-point
Details
Select the type for the output data.
Values |
|
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
No |
#
Output fixed-point type —
fixed-point output data type
Data type
Details
Specify the fixed point data type for the output data.
Dependencies
To use this parameter, set parameter Output data type value Fixed-point
.
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
Yes |
Main
#
Integer rounding mode —
rounding mode for fixed-point operations
Ceiling
| Convergent
| Floor
| Nearest
| Round
| Zero
Details
Select the rounding mode for fixed-point operations. You can select:
-
Floor
- rounds both positive and negative numbers downwards (towards negative infinity). -
Ceiling
- rounds both positive and negative numbers upwards (towards positive infinity). -
Convergent
- rounds the number to the nearest representable value. If the fractional part of a number ends in 5, the number is rounded to the nearest even integer. -
Nearest
- rounds the number to the nearest representable value. If the fractional part of the number ends in 5, the number is rounded upwards (towards positive infinity). -
Round
- rounds the number to the nearest representable value. If the fractional part of a number ends in 5, positive numbers are rounded upwards (towards positive infinity) and negative numbers are rounded downwards (towards negative infinity).
-
Zero
- rounds the number towards zero.
The block parameters are always rounded to the nearest representable value.
Values |
|
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
No |
#
Saturate on integer overflow —
overflow action method
Logical
Details
When checked, saturation is applied to all internal block operations, not just the output or result.
Action | Reasons for taking this action | What happens when | overflows Example |
---|---|---|---|
Check this box. |
Overflows are possible in your model and you need explicit saturation protection in the generated code. |
Overflows are saturated to the minimum or maximum value that this data type can represent. |
An overflow associated with a signed 8-bit integer may saturate to |
Do not select this check box. |
You want to optimise the efficiency of the generated code. |
Overflows are wrapped in an appropriate value that can be represented by a data type. |
The number |
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
No |