pySimBlocks.blocks.sources.step

class pySimBlocks.blocks.sources.step.Step(name: str, value_before: ArrayLike = 0.0, value_after: ArrayLike = 1.0, start_time: float = 1.0, sample_time: float | None = None, eps: float = 1e-12)[source]

Bases: BlockSource

Step signal source block.

Generates a step signal that switches from an initial value to a final value at a specified time. Scalar values are broadcast to match the shape of non-scalar counterparts.

value_before

Output value before the step, as a 2D array.

value_after

Output value after the step, as a 2D array.

start_time

Time at which the step occurs in seconds.

EPS

Tolerance used to compensate floating-point rounding on discrete time grids.

initialize(t0: float) None[source]

Set the output to value_before or value_after depending on t0.

Parameters:

t0 – Initial simulation time in seconds.

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

Write value_before or value_after to the output port based on t.

Parameters:
  • t – Current simulation time in seconds.

  • dt – Current time step in seconds.