.Modelica.Clocked.RealSignals.Sampler.Utilities.Internal.UniformNoise

Information

This block adds uniformly distributed noise in the range noiseMin … noiseMax to the clocked Real input signal and provides the sum as clocked Real output signal.

The Integer[3] parameter vector firstSeed is used to initialize the basic random number generator. The 3 elements of firstSeed need to be in the range [0, 255]. The use of the same seed vector will lead to the same sequence of numbers when these are computed serially. This is usually not desired. Therefore, for every usage of block Noise a different firstSeed should be defined.

This noise generator is based on a function that generates a random real number uniformly in the semi-open range [0.0, 1.0). The function uses the standard Wichmann-Hill generator, combining three pure multiplicative congruential generators of modulus 30269, 30307 and 30323. Its period (how many numbers it generates before repeating the sequence exactly) is 6,953,607,871,644. While of much higher quality than the rand() function supplied by most C libraries, the theoretical properties are much the same as for a single linear congruential generator of large modulus. For more details, see the underlying function Internal.random.

Example

The following example samples zero signal with a periodic clock of 20 ms period, and adds noise in the range from -0.1 … 0.1:

UniformNoise_Model.png     UniformNoise_Result.png
model simulation result

Generated at 2020-06-05T21:39:08Z by OpenModelica 1.16.0~dev-442-g2e5bc9f