Simulink Reference    
Sum

Add or subtract inputs

Library

Simulink Math Operations and Fixed-Point Blockset Math

Description

The Sum block performs addition or subtraction on its inputs. This block can add or subtract scalar, vector, or matrix inputs. It can also collapse the elements of a single input vector.

You specify the operations of the block with the List of Signs parameter. Plus (+), minus (-), and spacer (|) characters indicate the operations to be performed on the inputs:

When the Show additional parameters check box is selected, some of the parameters that become visible are common to many blocks. For a detailed description of these parameters, refer to Block Parameters in the Fixed-Point Blockset documentation.

Data Type Support

The Sum block accepts signals of any complexity and data type, including fixed-point data types, except int64 and uint64. The inputs may be of different data types unless the Require all inputs to have same data type parameter is selected.

Parameters and Dialog Box

Icon shape
Designate the icon shape of the block.
List of signs
Enter as many plus (+) and minus (-) characters as there are inputs. Addition is the default operation, so if you only want to add the inputs, enter the number of input ports. For a single vector input, "+" or "-" will collapse the vector using the specified operation.
You can manipulate the positions of the input ports on the block icon by inserting spacers (|) between the signs in the List of signs parameter. For example, "++|--" creates an extra space between the second and third input ports.
Show additional parameters
If selected, additional parameters specific to implementation of the block become visible as shown.

Require all inputs to have same data type
Select this parameter to require that all inputs must have the same data type.
Output data type mode
Specify the output data type and scaling to be the same as the first input, or inherit the data type and scaling from an internal rule or by backpropagation. You can also choose a built-in data type from the drop-down list. Lastly, if you choose Specify via dialog, the Output data type, Output scaling value, and Lock output scaling against changes by the autoscaling tool parameters become visible.
Output data type
Specify any data type, including fixed-point data types. This parameter is only visible if Specify via dialog is selected for the Output data type mode parameter.
Output scaling value
Set the output scaling using radix point-only or [Slope Bias] scaling. This parameter is only visible if Specify via dialog is selected for the Output data type mode parameter.
Lock output scaling against changes by the autoscaling tool
If selected, scaling of outputs is locked. This parameter is only visible if Specify via dialog is selected for the Output data type mode parameter.
Round integer calculations toward
Select the rounding mode for fixed-point output.
Saturate on integer overflow
If selected, overflows saturate.

Conversions and Operations

The Sum block first converts the input data type(s) to the output data type using the specified rounding and overflow modes, and then performs the specified operations. Refer to Rules for Arithmetic Operations in the Fixed-Point Blockset documentation for more information about the rules that this block obeys when performing fixed-point operations.

Characteristics

Dimensionalized
Yes
Direct Feedthrough
Yes
Sample Time
Inherited from driving blocks
Scalar Expansion
Yes
States
0
Zero Crossing
No


  Subsystem, Atomic Subsystem Switch