Time-Based Function-Call Generator

Generate function-call events in a time-based manner.

Library

Generators/Function-Call Generators

Description

This block generates function-call events, either once at the start of simulation, using an intergeneration period that you specify in the block dialog box, or using a signal connected to the input port. The intergeneration period is the time interval between two successive generation events.

You can set the Event generation mode parameter of the block to one of three values. The block determines the intergeneration period differently for each value of the Event generation mode parameter that you choose.

Value of Event generation mode Parameter Intergeneration Period
Only at simulation startNone, because only one event is generated
Period from dialogSpecified in the Period parameter of the block dialog box
Period from portSpecified using an input signal t that the block reads at the start of the simulation and each time it generates an entity

If you select the configuration parameter Prevent duplicate events on multiport blocks and branched signals in your model, the Time-Based Function-Call Generator block is compatible with all other blocks from SimEvents® version 4.0 (R2011b), or later.

For more information about:

Ports

Signal Input Ports

LabelDescription
tTime interval between generation of the current function-call event and the next function-call event. You see this port only if you set the Event generation mode parameter to Period from port in the block dialog box. At the start of the simulation and each time the block updates its output signals, the block reads the value at the input port, or if the preceding block is an Event-Based Random Number or Event-Based Sequence block, actively requests an updated input value. The signal connected to the input port must be an event-based signal.

Signal Output Ports

LabelDescription
fPort through which generated function-call signals depart.
#fNumber of function-call events that have been executed by the block. You only see this port if you select the Report number of events executed, #f check box in the block dialog box.

The initial output value — in effect from the start of the simulation until the first update by the block— is 0, for all signals.

Dialog Box

Event generation mode

Determines the mode that the block uses to generate function-call events.

Period

The time interval between generation of successive function-call events, in seconds. You see this field only if you set the Event generation mode parameter to Period from dialog in the block dialog box.

Number of simultaneous event repetitions per period

The number of simultaneous function-call events that the block generates in each period. Use this parameter to generate a function-call with multiple iterations.

Report number of events executed, #f

Determines if the number of function-call events that have executed by the block is made available via a signal output port on the block.

Event priority

The priority of the function-call event relative to other simultaneous events in the simulation.

Examples

Seed Event Generation

To generate a seed event in your model at simulation time T= 0, you can use the Time-Based Function-Call Generator block. A seed event is an initial impulse that models with certain block configurations require to update the outputs of their blocks and to start generating events.

In this example, the Event generation mode parameter of the Time-Based Function-Call Generator block is set to Only at simulation start. At simulation time T= 0, the Time-Based Function-Call Generator block produces an initial function-call event — or seed event — to the Signal-Based Function-Call Generator block. This seed event causes the Signal-Based Function-Call Generator block to update its outputs. After simulation time T= 0, the simulation continues to update the outputs of the Signal-Based Function-Call Generator block. The model is now self-sustaining.

Time Synchronization

When you want to synchronize events with a time-based process outside the SimEvents domain, use the Time-Based Function-Call Generator block.

In this model, the Event generation mode parameter of the Time-Based Function-Call Generator block is set to Period from port. The Probe block detects the sample time of a sine wave signal and connects it to the input port t of the Time-Based Function-Call Generator block. The value at the input port t determines the period — or time delay — between successive function-call events generated by the block and is used to control entity advancement through the Release Gate block.

Discrete-Event Model with Statistical Distribution

You can use the Time-Based Function-Call Generator block to model a discrete-event system that is driven by a time-based process drawn from a statistical distribution.

In this model, using a statistical distribution, the Event-Based Random Number block generates random values. The Time-Based Generator block periodically produces a function-call event to store the current output value of the Event-Based Random Number block in the Signal Latch block. This value is used, in turn, to select the output port of the Output Switch block. Based on the statistical distribution specified in this model, the value that is output by the Signal Latch block has a 99% probability of being 1. When this situation is the case, the first output port of the Output Switch block is selected, and an entity advances as a received packet. Conversely, 1% of entities advance as dropped packets.

Was this topic helpful?