Products & Services Solutions Academia Support User Community Company

Learn more about SimEvents   

Specifying Generation Times for Entities

Overview

If you have a list of unique 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

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 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 sequence. 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 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.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS