Skip to main content
Components are Python classes with typed ports, configurable parameters, and a solve() method. Hardwave provides a decorator for quick authoring and a manual registration path for full control.

Using the @component decorator

The decorator automatically attaches ComponentMeta and registers the class with ComponentRegistry.

Manual definition

Parameters

Parameter defines static configuration on a component instance:
Access parameters at solve time with self.get_param("t_min"). Override defaults when adding instances to a graph:

Optional ports

Mark input ports as optional with a default:

Aggregating input ports

When several upstream components should drive the same input, use aggregating_input_port(). The engine gathers all connected values and produces one value for solve().
Built-in modes include SUM, MEAN, MIN, MAX, PRODUCT, FIRST, and LAST. Optional min_connections and max_connections enforce wiring limits at validation or connect time.

Aggregating Input Ports

Full guide with graph wiring, disconnect APIs, and serialization notes

Testing in isolation

Call solve() directly before wiring a component into a graph:

Injecting a custom solver

Replace the default solve() logic without changing ports or wiring:
See Solvers for ODE, lookup table, and ML solver options.

Runtime fault diagnostics

Components can emit WARNING and FAULT diagnostics when operating limits are exceeded during simulation. Implement two optional hooks:
Expose health and fault_code output ports so other components (e.g. an MCU) can react to faults:

Component Faults and Health

Built-in fault rules, FaultMode, and result inspection