Page 1 of 1

Initialization of a fixed delay

Posted: Tue Jul 15, 2008 4:13 pm
by tfhavel
Is there any reasonable way to initialize a "DELAY FIXED" variable to an arbitrary function of time? Right now it appears that all previous values from 0 thru -Delay Time are just initialized to the third argument, which must be constant. Of course one can drive the simulation up to a given point in time and then start from there, but in my case this would make the simulations many times longer and hence slower, which would make optimization quite painful. It would be less painful to implement long, high-order material delay which approximates a fixed delay (which seems to be how VENSIM does it internally) using subscripts and VECTOR ELM MAP, and then read in the initial values of all the intermediate levels from an Excel sheet or data file, but even that seems a bit much to expect of an average user. So I am wondering if I might have missed something in the documentation?

Posted: Tue Jul 15, 2008 5:41 pm
by bob@vensim.com
If you are, as it appears, using difference equations with TIME STEP = 1, then the easiest formulation to initialize the delay process for a 20 period delay would be

dalayed val = delay pipeline[lastsub]
sub: (s1-s19),lastsub
delay pipeline[sub] = INTEG(0,initial delay pipeline[sub])
pipe shifter = SHIFT IF TRUE(delay pipeline[s1],1,ELMCOUNT(sub),0,val)

Alternatively you can use DELAY CONVEYOR with 0 leakage and then read in the init profile using a GET XLS LOOKUPS call - but because this provides a continuous solution the relationship between the quantities in the spreadsheet and those used by Vensim may not be exact. This approach works with any TIME STEP and is the only sensible one if you are not doing difference equation modeling.

Posted: Tue Jul 15, 2008 7:23 pm
by tfhavel
Thank you, Bob! I am working in continuous time so I'll use DELAY CONVEYOR.