Page 216 - ExtendSim User Guide
P. 216

190 Processing
Controlling the flow of items to an activity
Fixed Items model
To keep an activity running until it has processed a fixed number of items, add a Create block between the Decision and Gate blocks to the model discussed in “Conditional routing” on page 170. (The Conditional Routing model is located in the Examples\Discrete Event\Routing folder.) The resulting model is named Fixed Items, and is shown here.
Fixed Items model
In this model, the optional machine will be brought online if/when the queue exceeds five items. The Y output of the Decision block (Value library) is con- nected to the start connector of a Create block, which is set to Create items by schedule; the schedule is shown at right. The Decision block outputs a true value (1) at Y if the queue length is 5. When that happens, the Create block (Control the Gate) starts its schedule and puts out a single item with a quan- tity of 10 to the demand input on the Gate block. This causes the Gate to stay open until 10 items pass through the block.
There are two items of special note in this model: how the start and demand connectors are activated.
Activating “demand” with an item
• SincetheCreateblock’sstartconnectorisconnected,andsincetheblockisinCreate items by schedule mode, the block’s schedule runs in relative simulation time (begins its schedule relative to when start is activated), as explained in the section “The Start connec- tor” on page 124. Once start is activated (gets an value  0.5) it causes the entire schedule to happen; messages from the Decision block to the start connector are ignored until the sched- ule is complete. The second line of the schedule means that the Create block will also ignore any start messages for 5 time units after the schedule has been completed. This provides hys- teresis and allows the machine to process items (and hopefully reduce the buffer length) before the sequence is activated again. If the schedule did not include this pause, the Activity block could be activated constantly.
• Thedemandconnectorisactivatedwhenitgetsanitem,causingtheGatetoopenandallow items through. The number of items allowed through before the Gate closes is determined by
Discrete Event

   214   215   216   217   218