pySimBlocks.blocks.sources.ramp

class pySimBlocks.blocks.sources.ramp.Ramp(name: str, slope: ArrayLike, start_time: ArrayLike = 0.0, offset: TypeAliasForwardRef('ArrayLike') | None = None, sample_time: float | None = None)[source]

Bases: BlockSource

Multi-dimensional ramp signal source block.

Generates a ramp signal element-wise on a 2D output array:

y(t) = offset + slope * max(0, t - start_time)

Parameters may be scalars, vectors, or matrices. Only scalar-to-shape broadcasting is allowed; all non-scalar parameters must share the same shape.

slope

Ramp slope as a 2D array.

start_time

Time at which the ramp starts, as a 2D array.

offset

Output value before the ramp starts, as a 2D array.

initialize(t0: float) None[source]

Set the output to the offset value at t0.

Parameters:

t0 – Initial simulation time in seconds.

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

Compute and write the ramp value to the output port.

Parameters:
  • t – Current simulation time in seconds.

  • dt – Current time step in seconds.