Main Content

Generate Multiple Entities at Time Zero

In a discrete-event simulation, an event is an observation of an instantaneous incident that may change a state variable, an output, and/or the occurrence of other events.

Suppose that you want to:

  • Preload a queue or server with entities at the start of the simulation, before you analyze queueing or processing delays.

  • Initialize the capacity of a shared resource before you analyze resource allocation behavior.

These scenarios require multiple entity generation at the simulation start.

In these scenarios, you can simultaneously generate multiple entities at the start of the simulation. You can then observe the behavior of only those entities for the remainder of the simulation.

Build the model

To generate multiple entities at time 0, use MATLAB® code in the Entity Generator block.

Model with an Entity Generator block, an Entity Terminator block, and a Dashboard Scope block.

To open the example model without performing the configuration steps, see A Simple Example of Generating Multiple Entities.

  1. In a new model, from the SimEvents® library, drag the Entity Generator, Entity Terminator, and Dashboard Scope blocks.

  2. Double-click the Entity Generator block.

  3. From the Time source drop-down list, select MATLAB action.

  4. In the Intergeneration time action field, use MATLAB code to enter the number of entities that you want to generate. For example, you could use 8. In that case, at simulation time 0, the Entity Generator block generates 8 simultaneous events.

    Entity Generator block window. MATLAB code in the Intergeneration time action field generates eight entities.

  5. In the Events action tab, randomize the entity attribute. Select the Generate event action and, in the Generate action field, enter the MATLAB code:

    entity.Attribute1=rand();

The output of the Dashboard Scope block shows that the software generates multiple entities at time 0.

Dashboard Scope block showing eight entities generated at the start of the simulation.

See Also

| | |

Related Examples

More About