Calibration by linear interpolation
Posted: Wed Oct 11, 2017 6:00 pm
Hello,
i have a functioning model with time steps of 5 years. i want to rewrite the code to timesteps of 1 year. for that i need to recalibrate certain values. first step to do so is to get yearly values for a variable, that has only values every 5 years. so the originial code works with a set "t":
set t Time periods (5 years per period) /1*10/ ;
my variable is depending on t:
Variable
E(t) Total CO2 emissions (GtCO2 per year)
;
after solving the model i want to work with the values, introduce a new set "year" and then find values for E on a yearly basis:
set year Years /1*50/;
PARAMETERS
Eyear(year) Linear intorpoled yearly Emissions
;
Loop (year, Eyear(year)=E(ceil(year/5))+((E(ceil(year/5)+1)-E(ceil(year/5)))/5)**(year-5*ceil(year/5)););
gams doesnt like, that i use "year" in a variable that is defined in "t", but by ceil(year/5) i shouldnt ask for a value that doesnt exist.
after solving a model, are the values for E(t) fixed and i can use it as a parameter or is an addition step needed?
how can i refere to E(t) using "year"? is it even possible to use "year" in a variable defined in "t"?
i have a functioning model with time steps of 5 years. i want to rewrite the code to timesteps of 1 year. for that i need to recalibrate certain values. first step to do so is to get yearly values for a variable, that has only values every 5 years. so the originial code works with a set "t":
set t Time periods (5 years per period) /1*10/ ;
my variable is depending on t:
Variable
E(t) Total CO2 emissions (GtCO2 per year)
;
after solving the model i want to work with the values, introduce a new set "year" and then find values for E on a yearly basis:
set year Years /1*50/;
PARAMETERS
Eyear(year) Linear intorpoled yearly Emissions
;
Loop (year, Eyear(year)=E(ceil(year/5))+((E(ceil(year/5)+1)-E(ceil(year/5)))/5)**(year-5*ceil(year/5)););
gams doesnt like, that i use "year" in a variable that is defined in "t", but by ceil(year/5) i shouldnt ask for a value that doesnt exist.
after solving a model, are the values for E(t) fixed and i can use it as a parameter or is an addition step needed?
how can i refere to E(t) using "year"? is it even possible to use "year" in a variable defined in "t"?