I have as of recently been struggling with the intricacies of building an aging chain using conveyors. And some peculiarities in Vensim have made me build a home grown conveyor-like structure myself. The need for this effort may become evident from looking into the Vensim forum and reading my thread there or [for Vensim users] by taking a look at the population model using conveyors that is provided in chapter 9 of Vensim's Modeling Guide (cf. http://www.vensim.com/documentation/ind ... veyors.htm). Just run the convey4.mdl and watch what will happen (at least in the douple precision version) to the stock of YOUNG - people if you set the fractional young mortality to 100%. It will turn negative and even with a fractional mortality rate of 100% there is still some outflow from the stock - albeit little - which should not be plausible here and in some other applications.

While trying to build a conveyor like behavior it became necessary to take a closer look at higher order delays again. I very often note that the first order delay is rather omnipresent. The exponential distribution which describes the outflow of a first-order delay to me seems to be a very special case not very likely fitting many delays in operational processes. After all if you are modelling a mean residence time is 5 units of time while choosing a first-order delay you are implicitly saying that on average the observed delay times will vary by 74% (MAPD). You are also implicitly suggesting that the last unit will emerge after a delay time that is seven times higher than the average delay time, as this little tool which might also be used to estimate delay orders using the Erlang distribution shows:

https://dl.dropboxusercontent.com/u/270 ... Delays.cdf

(The CDF-player can be downloaded here: http://www.wolfram.com/cdf-player/)

As those using Vensim know, one can introduce a profile for the conveyor (very often simply a flat or uniform distribution of the elements within the stock) that will determine the outflow for the first delay period. While replicating this in my home grown structure I started wondering about the general case, e.g. how is the first period for any higher order delay represented by the simulation software, is it sufficiently close to "the real thing" and how can it be calibrated?

Let us assume we are looking at a period of time running from t = -5 to 20 where our simulation model is to cover the timespan from 0 to 20. If there is a (pipeline) delay of infinite order (as in a conveyor) then the matter is rather simple: The whole inflow of the historic period [-5,0] is simply shifted by 5 units of time to [0,5] - and since everything is completely shifted by 5 units of time there is no "overlap" and interference of delayed "material".

Not so for the general case of delays with an order higher than one. The model I have enclosed with this post will show a "true" process described by a third order delay and a model that starts at time t = 0. The inflow is modeled by a data variable using the ReferenceModeTool. In another model-view the DELAY N function of Vensim is used to model the same delayed process as it would appear in a simulation using order n = 3 and some parameter for the initial value of the delayed flow that needs to be calibrated.

Since every k-order delay can be modeled by a chain of k first-order delays with equal delay times (delay time = adjustment time / k) the initialization of the "true" model at t=0 must initialize the three stocks within the delay structure according to the state of the "real world" at that instance. When this is done for each of the stocks in the delay structure one can see that (with the neglectable exception of a shift of one time step due to the initialization being done by flushing the stocks in one time step) the model will match the real process exactly that is the outflows will match exactly for t >= 0.

I was surprised to find that the DELAY N structure will not do too badly if it is calibrated appropriately by chosing an initial value that ensures that the quantities passing through the delays within the model timespan match (as can be seen in the bar chart).

Here are some further questions in this regard:

- How to calibrate the initial value for the DELAY N function? Is there some nice to use formula in lie of accumulated output data?
- How to model a kth-order delay in a differential equation solver like Mathematica where ODE are to be entered that will be solved not necessarily using fixed time step numerical methods? (e.g. is there some closed form for the continuous case that describes the differential equation for the outflow so one can avoid entering k differential equations in order to build a SD-like structure? - The polynomial equations I have seen in the Hamilton paper cited in the CDF-paper only apply to the discrete case to my knowledge.)
- Will there be cases where the fit of the DELAY N function will be good enough - what are they and what can be done about it? (in Vensim and maybe in more powerful tools like Mathematica)

Guido