This block is used to generate stochastic signals based on pseudo-random numbers.

By default the block generates a discrete signal changing at the frequency of 100Hz with uniformly distributed random numbers between 0 and 1.

To change the default behavior, you can choose a different random number generator, a different probability distribution or a different power spectral density.

Determine the function used to generate the pseudo-random numbers. All of these functions are designed in such a way that they return a pseudo-random number between 0 and 1 with an approximate uniform distribution.

There are two types of random number generators: Sample-Based RNGs and Sample Free RNGs.

- Sample-Based RNGs are based on a discrete state value that is changed at certain sample times. Hence these generators cause many time events.
- Sample-Free RNGs are based on the continuous time signal and transform it into a pseudo-random signal. These generators do not cause events.

Whether to better use sample-free or sample-based generators is dependent on the total system at hand and cannot be generically answered. If, however, the resulting signal shall be continuous (due to applying a PSD) then we propose to use sample-free RNGs.

The pseudo-random numbers are per se uniformly distributed between 0 and 1. To change the distribution of the pseudo-random number generators you can choose an appropriate function.

Each function may have its individual parameters for defining the characteristics of the corresponding PDF.

The power spectral density function defines the spectral characteristics of the output signal. In many cases it is used to generate a continuous pseudo-random signal by interpolation or filtering with certain charactistics w.r.t frequency and variance.

Many Ready-to-use PSD are offered. The advantage to use a PDF to a classic PT1-element is that no continuous time states are added to the system. The PSD implementation is based on discrete convolution and the use of a PSD may change the characteristics of the PDF. For more information see the reference included below.

The sample frequency determines the frequency of changes of the pseudo-random numbers.

For sample-free generators it is possible to apply an infinite frequency. Here the change is only limited by the numerical precision and determined by the step-size control of the applied ODE-solver. When using infinite frequency, PSDs cannot be meaningfully applied anymore.

The sample start time is only relevant if a sample-based generator is used.

The block can be disabled by the Boolean flag enable. A constant output value is then used instead.

All RNGs need to be seeded. With the same seed value an RNG will generate the same signal every simulation run. If you want to do multiple simulation runs for stochastic analysis, you have to determine a different seed for each run.

The seed value is determined by a local seed value. This value may be combined with a global seed value from the outer model "globalSeed".

The use of the local seed value is to make different instances of the PRNG block to generate different (uncorrelated) random signals. The use of the global seed value is to determine a new seeding for the complete system.

To get better understanding, you may look at the examples or refer to the paper:

Klöckner, A., van der Linden, F., & Zimmer, D. (2014), Noise Generation for Continuous System Simulation.

In *Proceedings of the 10th International Modelica Conference*, Lund, Sweden.

This publication can also be cited when you want to refer to this library.

Name | Description |
---|---|

SampleBasedRNG | Choice of sample based methods for RNG |

SampleFreeRNG | Choice of sample free methods for RNG |

Choice of various PDFs | |

PSD | Choice of various filters for the frequency domain |

Seed | Choice of the seeding function |

**Developed 2014 at the DLR Institute of System Dynamics and Control**

Generated at 2024-04-20T18:15:51Z by OpenModelicaOpenModelica 1.22.3 using GenerateDoc.mos