Specify Generation Times for Entities

Overview

If you have a list of times, you can configure the Time-Based Entity Generator block to generate entities at these times. Explicit entity-generation times are useful if you want to

  • Recreate an earlier simulation whose intergeneration times you saved using a Discrete Event Signal to Workspace block.

  • Study the behavior of your model under unusual circumstances and have created a series of entity generation times that you expect to produce unusual circumstances.

  • Verify simulation behavior that you or someone else observed elsewhere, such as a result reported in a paper.

Procedure for Generating Entities at Specified Times

To generate entities at specified times, follow this procedure:

  1. In the Time-Based Entity Generator block, set the Generate entities with parameter to Intergeneration time from port t. A signal input port labeled t appears on the block.

  2. Depending on whether or not you want to generate an entity at T=0, either select or clear the Generate entity at simulation start option.

  3. Create a column vector, gentimes, that lists 0 followed by the nonzero times at which you want to create entities, in strictly ascending order. You can create this vector using one of these techniques:

    • Enter the definition in the MATLAB® Command Window

    • Load a MAT-file that you previously created

    • Manipulate a variable that a To Workspace block or Discrete Event Signal to Workspace block previously created

    An example of a column vector listing generation times is:

    gentimes = [0; 0.9; 1.7; 3.8; 3.9; 6];
  4. Apply the diff function to the vector of generation times, thus creating a vector of intergeneration times.

    intergentimes = diff(gentimes);
  5. Insert an Event-Based Sequence block in the model and connect it to the t input port of the Time-Based Entity Generator block.

  6. In the Event-Based Sequence block, set Vector of output values to intergentimes. Set the Form output after final data value by parameter to Setting to infinity. The Setting to infinity option halts the generation process if the simulation time exceeds your maximum generation time.

Was this topic helpful?