pathsim.blocks.rng module

class pathsim.blocks.rng.RNG(sampling_rate=None)[source]

Bases: Block

Generates a random output value between -1 and 1 from a uniform distribution.

If no sampling_rate (None) is specified, every simulation timestep gets a random value.

Parameters:

sampling_rate (float, None) – number of random samples per time unit

n_samples

internal sample counter

Type:

int

val

internal random number state

Type:

float

reset()[source]

Reset the blocks inputs and outputs and also its internal solver, if the block has a solver instance.

sample(t)[source]

Sample from a normal distribution after successful timestep.

Parameters:

t (float) – evaluation time for sampling

update(t)[source]

update system equation for fixed point loop, here just setting the outputs

Parameters:

t (float) – evaluation time

Returns:

error – absolute error to previous iteration for convergence control (always ‘0.0’ because source-type)

Return type:

float