Page 337 - ExtendSim User Guide

P. 337

```
Tips and Techniques 311
Continuous blocks in discrete event models
displayed on the Display Value block should only be twice the value displayed in the Exit block; clearly this is not the case in this model.
Attributes Error model: Problem
The reason for the modeling problem shown above involves the message passing system in discrete event models. Individual items travel through the Get blocks sequentially. As an item passes through the first Get block, the block sends a message and the value of the attribute to the Math block (Value library). The Math block then recalculates and sends a message and the value to the Holding Tank block (Value library). When the item moves to the second Get block, it will send a message to the Math block again. This causes the Holding Tank block to get two messages and two values for each item that passes through the system. This kind of problem will occur in any discrete event system where there are multiple connections to a Holding Tank block (either directly, or indirectly as shown above) or if one Get block was used with two out- puts.
The Attributes Error model includes four examples: the problem and the three solutions dis- cussed below.
Solution #1: two Holding Tank blocks
One way to solve this problem is to accumulate the attributes’ values separately using two Holding Tank blocks. The contents of the Holding Tanks are then added together. This prevents the “double counting” of the previous example, because each Holding Tank block receives only one message and value per item that passes through the Get block it is attached to.
Solution #2: the Equation(I) block
Another solutions is to perform the calculation in the Equation(I) block (Item library). The Equation(I) sums up and accumulates the attributes in one step, so it avoids the double messaging problem altogether. The equation entered is:
Accumulate = Accumulate + a + b;
Result = Accumulate;
where accumulate is a static variable and a and b are the two attribute values from the item entering the Equation(I) block. The equation adds the two attribute values to the accumulated value, then sets the output to the accumulated value.
As an alternative, instead of both summing the attributes and accumulating, the Equation(I) could just sum the attributes and output that value to a connected Holding Tank.
Discrete Event
```