Retrieving data of particular year only
Retrieving data of particular year only
I need help that I want to retrieve only data of one particular year from stock of 100 years. Lookup functions needs two data sets but what if i just know the year but not the stock in that year. How Vensim can get only one value from stock of 100 years? Thank you
Re: Retrieving data of particular year only
Not sure I understand the question. If you don't know the stock values, how will you retrieve one?
If you have time series data, you can use GET DATA AT TIME or GET DATA BETWEEN TIMES. These functions tend to be slow, so often it's good to wrap them in an INITIAL().
If you have time series data, you can use GET DATA AT TIME or GET DATA BETWEEN TIMES. These functions tend to be slow, so often it's good to wrap them in an INITIAL().
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Re: Retrieving data of particular year only
Indeed my question was not clear. for example my model calculated the stock over period of 50 years (2000-2050). Now from this calculation I want to know the stock at one particular year lets say 2015. How Can i get this value? I tried to do by using GET DATA AT TIME but my vensim says it is not supported.
Re: Retrieving data of particular year only
Ah - you can use SAMPLE IF TRUE for that.
If you don't have it (PLE), you can use a stock to freeze the value. Something like:
value = ... { your stock } ~ stuff
sampled value = INTEG( sample adj rate, value ) ~ stuff
sample adj rate = IF THEN ELSE(time<=sample time,(value-sampled value)/TIME STEP,0) ~ stuff/time
sample time = 2015 ~ time
There's a lag of one time step in reporting the 2015 value, though that can be corrected if needed.
If you don't have it (PLE), you can use a stock to freeze the value. Something like:
value = ... { your stock } ~ stuff
sampled value = INTEG( sample adj rate, value ) ~ stuff
sample adj rate = IF THEN ELSE(time<=sample time,(value-sampled value)/TIME STEP,0) ~ stuff/time
sample time = 2015 ~ time
There's a lag of one time step in reporting the 2015 value, though that can be corrected if needed.
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/