pathsim.blocks.rng module

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

Bases: Block

Generates a random output value using numpy.random.rand.

If no sampling_rate (None) is specified, every simulation timestep gets a random value. Otherwise an internal Schedule event is used to periodically sample a random value and set the output like a sero-order-hold stage.

Parameters:

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

_sample

internal random number state in case that no samplingrate is provided

Type:

float

Evt

internal event that periodically samples a random value in case samplingrate is provided

Type:

Schedule

update(t)[source]

Setting output with random sample in case of samplingrate==None, otherwise does nothing.

Parameters:

t (float) – evaluation time

sample(t)[source]

Generating a new random sample at each timestep in case of samplingrate==None, otherwise does nothing.

Parameters:

t (float) – evaluation time

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

Bases: RandomNumberGenerator