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.
In this example, Entity Generator1 generates
the first entity. SendMessage contains the genNext
function,
which sends a message.
The Entity Terminator block calls the genNext
function.
Generate Event-Based Entities Using Data Sets
For an example that uses an Excel® spreadsheet, see Generating and Initializing Entities.
See Also
Entity Generator | Entity Queue | Multicast Receive Queue | Entity Server | Entity Terminator | Discrete-Event Chart | MATLAB Discrete-Event System | Entity Replicator | Entity Input Switch | Entity Output Switch | Entity Multicast | Entity Gate | Composite Entity Splitter
Related Examples
- Specify Intergeneration Times for Entities
- Working with Entity Attributes and Entity Priorities
- Inspect Structures of Entities
- Generate Multiple Entities at Time Zero
- Count Simultaneous Departures from a Server
- Replicate Entities on Multiple Paths