Skip to main content
By default, each input port accepts one incoming connection. Use aggregating_input_port() when several upstream outputs should feed the same input (for example summing branch currents at a node, averaging redundant temperature sensors, or applying custom combine logic).

Fan-out vs fan-in

Regular input_port() ports still raise DuplicateConnectionError if you connect a second source.

Built-in aggregation

Built-in modes

Optional limits:

Custom aggregation (callable wins entirely)

Pass an aggregate callable to fully control how values are combined. When present, it replaces any built-in aggregation mode. The engine passes the raw list of upstream values to your function.

Aggregator signature

The return value is what solve(inputs) receives under port.name: always a single value, never a list.

Wiring a graph

Disconnecting one source

Serialization

Port.to_dict() serializes the aggregation mode ("sum", "custom", etc.) but not the callable. Custom functions live on the component class at definition time (the same pattern as solve()). When you deserialize a graph with SimulationGraph.from_dict(), the registered component class supplies aggregation_fn.

Composite components

Internal sub-graphs use the same aggregation rules. If two internal connections target the same aggregating input port, values are combined before the sub-component’s solver runs.