Page 347 - ExtendSim User Guide
P. 347

Tips and Techniques 321
Messaging in discrete event models
In the more complex messaging case
that is shown to the right, when an item
arrives at the first queue its length will
increase by 1. Since this changes the
block’s L (length) output connector,
Queue 1 sends a message to all inputs
connected to L (in this case the Math
block). When the Math block receives
this message, it sends a message to the
L connector at Queue 2, ensuring that
both inputs are up-to-date before any calculation is made. The values of the two length connec- tors are then added together and a third message is sent to the Display Value block, which then updates its animation and dialog.
Item connector messages
Item connector messages (primarily wants, needs, and rejects) propel items through the model. These messages use a conversation of messages to move items from one block to another. This mechanism allows for items to be both pushed and pulled from one block to the next. How these messages are handled depends on whether the block is a passing, residence, or decision block (see “Cycle timing” on page 312.)
Pushing items
In the case of pushing, the upstream block first sends a wants message.
• If the downstream block is a passing block, it forwards the message to the next downstream block through its output connector.
• Ifthedownstreamblockisaresidenceblock,itrespondswitheitheraneedsmessage(ifit can accept an item) or a rejects message (if it is unable to accept an item based on its status).
• If the downstream block is a decision block, it determines the status of the decision and any downstream blocks. It often does this by sending additional item or value messages and then responding with a needs or rejects.
Three messages sent
Create sends “wants” to downstream block
Passing Block
No Do I need an Need Item item?
Reject Item
Send wants to next downstream block
Flowchart for how items are pushed
Discrete Event

   345   346   347   348   349