Hi,
I am new in Vensim and just developed a small model for energy demand based on GDP and Energy Intensity (EI) considering a time frame 2000-2035. EI has historical data from 2000 to 2016, and I have used a variable named "Historical Energy Intensity by Sector and Source" which gets the data from an Excel file using GET XLS LOOKUPS. I have another variable named "Projected Energy Intensity by Sector and Source" which uses equations in order to determine EI from 2017 to 2035.
I also have created a Variable named "Energy Intensity by Sector and Source". I tried to use the IF THEN ELSE function in order to get "Historical Energy Intensity by Sector and Source" for time <=2016, and "Projected Energy Intensity by Sector and Source" from 2017 to 2035. When I check the model an error appears stating that I cannot use a lookup as argument in the IF THEN ELSE function. Is there any other way to call the data?
Thanks
Can't use Get xls lookup in If then else function
Can't use Get xls lookup in If then else function
- Attachments
-
- Data input Ecuador.xlsx
- (211.99 KiB) Downloaded 169 times
-
- 20180315_Demand-GDP_EI.mdl
- (4 KiB) Downloaded 187 times
Re: Can't use Get xls lookup in If then else function
GET functions have to appear first on the left hand side of an equation. See http://vensim.com/documentation/fn_get_xls_lookups.htm
Make the lookup a separate variable containing the GET. Then you can use it in other equations. Like:
mylookup = GET XLS LOOKUP( ...
price = IF THEN ELSE( time > 2, mylookup(quantity), ...
Make the lookup a separate variable containing the GET. Then you can use it in other equations. Like:
mylookup = GET XLS LOOKUP( ...
price = IF THEN ELSE( time > 2, mylookup(quantity), ...
/*
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
*/