Documentation

Generate Random Signals

Generate Random Event-Based Signals

The Event-Based Random Number block is designed to create event-based signals using a variety of distributions. The block generates a new random number from the distribution upon notifications from a port of a subsequent block. For example, when connected to the t input port of a Single Server block, the Event-Based Random Number block generates a new random number each time it receives notification that an entity has arrived at the server. The t input port of a Single Server block is an example of a notifying port; for a complete list, see Notifying Ports. You must connect the Event-Based Random Number block, directly or indirectly, to exactly one notifying port. The notifying port tells this block when to generate a new output value. An indirect connection must be via a block listed in Computational Blocks having exactly one input signal and no function-call output signals.

For details on the connectivity restrictions of the Event-Based Random Number block, see its reference page.

Generate Random Signals Based on Arbitrary Events

A flexible way to generate random event-based signals is to use the Signal Latch block to indicate explicitly which events cause the Event-Based Random Number block to generate a new random number. Use this procedure:

  1. Insert an Event-Based Random Number block into your model and configure it to indicate the distribution and parameters you want to use.

  2. Insert a Signal Latch block and set Read from memory upon to Write to memory event. The block no longer has an rvc signal input port.

  3. Determine which events should result in the generation of a new random number, and set the Signal Latch block's Write to memory upon accordingly.

  4. Connect the signal whose events you identified in the previous step to the write-event port (wts, wvc, wtr, or wfcn) of the Signal Latch block. Connect the Event-Based Random Number block to the in port of the Signal Latch block.

The out port of the Signal Latch block is the desired random event-based signal.

Examples of Random Event-Based Signals

Here are some examples using the Event-Based Random Number block:

The model in Compound Switching Logic also illustrates how to use the Signal Latch block as described in Generate Random Signals Based on Arbitrary Events, to generate a random number upon each departure from an Input Switch block.

The models in Invalid Connection of Event-Based Random Number Generator illustrate how to follow the connection rules for the Event-Based Random Number block.

Create a Random Signal for Switching

The model below implements random output switching with a skewed distribution. The Signal Latch block causes the Event-Based Random Number block to generate a new random number upon each increase in the FIFO Queue block's #d output signal, that is, each time an entity advances from the queue to the server. The random number becomes the switching criterion for the Output Switch block that follows the server. The plot reflects the skewed probability defined in the Event-Based Random Number block, which strongly favors 1 instead of 2 or 3.

Was this topic helpful?