RANDOM: Random number generation
Block RANDOM (FB426) supplies a random output signal. The sequence of the new values can be determined: at random or constant. The value range of the output signal can be limited.
Application
The block allows for the following applications:
- Generate a random number of pulses e.g. for random switch-on or switch-off of any functions or aggregates.
- Generate a random number for further use.
Functionality
Block RANDOM generates a real value output signal [Out] and a binary output signal [Imp].
The real values of [Out] are distributed at random across the value range [OutMin], [OutMax].
The output values of [Out] and [Imp] are issued at random intervals between [TiMin], [TiMax] or at constant intervals (e.g. every 10 seconds).
Example1: Random number [Out] at intervals between [TiMin] and [TiMax].
If [TiMin] < [TiMax], then a new random number [Out] is issued at the earliest after [TiMin] and at the latest after [TiMax].
A new pulse [Imp] is issued at the same time. Each pulse lasts one program cycle.

Example 2: Random number [Out] in each program cycle.
If [TiMin] = [TiMax] = 0, then a new random number [Out] is issued in each program cycle.
The binary output signal [Imp] is constant: [Imp] = 1.

Example 3: Random number [Out] at constant intervals.
If [TiMin] = [TiMax] = x, then a new random number [Out] is always issued after time x.
A new pulse [Imp] is issued at the same time. Each pulse lasts one program cycle.
(Prerequisite: x <> 0)

Inputs
Pin | E | Description | |
EnFnct |
| Enable function. | |
OutMax |
| Maximum output value. Maximum value for [Out]. | |
OutMin |
| Minimum output value. Minimum value for [Out]. | |
TiMax |
| Maximum time. A new value [Out] is generated at the latest after this max. time. | |
0 | The sampling time lasts one program cycle. Default value. | ||
[TiMin]=[TiMax] | Constant pulse sequence. | ||
TiMin |
| Minimum time. A new value [Out] is generated at the earliest after this min. time. | |
0 | The shortest sampling time lasts one program cycle. Default value. | ||
[TiMin]=[TiMax] | Constant pulse sequence. | ||
Outputs
Pin | E | Description | |
Out |
| Output. | |
Imp |
| Pulse | |
[TiMin]<>[TiMax] | Each pulse lasts one program cycle. | ||
[TiMin]=[TiMax]=0 | [Imp] = constant = 1. | ||
Input values
Pin | Description | Data type | Default value | E.g. Engineering unit or Text group | Min. | Max. |
EnFnct | Enable function. | Boolean | 1 (Yes) | No, Yes |
|
|
OutMax | Maximum output value. | Real | 100.0 |
|
|
|
OutMin | Minimum output value. | Real | 0.0 |
|
|
|
TiMax | Maximum time. | Time | 0ms | T#0d_0h_0m_0s_0ms | 0 | 64800 |
TiMin | Minimum time. | Time | 0ms | T#0d_0h_0m_0s_0ms | 0 | 64800 |
Output values
Pin | Description | Data type | Default value | E.g. Engineering unit or Text group | Min. | Max. |
Out | Output. | Real | 0.0 |
|
|
|
Imp | Pulse | Boolean | 0 (Off) | Off, On |
|
|
Process response
Standard (see General rules and information).
Troubleshooting
Standard (see General rules and information).