Main Content

Generate Entities When Events Occur

In addition to time-based entity generation, the Entity Generator block enables you to generate entities in response to events that occur during the simulation. In event-based generation, a new entity is generated whenever a message arrives at the input port of the Entity Generator block.

Event times and the time intervals between pairs of successive entities are not necessarily predictable in advance.

Generating entities when events occur is appropriate if you want the dynamics of your model to determine when to generate entities.

Generate Entity When First Entity is Destroyed

To generate an entity when the first entity is destroyed, use two Entity Generator blocks and a Simulink Function block. The Entity Terminator block calls the Simulink Function after destroying the first entity. For more information, see Generating and Initializing Entities.

Queuing model generating entities after the first entity is terminated

In this example, Entity Generator1 generates the first entity. SendMessage contains the genNext function, which sends a message.

Inside the Simulink function block. A Message Send block converts signals from a Constant block to messages.

The Entity Terminator block calls the genNext function.

Entity Terminator block window. genNext function is used as the entry action

Generate Event-Based Entities Using Data Sets

For an example that uses an Excel® spreadsheet, see Generating and Initializing Entities.

See Also

| | | | | | | | | | | |

Related Examples

More About