| SimEvents® | ![]() |
Generators / Entity Generators
This block is designed to generate entities when events of a specified type occur.
| When to Generate Entities | Generate entities upon Value |
|---|---|
| Each time the application recomputes and outputs the value of a signal | Sample time hit from port ts |
| Each time an input signal has a trigger edge | Trigger from port tr |
| Each time an input signal changes its value | Change in signal from port vc |
| Each time an input signal generates a function call | Function call from port fcn |
Note An exceptional case is when the block temporarily suspends its normal entity-generation behavior. See the description of the Delay first pending entity option in Responding to Blockage at the Entity Output Port. |
Using the Allow OUT port blocking and optional Response during blockage period parameters, you can choose how this block responds when the subsequent entity input port is not available to accept the newly generated entity. The possible responses are in the table below.
| Response to Blockage | Parameter Values |
|---|---|
| Error message | Clear the Allow OUT port blocking check box. |
| The block discards all entities generated while the OUT port is blocked. Such entities do not depart from the block. | Select Allow OUT port blocking and set Response during blockage period to Discard generated entities |
| The block holds one generated entity and temporarily suspends the generation of additional entities. When the subsequent entity input port becomes available, this block outputs the held entity and resumes normal operation. | Select Allow OUT port blocking and set Response during blockage period to Delay first pending entity |
Signal Input Ports
| Label | Description |
|---|---|
| ts | Signal whose updates indicate when to generate entities. This port appears only if you set Generate entities upon to Sample time hit from port ts. |
| tr | Trigger signal whose edges indicate when to generate entities. This port appears only if you set Generate entities upon to Trigger from port tr. |
| vc | Signal whose numerical changes in value indicate when to generate entities. This port appears only if you set Generate entities upon to Change in signal from port vc. |
| fcn | Function-call signal that indicates when to generate entities. This port appears only if you set Generate entities upon to Function call from port fcn. |
Entity Output Ports
| Label | Description |
|---|---|
| OUT | Port through which generated entities depart. |
Signal Output Ports
| Label | Description | Time of Update When Statistic Is On | Order of Update |
|---|---|---|---|
| #d | Number of entities that have departed from this block since the start of the simulation. | After entity departure | 3 |
| pe | A value of 1 indicates when the block tries and fails to output an entity. | After entity generation if OUT port is blocked, and when entity departure is imminent in all cases | 1 |
| w | Average intergeneration time, in seconds, for all pairs of successive entities that have departed from this block. The signal value is 0 before the second entity departure. | After entity departure | 2 |
The initial output value, which is in effect from the start of the simulation until the first update by the block, is 0 for all signals.

The blank type includes no attributes. The standard type includes attributes called Priority and Count with default values of 10 and 0, respectively.
If you do not select this option, the simulation halts with an error message if the subsequent entity input port is not available to accept an entity when this block generates it.
Determines how the block responds if a generated entity cannot depart immediately because the entity input port of the subsequent block is unavailable; see Responding to Blockage at the Entity Output Port. This field appears only if you select Allow OUT port blocking.

The type of event that indicates when the block should generate an entity.
Determines whether rising, falling, or either type of trigger edge causes an entity generation. This field appears only if you set Generate entities upon to Trigger from port tr.
Determines whether rising, falling, or either type of value change causes an entity generation. This field appears only if you set Generate entities upon to Change in signal from port vc.
Select this option to explicitly prioritize the entity-generation event, relative to other simultaneous events in the simulation. If you do not select this option, the event has priority SYS1 on the event calendar. For details, see Choosing How to Resolve Simultaneous Signal Updates.
The priority of the entity-generation event, relative to other simultaneous events in the simulation. For details, see Specifying Event Priorities to Resolve Simultaneous Signal Updates. This field appears only if you select Resolve simultaneous signal updates according to event priority.
If you select this option, the block generates the first entity when the simulation begins. Otherwise, the block generates the first entity upon the first update of the ts signal at a nonzero value of time. This field appears only if you set Generate entities to Sample time hit from port ts.
If you select this option, the block responds to function calls at the starting time of the simulation. Otherwise, the block responds only to function calls at subsequent times. This field appears only if you set Generate entities upon to Function call from port fcn.
These parameters determine whether certain ports produce data throughout the simulation, produce data only when you stop or pause the simulation, or are omitted from the block. For descriptions of the affected ports, see the "Signal Output Ports" table above.

Controls the presence and behavior of the signal output port labeled #d.
Controls the presence and behavior of the signal output port labeled pe.
Controls the presence and behavior of the signal output port labeled w.
Time-Based Entity Generator, Entity Sink
Generating Entities When Events Occur
![]() | Entity-Based Function-Call Event Generator | Event-Based Random Number | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |