pySimBlocks.blocks.operators.demux¶
- class pySimBlocks.blocks.operators.demux.Demux(name: str, num_outputs: int = 2, sample_time: float | None = None)[source]¶
Bases:
BlockVector split block (inverse of Mux).
Splits one input column vector of length n into p output segments. Segment sizes are distributed as evenly as possible: let q = n // p and m = n % p, then the first m outputs have size q+1 and the remaining p-m outputs have size q.
- num_outputs¶
Number of output segments to produce.
- direct_feedthrough = True¶
True if outputs depend directly on inputs.
- initialize(t0: float) None[source]¶
Compute initial outputs, or set zero placeholders if input is unavailable.
- Parameters:
t0 – Initial simulation time in seconds.
- output_update(t: float, dt: float) None[source]¶
Split the input vector and write the segments to the output ports.
- Parameters:
t – Current simulation time in seconds.
dt – Current time step in seconds.
- Raises:
RuntimeError – If input
'in'is not connected.ValueError – If input is not a column vector or has fewer elements than
num_outputs.