pySimBlocks.blocks.operators.sum¶
- class pySimBlocks.blocks.operators.sum.Sum(name: str, signs: str | None = None, sample_time: float | None = None)[source]¶
Bases:
BlockMulti-input signed summation block.
Computes an element-wise signed sum of multiple 2D input signals. All non-scalar inputs must share the same shape; scalar (1,1) inputs are broadcast to that shape.
- signs¶
List of +1.0 or -1.0 coefficients, one per input port.
- num_inputs¶
Number of input ports.
- direct_feedthrough = True¶
True if outputs depend directly on inputs.
- initialize(t0: float) None[source]¶
Compute the initial output if all inputs are available.
- Parameters:
t0 – Initial simulation time in seconds.
- output_update(t: float, dt: float) None[source]¶
Compute the signed element-wise sum and write it to the output port.
- Parameters:
t – Current simulation time in seconds.
dt – Current time step in seconds.
- Raises:
RuntimeError – If any input port is not connected.
ValueError – If any input is not 2D or non-scalar inputs have inconsistent shapes.