pySimBlocks.blocks.operators.delay¶
- class pySimBlocks.blocks.operators.delay.Delay(name: str, num_delays: int = 1, initial_output: TypeAliasForwardRef('ArrayLike') | None = None, sample_time: float | None = None)[source]¶
Bases:
BlockN-step discrete delay block.
Outputs a delayed version of the input signal by a fixed number of discrete time steps. The output at time k is the input at time k − N:
y[k] = u[k - N]
The buffer shape is inferred from the first non-None input unless an explicit
initial_outputof non-scalar shape is provided. A scalar (1,1) initial value is broadcast to match the first input. Once the shape is fixed, any mismatch raises an error.- num_delays¶
Number of discrete steps N (>= 1).
- direct_feedthrough = False¶
True if outputs depend directly on inputs.
- initialize(t0: float) None[source]¶
Set the initial output from the buffer, resolving shape if input is available.
- Parameters:
t0 – Initial simulation time in seconds.
- Raises:
ValueError – If the initial output shape is inconsistent with the resolved buffer shape.
- output_update(t: float, dt: float) None[source]¶
Output the oldest buffer entry.
- Parameters:
t – Current simulation time in seconds.
dt – Current time step in seconds.
- state_update(t: float, dt: float) None[source]¶
Shift the buffer left and append the current input.
- Parameters:
t – Current simulation time in seconds.
dt – Current time step in seconds.
- Raises:
RuntimeError – If input
'in'is not connected.ValueError – If the input is not 2D or its shape is inconsistent with the buffer.