Sum
MathCalculates the algebraic sum of all connected input signals. Features a multi-wire input terminal (multiple: true), enabling an arbitrary number of signals to be wired into a single summing junction without cascading separate two-input blocks. Serves as the universal summing node in feedback control loops, feedforward disturbance compensation networks, sensor signal aggregators, and Newton-Euler mechanical force balance models.
[!TIP]
Looking for a Feedback Error Junction ()?
TheSumblock assigns positive signs () to all connected inputs. For a standard negative-feedback summing junction where the feedback signal must be subtracted (), use the dedicatedSubtractionblock (which features distinct and input ports), or insert aGainblock set to in the feedback path.
Mathematical Model
For an arbitrary set of active input signals , the output represents the linear superposition:
In the boundary case where no input wires are connected (), the block outputs zero:
By passing inverted signals (using a Gain block with ) into the summing junction, the block implements generalized multi-input addition and subtraction:
Inputs & Outputs
| Direction | ID | Label | Type | Status |
|---|---|---|---|---|
| → In | in |
+ | number | Required |
| ← Out | out |
Sum | number | Output |
Usage Examples
Example 1: Feedback Control Summing Junction with Disturbance Feedforward
In a high-bandwidth servomechanism, a feedback error signal is combined with an anticipatory feedforward disturbance compensation signal to reject load torque spikes. Connecting both the feedback controller output and the feedforward signal into a single Sum block drives the actuator with the composite command , improving rejection of sudden load changes.
Example 2: Newton's Second Law Net Force Summation
In vehicle dynamics simulation, accelerating a vehicle mass () requires evaluating the net force from multiple independent physical sources: engine traction force , aerodynamic drag , rolling tire resistance , and gravitational slope resistance . Wiring each individual force component into a single Sum block produces the net resultant force before feeding an Integrator chain to compute vehicle velocity and position.
Remarks & Best Practices
- Multi-Wire Input Architecture: The input terminal accepts multiple simultaneous connections (
multiple: true), eliminating diagram clutter and avoiding long cascades of binary summing blocks. - Linear Superposition: Summation is strictly commutative and associative, ensuring that wire connection order does not alter the mathematical outcome.
- Double-Precision Floating Point: Evaluated in Rust using IEEE-754 64-bit floats (
f64), preserving numerical precision when adding tiny perturbation signals to large static operating points. - Comparison with Subtraction Block: The
Sumblock assigns positive signs () to all connected inputs. For traditional closed-loop control with distinct positive reference () and negative feedback () terminals, use theSubtractionblock.
Related Components
- Subtraction: Dedicated subtraction node with dedicated and input ports.
- Product: Multiplies multiple signals together.
- Gain: Scales individual signals with positive or negative multipliers.
- Constant: Injects fixed numeric biases or setpoint levels.