pySimBlocks.blocks.interfaces.external_input

class pySimBlocks.blocks.interfaces.external_input.ExternalInput(name: str, sample_time: float | None = None)[source]

Bases: Block

External input interface block.

Pass-through block for injecting real-time measurements into the model. Accepts scalar, (n,) or (n,1) inputs and forwards them as a strict (n,1) column vector. The output shape is frozen after the first non-None input and cannot change during the simulation.

direct_feedthrough = True

True if outputs depend directly on inputs.

initialize(t0: float) None[source]

Set the output to zero if no input is available, or forward the input.

Parameters:

t0 – Initial simulation time in seconds.

output_update(t: float, dt: float) None[source]

Forward the input to the output as a column vector.

Parameters:
  • t – Current simulation time in seconds.

  • dt – Current time step in seconds.

Raises:
  • RuntimeError – If input in is not set.

  • ValueError – If the input shape is incompatible or has changed.

state_update(t: float, dt: float) None[source]

No-op: ExternalInput carries no internal state.