time shifted data

Use this forum to post Vensim related questions.
Post Reply
chester riddalls
Junior Member
Posts: 14
Joined: Tue Mar 25, 2003 9:25 am

time shifted data

Post by chester riddalls »

I have found that using the function 'time shift' to look ahead along a data series, often returns an error if the shift parameter is not a constant. For example if the time series is shifted by a variable shift and shift=constant +1, where 1 is a constant, the error is returned even if shift is designated a constant.
Is there any way around this?
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

You can only time shift using either a number or a model constant. If you have an equation such as

shift = constant + 1

then shift is treated as an auxiliary, even though it won't be time varying. There is no way around this but if you explain why you are trying to change the time shift there may be a useful solution.
chester riddalls
Junior Member
Posts: 14
Joined: Tue Mar 25, 2003 9:25 am

Post by chester riddalls »

That's as i expected.
Essentially I need to look ahead from the current day (the model time step) in some data read in from excel.
The trouble is the look ahead shift is dependent (a function of) on another variable which is read in from excel.
Incidentally, I have found that that using an element from a subscript range does work:
Eg days: day1,day2,day3
shift[days]=days
Time shifted data[days]=Time Shift(data,shift[days])
This seems to work, although i don't know why. However, it doesn't work if you want to add a constant to the shift value.
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

The fact that the subscripts works looks like a bug in detecting problems - so don't count on it workin in the future.

The best solution is to put the total amount of the shift in a excel cell and then use GET XLS CONSTANTS to read that value and shift by that amount.
Post Reply