Library

6.4.10 Mass-Balance Testing

In system dynamics modelling, the arithmetic treatment of key variables is as sequences of flows. These flows most frequently involve material or physical flows although they may include information. The intent of applying mass-balance tests is to ensure that the functions performed by inappropriately specified algebraic operators do not result in the inadvertent creation or destruction of flows. These tests are generally applied by focusing on the flows into and out of each stock (level or accumulator). A mass-balance test will also identify rounding errors created by use of functions such as FLOOR, CEIL, ROUND, INTEGER.

Checking Mass-balance—An Example

A fundamental check of the correct function of a module, and indeed every model, is that flows across the boundary drawn around the module do not result in net growth or net decline of the mass of the flows. Alternatively stated, flows must occur in such a way that does not permit material to be neither created nor destroyed within the module: whatever flows into a module must either flow out or accumulate within the module.

As each module is being constructed, it is essential to check the mass balance. The simplest scheme for doing this is depicted diagrammatically at Figure 6-5. (Also see Figure 5-6.)

Figure 6-5. Suggested Method for Checking Mass Balance

The general scheme for checking mass-balance is:

Delta Check = 'Initial Contents of Stock'

–STOCK

+ 'COUNT OF FLOWS IN'

–'COUNTOUTFLOW '

–'COUNT OUTFLOW 2'

Note: Delta Check must have a value of zero throughout the entire simulation and for each timestep. If it does not, there is a mass-balance error.