$title GAMS Programming Technique for Linear Interpolation * Our model operates through a 100 year horizon in one * year time steps. For parsimony, input data are specified * on a decadal basis, and omitted values must be interpolated. This * program fragment illustrates one way this can be done. sets tp Time periods (annual time steps) /2000*2100/; * tp and ttp refer to the same set. alias (tp,ttp); parameter wt(tp,ttp) Weighting scheme (weight on ttp for computing tp value); set decade(tp) Decades (points where data are provided); decade(tp) = yes$(ord(tp)=1); loop(tp$decade(tp), decade(tp+10) = yes;); display decade; scalar yr Integer offset used for referencing non-decadal time periods; loop(tp$decade(tp), wt(tp,tp) = 1; for(yr=1 to 9, wt(tp+yr,tp) = 1-yr/10; wt(tp+yr,tp+10) = yr/10;); ); display wt; * Illustrate how wt() can be used: set pvt Passenger Vehicle Technologies / icev internal combustion engine vehicle phev plug-in hybrid electric vehicle elcv full electric vehicle cngv compressed natural gas vehicle bksv backstop (e.g. H2) vehicle/; table costpvkt(pvt,tp) Non-energy vehicle cost per VKT ($ per 1000 km) 2000 2010 2020 2030 2040 2050 2060 2070 2080 2090 2100 icev 200 200 200 200 200 200 200 200 200 200 200 phev 250 250 240 230 220 210 200 200 200 200 200 elcv 350 350 325 300 275 260 250 250 250 250 250 cngv 250 250 240 230 220 210 200 200 200 200 200 bksv 500 500 450 400 375 360 350 350 350 350 350; costpvkt(pvt,tp) = sum(ttp, wt(tp,ttp) * costpvkt(pvt,ttp)); display costpvkt;
---- 19 SET decade Decades (points where data are provided) 2000, 2010, 2020, 2030, 2040, 2050, 2060, 2070, 2080, 2090, 2100 ---- 26 PARAMETER wt Weighting scheme (weight on ttp for computing tp value) 2000 2010 2020 2030 2040 2050 2060 2070 2080 2000 1.000 2001 0.900 0.100 2002 0.800 0.200 2003 0.700 0.300 2004 0.600 0.400 2005 0.500 0.500 2006 0.400 0.600 2007 0.300 0.700 2008 0.200 0.800 2009 0.100 0.900 2010 1.000 2011 0.900 0.100 2012 0.800 0.200 2013 0.700 0.300 ... ---- 49 PARAMETER costpvkt Non-energy vehicle cost per VKT ($ per 1000 km) 2000 2001 2002 2003 2004 2005 2006 2007 2008 icev 200.000 200.000 200.000 200.000 200.000 200.000 200.000 200.000 200.000 phev 250.000 250.000 250.000 250.000 250.000 250.000 250.000 250.000 250.000 elcv 350.000 350.000 350.000 350.000 350.000 350.000 350.000 350.000 350.000 cngv 250.000 250.000 250.000 250.000 250.000 250.000 250.000 250.000 250.000 bksv 500.000 500.000 500.000 500.000 500.000 500.000 500.000 500.000 500.000 + 2009 2010 2011 2012 2013 2014 2015 2016 2017 icev 200.000 200.000 200.000 200.000 200.000 200.000 200.000 200.000 200.000 phev 250.000 250.000 249.000 248.000 247.000 246.000 245.000 244.000 243.000 elcv 350.000 350.000 347.500 345.000 342.500 340.000 337.500 335.000 332.500 cngv 250.000 250.000 249.000 248.000 247.000 246.000 245.000 244.000 243.000 bksv 500.000 500.000 495.000 490.000 485.000 480.000 475.000 470.000 465.000 ...