Page 727 - ExtendSim User Guide

P. 727

```
Math and Statistical Distributions 701
Equation-based blocks
☞ Equation-based blocks can calculate separate results and output them using any number of out- put variables.
The timing and control of equation calculations
The equation-based blocks evaluate their equations:
• Equation,EquationQuery.Inacontinuousmodel,ateverystep.Inadiscreteeventordis- crete rate model, when a message is sent to its value input or output connectors. The fre- quency of calculations can also be customized in the block’s Options tab.
• Equation(I),EquationQuery(I).Eachtimetheblockgetsanitematitsiteminputcon- nector.
• QueueEquation.Eachtimeanitemarrivesorleavesandwhenamessageissenttooneof the value input connectors.
The timing of equation calculations can have significant consequence in a simulation, affecting model behavior. To control when the equation is evaluated so that extraneous messages aren’t generated, see the Step Message block (Utilities library) or the Pulse block (Value library).
Equation block example
The topic “Simplifying the model” on page 70 demonstrates how one Equation block can replace four blocks that calculate and remove overflow from a Holding Tank block.
Original Reservoir model with overflow calculations (left) and using Equation block (right)
Equation Editor
As discussed earlier, all of the equation-based blocks have a scrollable area for entering equa- tions. Other than the Optimizer (Value library) and Buttons (Utilities library) blocks, the equa- tion-based blocks also have a separate Equation Editor window for viewing and editing the equation.
Although the equation could be edited within the block’s dialog, there are advantages to edit- ing the equation in the Equation Editor window:
• The Equation Editor window can be resized to fit larger equations • Tabscanbeusedforindenting
• Code colorization is allowed, so code is more understandable
How To
```