Home > Modeling Tips > What is Delta Time (DT)?

What is Delta Time (DT)?

After reading Karim Chichakly’s recent post on Integration Methods and DT, I was reminded that delta time (DT) has always been a tricky modeling concept for me to grasp.   Beginning modelers don’t usually need to think about changing DT since STELLA and iThink set it to a useful default value of 0.25.   But once you progress with your modeling skills, you might consider the advantages and risks of playing with DT.

The DT setting is found in the Run Specs menu.

By definition, system dynamics models run over time and DT controls how frequently calculations are applied each unit of time.  Think of it this way, if your model was a movie, then DT would indicate the time interval between still frames in the strip of movie film.  For a simulation over a period of 12 hours, a DT of 1/4 (0.25) would give you a single frame every 15 minutes.  Lowering the DT to 1/60 would give a frame every minute.   The smaller the DT is, the higher the calculation frequency (1/DT).

Beware of the Extremes

A common tendency for modelers is to set the calculation frequency too high.  Without really thinking too hard about it, more data seems to imply a higher quality model – just like more frames in movie film make for smoother motion.  If your model calculates more data for every time unit, its behavior will begin to resemble the behavior of a smoothly continuous system.  But a higher frequency of calculations can greatly slow down your model’s run performance and more data does not directly translate to a better simulation.

Beware of Discrete Event Models

Another situation where DT can often lead to unexpected behavior is with models that depend on discrete events.   My eyes were opened to this when I attended one of isee’s workshops taught by Corey Peck and Steve Peterson of Lexidyne LLC.

One of the workshop exercises involved a simple model where the DT is set to the default 0.25, the inflow is set to a constant 10, and the outflow is set to flush out the stock’s contents as soon as it reaches 50.   This is how the model’s structure and equations looked:

Discrete Model

Stock = 0

inflow = 10

outflow = IF Stock >= 50 THEN 50 ELSE 0

I would have expected the value of the stock to plunge to zero after it reached or exceeded 50, but this graph shows the resulting odd saw-tooth pattern.

Sawtooth Model Behavior

The model ends up behaving like a skipping scratched record, in a perpetual state of never progressing far enough to reach the goal of zero.  (Click here to download the model.)

What is happening in the model?  In the first DT after the stock’s value reaches exactly 50, the outflow sets itself to 50 in order to remove the contents from the stock. So far so good, but now the DT gotcha begins to occur.   Since the outflow works over time, its value is always per time.  To get the quantity of material that actually flowed, you must multiply the outflow value (or rate) by how long the material was flowing.  When DT is set to 0.25,  the material flows 0.25 time units each DT.  Hence, the quantity of material removed from the stock is 50*0.25 = 12.50.

Suddenly we are in a situation where only 12.50 has been removed from the stock but the stock’s value is now less than 50.  Since the stock is no longer greater than or equal to 50, the outflow sets itself back to 0 and never actually flushes out the full contents of the stock. 

So what do we do?  One solution to this problem would be to use the PULSE built-in to remove the full value from the stock.   Here’s what the equation for the outflow would look like:

outflow = IF Stock >= 50 THEN PULSE(Stock) ELSE 0

(Note: This option will only work using Euler’s integration method.)

Further Reading

STELLA and iThink have great help documentation on DT.  The general introduction provides a good explanation of how DT works. The more advanced DT Situations Requiring Special Care section focuses more on artifactual delays and the discrete model issues mentioned in this post.  Delta time and resulting model behaviors are reminders that system dynamics models run over time, but they achieve this by applying numerous discrete calculations in order to simulate the smooth behavior of actual systems.

If you enjoyed this post, make sure you subscribe to my RSS feed!
Categories: Modeling Tips Tags: ,
  • william tsui

    hi:-
    I have tried to run your suggested model, but the data set turn out as follow and not the one you posted. I wonder if anything wrong in the version or design.

    time stock/outflow/inflow
    Initial 0.00
    0: .25 2.50 0.00 10.00
    0: .50 5.00 0.00 10.00
    0: .75 7.50 0.00 10.00
    0: end 10.00 0.00 10.00
    1: .25 12.50 0.00 10.00
    1: .50 15.00 0.00 10.00
    1: .75 17.50 0.00 10.00
    1: end 20.00 0.00 10.00
    2: .25 22.50 0.00 10.00
    2: .50 25.00 0.00 10.00
    2: .75 27.50 0.00 10.00
    2: end 30.00 0.00 10.00
    3: .25 32.50 0.00 10.00
    3: .50 35.00 0.00 10.00
    3: .75 37.50 0.00 10.00
    3: end 40.00 0.00 10.00
    4: .25 42.50 0.00 10.00
    4: .50 45.00 0.00 10.00
    4: .75 47.50 0.00 10.00
    4: end 50.00 0.00 10.00
    5: .25 40.00 50.00 10.00
    5: .50 42.50 0.00 10.00
    5: .75 45.00 0.00 10.00
    5: end 47.50 0.00 10.00
    6: .25 50.00 0.00 10.00
    6: .50 40.00 50.00 10.00
    6: .75 42.50 0.00 10.00
    6: end 45.00 0.00 10.00
    7: .25 47.50 0.00 10.00
    7: .50 50.00 0.00 10.00
    7: .75 40.00 50.00 10.00
    7: end 42.50 0.00 10.00
    8: .25 45.00 0.00 10.00
    8: .50 47.50 0.00 10.00
    8: .75 50.00 0.00 10.00
    8: end 40.00 50.00 10.00
    9: .25 42.50 0.00 10.00
    9: .50 45.00 0.00 10.00
    9: .75 47.50 0.00 10.00
    9: end 50.00 0.00 10.00
    10: .25 40.00 50.00 10.00
    10: .50 42.50 0.00 10.00
    10: .75 45.00 0.00 10.00
    10: end 47.50 0.00 10.00
    11: .25 50.00 0.00 10.00
    11: .50 40.00 50.00 10.00
    11: .75 42.50 0.00 10.00
    11: end 45.00 0.00 10.00

    william tsui (Hongkong)

  • Joanne Egner

    William,
    I edited the post to include a download link for the model. Hope this helps.
    Joanne

    • william tsui

      Joanne:-

      thank for your reply.
      I found that I simply change the formula as
      outflow = IF Stock >= 50 THEN 50/DT ELSE 0
      may solve the said problem.

      Am I right ?

      william tsui

      • Joanne Egner

        That works too! Thanks for the suggestion.
        Joanne

  • Eric Bruening

    Thank you for these helpful articles on DT. Speaking as a business user where “time” means something specific – it would be a benefit if DT could be relative to the Time step selected. Ex. I am running a model in months, however I might want to observe or report some behaviors at “weeks” – but using the DT = 0.25 implies 4 intervals per month, which is not really a Week. Also in a retail environment, the calendar is often broken into 13-week quarters where a pattern of 4-4-5 weeks per month is assumed for Jan-Feb-Mar; Apr-May-Jun; Jul-Aug-Sept; Oct-Nov-Dec. Since I am not fully proficient on the details of the underlaying mathematics, what keeps you from adopting a DT selection that “keeps” the time elements directly related to “clock and calendar”? Thanks!

    • kchichakly

      Hi Eric,
      DT is not really about breaking your time unit into chunks that are meaningful to the problem domain. The setting of DT, which is theoretically infinitely small, should be determined by the requirements of the calculations as I described in my post, i.e., no larger than one half of your shortest time constant. If you are interested in details at the week level, you should set your time unit to weeks, not months, and make DT 0.5 or smaller. Why? Because if you are interested in what's happening at the week level, your smallest time constant must be at most one week, forcing DT to be no larger than half a week. [Again, one half your smallest time constant is the theoretical value; you will likely have to make it one quarter to get the correct behavior.]
      –Karim

  • Rosenm

    Hello colleagues! I think we already have enough information how to choose DT when the process is continuous. But what about discrete processes – how to choose proper value of DT? If I have simple M/M/1 queuing system and arrival rate is 2.5h^-1, service rate is 3h^-1, how to choose proper value of DT? Thanks in advance for the answers.

    • I finally got you some information on this subject, thanks to isee’s Karim Chichakly.

      This link is helpful: http://www.eventhelix.com/RealtimeMantra/CongestionControl/queueing_theory.htm

      However, that still leaves the question of h (where is time?). Without knowing what you exactly mean by h, though, we can still answer the question somewhat: DT must be no larger than the “GCD” of all delays (arrival/server times) in the system. I put “GCD” in quotes because it isn’t really the GCD, but it is conceptually the same as the GCD.

      For example, if I have two ovens with cook times of 2.5 and 3, I need a DT that is a common “factor” of both 2.5 and 3, which would be 0.5

      If these are means of a distribution, DT would have to be small enough to represent the smallest increment you desire in that distribution. So if they both have a standard deviation of 0.5, DT should be much smaller than 0.5. For example, setting it to 0.0625 (1/16) will only give you 8 distinct values (0.5/0.0625 = 16/2) in each standard deviation. This may be enough for your application, or you may need to make it smaller.

      • Rosenm

        Тhanks for your attention and for the answer, it is satisfactory for me and i completely agree with you. These values are means of Poisson (Exponential) distribution. h means hours and h^-1 means (in my case) pieces per hour. The time between arrivals is 1/2.5=0.4 hours, the time between services is 1/3=0.33333….. hours. If i accept that 1/3=0.33, than DT must be 0.01 (1/100). According to my experinece, STELLA can perform only 32700 time steps (am i right?), thats why the maximum length of simulation will be 327 hours. According to your advice (to account for distribution), i have to decrease DT, for example, 10 times (1/1000), than maximum length of the simulation will be approximately 32 hours. It is not enough for me. What can i do?

        • Have you tried to start building this model, or a test version of it to confirm this?

          If you absolutely need that amount of data, you can get over the time step limit by running a model multiple times. Here is a post from our blog with a simple sample model, using the command line to automate the process.
          http://bit.ly/2b88GM

  • Gaboguillot

    hi: most useful your explanation about DT. I wonder if you could help me in modeling a binomial distribution becuase in the builtins there are only Poisson an normal distributions .
    Thanks in advance for the answers
    Gabriel Guillot (bogota, colombia)

  • Richard Turnock

    DT does not have any units. DT is not time. Modelers should not be using IF-THEN-ELSE or any other modeling trick to compensate for using the wrong DT. There are ways to tell if the DT is too big or too small. Find someone who knows how to explain DT properly.

  • Alejandro

    Hello, I congratulate you for the article, I wonder if it is possible to transform a model that is by definition DT 0.0625 to DT 1 to do is to connect two models using a different DT. PD: Excuse my English I’m still learning and I’m writing with the help of a translator.

    • Alejandro,

      It is possible to switch your model to a DT of 1, but this can be dangerous.  A DT of 1 is can be too large, and depending what kind of model it is, this can cause unwanted behavior, such as artifactual delays (see this help article http://www.iseesystems.com/Helpv9/Content/DT/DT_Special_Care.htm) .  I would recommend trying to find a workable common DT that is closer to 0.25 between the two models you are trying to connect.  

      I hope my answer can be clearly translated for you.  If you would like more information, please email support@iseesystems.com.

      • Alejandro

        Thank you very much understand it without the translator