How does DT work?

Let's illustrate a few simple calculations so you can see how DT works in the calculation process. Consider the simple model, whose diagram is shown in Figure 12-1.

Figure 12-1

Simple Cash Model

In this model, Cash is initialized at $0. income is set at a constant of $100/month. Reproduced in Figure 12-2 is a Table of numerical values generated by the model. In the first run, DT is set at its default value of 0.25. In the second, DT is set at 1.0. In each case, numerical values are printed every DT, stocks are reported as beginning balances, flows are reported as summed, and From Time has been set to 0. Three months' worth of data appear in the Table.

Figure 12-2

Comparison of Cash Model Results with Differing Values for DT

DT = 0.25

DT = 1.0

Beginning balances reporting of

stocks, summed reporting of flows

In both runs, by Month 3, Cash totals $300. The only difference is the path followed in the two runs. In one case, $25 was added 12 times. In the other, $100 was added 3 times. In the first run, DT simply breaks the constant monthly flow of income into four equal chunks. Why would anyone want to do this?

As you'll soon see, there are a number of good reasons for breaking a time unit's worth of flow volume into smaller chunks. For now, a good first reason is that the division makes it possible to capture changes which occur over an interval of time less than the time unit you've picked for your model. When we picked a DT of 0.25, we would have been able to capture changes that occurred over an interval as short as 1/4 of a month (or roughly one week). So, DT represents the smallest time interval over which a change can occur.

DT thus determines how "chunkily" change will unfold in your model. A larger DT means chunkier changes in variables within your model. A smaller DT means smoother, more continuous changes. Imagine creating a cartoon animation by riffling through a deck of static pictures. If you have a large deck of pictures, in which the change is small from one picture to the next, the animation will unfold smoothly as you riffle through the deck. By contrast, if you have a deck with only a few pictures, in which each picture represents a fairly big change relative to its predecessor, riffling through the deck will produce a jerky animation. DT works the same way with the numerical values in your model.

To illustrate the notion of change occurring within a unit of time, let's modify our little Cash model to allow income to vary over a month. To implement variation, we'll convert income to a graphical function (using the discontinuous line segment option). The graphical function is reproduced in Figure 12-3. The input to the graphical function is Months (running from 0 to 1.0 in increments of 0.25). The output of the graphical function is income, which now declines over the month.

Figure 12-3

Income as a Time-Dependent Graphical Function

We'll make two runs of the modified model. In the first, DT will be set to 0.25. In the second, we'll set DT at 1.0. Both runs will be one month in duration. Before looking at the results, do you think the value of Cash will be the same at the end of the two runs? If not, in which run do you think Cash will achieve the greater value?

The results from the two runs are presented in Figure 12-4. Surprised?

Figure 12-4

Modified Cash Model: Comparison of Results with Differing DTs

DT = 0.25

DT = 1.0

Beginning balances reporting of

stocks, summed reporting of flows

With DT set at 0.25, the value of income varies from DT to DT. Four calculations are made, each yielding a different value for income (each value is simply the value of income taken from the graphical function, and then multiplied by DT). Cash climbs to $85 by the end of the run. With DT set at 1.0, only one calculation is made. And hence, only one value for income can be used. Given the way the graphical function works, that value is the value during Month 0. Cash thus grows to $100.

In summary, values of DT less than 1.0 enable your model to capture changes that occur within the course of a time unit. By adjusting DT, you can cause the changes in the variables in your model to unfold quite jerkily or very smoothly. The choice is up to you. The trade-off, for the most part, is speed against smoothness and numerical precision. As DT gets smaller, changes get smoother and results become more precise numerically. However, as DT gets smaller, more calculations will need to be made, and it will take longer to complete a run. As DT gets larger, results will be choppier and less precise numerically. But, a larger DT leads to fewer calculations and therefore faster simulation speed.

Some Practical Considerations

All of this said, under normal circumstances, there's a small range of values for DT which virtually always yields acceptable results (both smoothness and precision-wise), but which also does not cause your model to become unduly bogged down in calculations (with two exceptions which will be discussed below). This range is from 0.0625 to 1.0. DTs smaller than 0.0625 are rarely justified (though we'll indicate how it could be that even smaller values would be needed in the "1/2 test" below). The default value for DT (0.25) works very well in the majority of the models that we've seen or created. So, for the most part, you need not even worry about fiddling with DT.

However, if you do fiddle, we recommend you do so with numbers taken from the sequence (1/2)n. Because of the binary arithmetic that the computer uses, numbers not taken from this sequence can lead to nasty round-off errors. The (1/2)n sequence produces the following "nice" numbers: 1.0, 0.5, 0.25, 0.125, 0.0625 ...

2 Exceptions to the (1/2)n Sequence

As mentioned above, there are two exceptions to choosing DT from this "nice" set of values. The first happens when it is important to report values that do not fall on the (1/2)n of a time unit. A typical example is when your model runs in years, and you want to report monthly values. In cases such as this, simply choose the DT as fraction option in the Time Specs... dialog and enter the denominator desired for your DT.

The second exception to the DT settings recommended above occurs when the length of the simulation is very long in the denominated units of time, and change unfolds slowly relative to a time unit (e.g., the movement of a glacier over a few thousand years). In these cases, it is appropriate to choose a DT larger than 1.0. Any integer value up to one million is allowed by the software to define a DT larger than 1.0.

The 1/2 Test

A good first approximation for choosing DT is to choose a step size one-half of the shortest time delay in your model. Many time delays may be apparent, such as average days payable, a shipping lead time, a conveyor transit time, or a training delay. If you can determine the shortest time delay, you've got a good starting point for selecting the step size.

As a check on the value of DT that you've picked, it's always a good idea to execute the "1/2 test." Re-run your model with DT set equal to 1/2 of the value that was used to produce your results. Compare the results generated by the model to those generated before the value of DT was halved. Look at the results both in terms of numerical differences as well as any qualitative differences in the pattern of behavior that the model might be exhibiting. For example, has an oscillation disappeared? Is growth now occurring much more rapidly? Did the value of some stock which used to go negative cease going negative? If the answer to any of these type of questions is "Yes," you should take half the value of DT again and repeat the test. Continue in this fashion until your results remain essentially the same for two runs. Then, set DT equal to the highest of the last two values.

Brief Re-Cap

To re-cap, DT is the amount of time between calculations. No change in the numerical value of any element in your model can occur in a unit of time smaller than DT. For most models, a DT of 0.25 works well. With DT set at this value, the running of the model is not unduly slowed down (due to too many calculations), and yet numerical precision and smoothness in most cases are ensured.

See Also