Page 485 - ExtendSim User Guide
P. 485

Advanced Topics 459
Messaging in discrete rate models
tial upstream rate is calculated as 1000 gallons/minute for Supply B1 and 1000 gallons/ minute for Supply B2. Therefore, Sensing 1 decides to get 50% of the flow from inflow branch B1 and the other 50% of the flow from branch B2.
• BecausethedecisionhasbeenmadeforbranchesB1andB2,Prioritize2withitslowerbias order can no longer control the distribution of flow between branches B1 and B2.
Messaging in discrete rate models
As discussed in “How ExtendSim passes messages in models” on page 612, the ExtendSim architecture allows application messages to be sent from ExtendSim to a model’s blocks and block messages to be passed between blocks.
Discrete rate models use the same application messages as do continuous and discrete event models. The block messages sent between Rate library blocks are discussed below.
Block messages
Discrete rate blocks have a sophisticated and complex messaging structure for communicating with each other and with blocks from the Value and Item libraries. They can be categorized as:
• Event
• Value connector
• Itemconnector
• Flow connector
• Rate block flow
• Executiveblockflow
When a block initiates a recalculation of the set of effective rates, a succession of messages and calculations are also initiated. Understanding how block messages work can prevent redundant messages from being created. At the very least redundant messages will cause run- times to be longer than need be. At the very worst, redundant rate calculations could introduce bugs into a model when effective rates are temporarily calculated using one or more out-of- date parameter values. For instance, see “Limiting the number of recalculations” on page 397.
☞ By limiting the number of times the set of rates have to be recalculated, the operational effi- ciency of the model is maximized. For example, see “Limiting the number of recalculations” on page 397.
Event messages
Event messages communicate between the Executive block and Rate library blocks. In a dis- crete rate model, the simulation clock advances from one event to another. Each time the clock advances, the Executive block sends event messages to the blocks that have associated them- selves with that event. There are two types of events: future and current.
• Afutureeventmessageoccurswhenthesimulationclockreachesatimepostedbyablock. For instance, when the level in a Tank increases, it posts a future event to the Executive cor- responding to the Tank’s “full time”. Once the simulation clock has advanced to this future event, the Executive sends an event message to the Tank, alerting it that it is full.
• Acurrenteventmessageoccurswhenablockwantstobeactivatedbeforethesimulation clock advances, but after it has completed its response to another message. For instance, instead of a Valve immediately calculating a new effective rate when its constraining rate changes, it will post a current event to the Executive letting it know that it will have to recal-
Discrete Rate

   483   484   485   486   487