pySimBlocks.blocks.sources.white_noise

class pySimBlocks.blocks.sources.white_noise.WhiteNoise(name: str, mean: ArrayLike = 0.0, std: ArrayLike = 1.0, seed: int | None = None, sample_time: float | None = None)[source]

Bases: BlockSource

Multi-dimensional Gaussian white noise source block.

Generates independent Gaussian noise samples at each simulation step, element-wise on a 2D output array:

y = mean + std * N(0,1).

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

mean

Mean value of the noise, as a 2D array.

std

Standard deviation of the noise, as a 2D array.

rng

NumPy random generator instance used to draw samples.

initialize(t0: float) None[source]

Draw an initial noise sample and set the output.

Parameters:

t0 – Initial simulation time in seconds.

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

Draw a new noise sample and write it to the output port.

Parameters:
  • t – Current simulation time in seconds.

  • dt – Current time step in seconds.