Page 423 - ExtendSim User Guide
P. 423

Merging, Diverging, and Routing Flow 397
Features of the Merge and Diverge blocks
given throw/catch abilities as well. See “Throwing flow and catching flow remotely” on page 398 for a full discussion.
Changing decision rules dynamically
With the exception of the Batch/Unbatch and Neutral modes, decision rule parameters for the Merge/Diverge modes can be changed dynamically during the run. However, this is an advanced feature that requires some caution and extra insight into how ExtendSim works.
There are two ways to dynamically change a decision rule for a Merge/Diverge mode:
• Allow the rules to be
controlled by other
blocks. To do this,
check the appropriate
checkbox (such as Pri-
orities defined using
value connectors, as
shown to the right) on the Merge or Diverge block’s Options tab. When this checkbox is selected, a set of value input connectors appear on the block’s icon, with one connector for each branch.
• LinktheparametertabletoanExtendSimdatabasetableorglobalarray.Anychangesmade to the table or array while the model runs will have the same effect as using a block to dynamically change the values.
Limiting the number of recalculations
While this advanced feature is useful for changing how effective rates are calculated on the fly, there are potential pitfalls. Since computations typically happen sequentially on a computer, new parameter values for each branch are changed one at a time. Ideally, the Merge/Diverge block will not recalculate the new set of effective rates for each branch until after all parame- ters have been updated. If this is not the case, however, the block will be forced to unnecessar- ily calculate an entirely new set of effective rates every time a parameter is updated. At the very least this will cause your runtimes to be longer than need be. At the very worst, redundant rate calculations could introduce bugs into your model when effective rates are temporarily calculated using one or more out-of-date parameter values.
There are three approaches that will help avoid this problem:
1) TheissuecanbebypassediftheinputsononeMerge/Divergeblockarecontrolledbythe outputs from one equation-based block, such as the Equation block (Value library). This is because the equation block will update all its outputs with the new results prior to alerting the Merge/Diverge block to the change. For an example of this, see the model “Change Pri- orities with Equation”.
2) BycheckingUpdateonlywhenaTruevalueisreceivedattheGOconnectorinthe block’s Options tab. This allows the calculation of a new set of effective rates to be con- trolled explicitly. In this case, changes to the parameters are ignored until a message is received at the GO input connector. This is shown in the example model “Change Propor- tions with Trigger” which requests a new set of proportions at the beginning of each goal. (A goal represents the production of 1000 units of flow and is repeated over and over until the end of the simulation.) The values at the inputs change every 10 time units, but because
Modifying decision rules dynamically (Priority mode)
Discrete Rate

   421   422   423   424   425