Documentation

Generating and Initializing Entities

Description

This example shows different ways to generate and initialize entities and their attribute values.

Periodic Entity Generation and Initialize with MATLAB Code

Generate entities periodically by setting a constant value of intergeneration time in the Entity Generator. You can then initialize these entities in the Entity Generator using MATLAB code as shown below.

Randomized Entity Generation and Initialize with Simulink Functions

Generate entities using intergeneration time sampled from a random distribution by writing a custom intergeneration time action in the Entity Generator block, as shown below.

In this example, initialize the generated entities by calling into a Simulink Function that returns initial values for attributes as shown below.

Burst Entity Generation - Generating Multiple Entities Simultaneously

This example shows how you can generate multiple entities simultaneously at the start of simulation to preload a queue. To generate N entities, the intergeneration time for these entities must be 0 (zero). To stop generation after N entities, set the intergeneration time to infinity (inf).

Event-Based Entity Generation

This example shows how you can generate entities when certain events occur in the model. Each such event can be translated into a message arrival at the event input port of the Entity Generator.

Inter-Arrival Times from Sequence and Initialize from Spreadsheet

This example shows how you can generate entities where the intergeneration times are specified from a sequence or an array. Use a Repeating Sequence Stair block inside the Simulink Function

Simulink function: getNextFromSequence

Initialize the generated entities using data from a spreasheet by importing the data to a MATLAB table object. Individual columns of this table can then be read by the Repeating Sequence Stair block in the Simulink Function initFromSpreadsheet.

Was this topic helpful?