Choosing the "right" time step
Posted: Wed Aug 15, 2007 2:48 am
Hi all
I have a simple (famous last words) question but first a digression to explain how I came to it.
I came across a paper by Sterman entitled "Reflections on becoming a systems scientist" which I found very interesting. I haven't managed to track down a copy of his book yet, but in this paper he refers to a bathtub model, which I decided to make a vensim model of. (the paper is available online http://web.mit.edu/jsterman/www/All_Mod ... _(SDR).pdf
This model is not difficult to develop. (For the record the model I made consisted of a stock for the bathtub water volume, a constant outflow, a lookup graph for the outflow over time, a <time> shadow variable, and the reference to these in the inflow.)
However I noticed a rather curious result when I run it. I initially had the time period defined as minutes and the time step as 1 and I noticed that the resulting sine curve of water volume in the bathtub is shifted up from what I would expect. It oscillates between 75 litres and 175 litres implying the average bathtub level is 125 litres.
This is fine, except it seems that over those 16 minutes the same quantity of water both entered and left the model so one would assume the average should be the starting volume of 100 litres.
I thought about this and tried calculating the values manually (which agreed with the model). It occurred to me that if I decreased the size of the time step I may change the results.
Sure enough reducing the time step to 1/4 minutes brought the sine curve down quite a bit to oscillating between 56.25 and 156.25, or an average of ~103 litres. Identical model except the frequency of calculation and yet quite a different result. In fact it seemed as the time step tends towards zero the model tends towards the anticipated result.
Now with some further thought I can see exactly why this occurs. However it raises a rather big problem in my eyes if even such a simple model is subject to such inaccuracies entirely due to the structure of the model?
So, apologies for the long digression, but my actual question is how can SD modellers manage the issue of varying time steps influencing results in larger and more complex models? It seems to me in a complex model this problem could go completely unnoticed, and given small changes in models can have rather large impacts on outcomes, it is surely a rather big issue?
Any thoughts, strategies to deal with this or obvious things I have missed that mean it isn't a problem (!) would be very much appreciated.
Cheers
Ian
I have a simple (famous last words) question but first a digression to explain how I came to it.
I came across a paper by Sterman entitled "Reflections on becoming a systems scientist" which I found very interesting. I haven't managed to track down a copy of his book yet, but in this paper he refers to a bathtub model, which I decided to make a vensim model of. (the paper is available online http://web.mit.edu/jsterman/www/All_Mod ... _(SDR).pdf
This model is not difficult to develop. (For the record the model I made consisted of a stock for the bathtub water volume, a constant outflow, a lookup graph for the outflow over time, a <time> shadow variable, and the reference to these in the inflow.)
However I noticed a rather curious result when I run it. I initially had the time period defined as minutes and the time step as 1 and I noticed that the resulting sine curve of water volume in the bathtub is shifted up from what I would expect. It oscillates between 75 litres and 175 litres implying the average bathtub level is 125 litres.
This is fine, except it seems that over those 16 minutes the same quantity of water both entered and left the model so one would assume the average should be the starting volume of 100 litres.
I thought about this and tried calculating the values manually (which agreed with the model). It occurred to me that if I decreased the size of the time step I may change the results.
Sure enough reducing the time step to 1/4 minutes brought the sine curve down quite a bit to oscillating between 56.25 and 156.25, or an average of ~103 litres. Identical model except the frequency of calculation and yet quite a different result. In fact it seemed as the time step tends towards zero the model tends towards the anticipated result.
Now with some further thought I can see exactly why this occurs. However it raises a rather big problem in my eyes if even such a simple model is subject to such inaccuracies entirely due to the structure of the model?
So, apologies for the long digression, but my actual question is how can SD modellers manage the issue of varying time steps influencing results in larger and more complex models? It seems to me in a complex model this problem could go completely unnoticed, and given small changes in models can have rather large impacts on outcomes, it is surely a rather big issue?
Any thoughts, strategies to deal with this or obvious things I have missed that mean it isn't a problem (!) would be very much appreciated.
Cheers
Ian