Event-Based Entity Generator - Generate entity upon signal-based event or function call

Library

Generators / Entity Generators

Description

This block is designed to generate entities when events of a specified type occur.

When to Generate EntitiesGenerate entities upon Value
Each time the application recomputes and outputs the value of a signalSample time hit from port ts
Each time an input signal has a trigger edgeTrigger from port tr
Each time an input signal changes its valueChange in signal from port vc
Each time an input signal generates a function callFunction call from port fcn

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 BlockageParameter Values
Error messageClear 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

Ports

Signal Input Ports

LabelDescription
tsSignal whose updates indicate when to generate entities. This port appears only if you set Generate entities upon to Sample time hit from port ts.
trTrigger signal whose edges indicate when to generate entities. This port appears only if you set Generate entities upon to Trigger from port tr.
vcSignal 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.
fcnFunction-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

LabelDescription
OUTPort through which generated entities depart.

Signal Output Ports

LabelDescriptionTime of Update When Statistic Is OnOrder of Update
#dNumber of entities that have departed from this block since the start of the simulation.After entity departure3
peA 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 cases1
wAverage 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 departure2

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.

Dialog Box

Entity type

The blank type includes no attributes. The standard type includes attributes called Priority and Count with default values of 10 and 0, respectively.

Allow OUT port blocking

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.

Response during blockage period

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.

Entity Generation Tab

Generate entities upon

The type of event that indicates when the block should generate an entity.

Trigger type

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.

Type of change in signal value

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.

Resolve simultaneous signal updates according to event priority

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.

Event priority

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.

Generate entity at simulation start

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.

Allow entity generation at simulation start

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.

Statistics Tab

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.

Number of entities departed

Controls the presence and behavior of the signal output port labeled #d.

Status of pending entity departure

Controls the presence and behavior of the signal output port labeled pe.

Average intergeneration time

Controls the presence and behavior of the signal output port labeled w.

Examples

See Also

Time-Based Entity Generator, Entity Sink

Generating Entities When Events Occur

  


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