Products & Services Solutions Academia Support User Community Company

Learn more about SimEvents   

Generating Function-Call Events

Role of Explicitly Generated Events

You can generate an event and use it to

For most purposes, a function call is an appropriate type of event to generate.

Generating Events When Other Events Occur

The table below indicates which blocks generate function calls when other events occur.

Event Upon Which to Generate Another EventBlock
Entity advancementEntity-Based Function-Call Event Generator
Signal-based eventSignal-Based Function-Call Event Generator
Function callSignal-Based Function-Call Event Generator

Example: Calling a Stateflow Block Upon Changes in Server Contents

The fragment below, which is part of an example in Using Stateflow Charts to Implement a Failure State, uses entities to represent failures and repairs of a server elsewhere in the model:

One reason to use function calls rather than triggers to call a Stateflow block in discrete-event simulations is that an event-based signal can experience a trigger edge due to a zero-duration value that a time-based block would not recognize. The Signal-Based Function-Call Event Generator can detect signal-based events that involve zero-duration values.

Generating Events Using Intergeneration Times

To generate events using intergeneration times from a signal or a statistical distribution, use this procedure:

  1. Use the signal or statistical distribution with the Time-Based Entity Generator block to generate entities.

  2. Use the Entity-Based Function-Call Event Generator block to generate an event associated with each entity.

  3. Terminate the entity path with an Entity Sink block.

In the special case when the intergeneration time is constant, a simpler alternative is to use the Function-Call Generator block in the Simulink Ports & Subsystems library.

Example: Opening a Gate Upon Random Events

The example below (open model) uses the top entity generator to generate entities whose sole purpose is to cause the generation of events with intergeneration times from a statistical distribution. The bottom entity generator generates entities that enter a gated queuing system.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS