pySimBlocks.blocks.sources.constant

class pySimBlocks.blocks.sources.constant.Constant(name: str, value: ArrayLike = 1.0, sample_time: float | None = None)[source]

Bases: BlockSource

Constant signal source block.

Generates a constant output signal with a fixed value over time. The output does not depend on time or any input signal.

value

Constant output value as a 2D array. Scalars are normalized to shape (1,1), 1D arrays to column vectors (n,1), and 2D arrays are preserved as-is.

initialize(t0: float) None[source]

Set the output to the constant value at t0.

Parameters:

t0 – Initial simulation time in seconds.

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

Write the constant value to the output port.

Parameters:
  • t – Current simulation time in seconds.

  • dt – Current time step in seconds.