Changing Index of Variables

Problems with syntax of GAMS
Post Reply
Luqman Hakeem
User
User
Posts: 30
Joined: 4 years ago

Changing Index of Variables

Post by Luqman Hakeem »

Hi!

I am currently working on the modelling of fuel switching in GAMS. In fuel switching, fuel of certain power plant is changed from more carbon intensive fuel (e.g. coal) to less carbon intensive fuel (e.g. natural gas). Binary variable is attached with fuel switching in order to check its feasibility of different power plants. But when fuel switching binary variable (say "h(i,j,t)") becomes one in a certain year, fuel of that power plant should also be changed (e.g. from coal to natural gas). Set 'i' is power plants, 'j' is fuel type (Oil, coal, natural gas) and 't' is year.

Can anyone suggest me something so that fuel is automatically changed from coal to natural gas under the set 'j'?
abhosekar
Moderator
Moderator
Posts: 295
Joined: 3 years ago

Re: Changing Index of Variables

Post by abhosekar »

It is difficult to answer this question without knowing about the rest of your model (how you would like to see the fuel of a particular plant change). In general, one would model binary variables to represent the type of fuel j used in plant i in the year j, and then use these binary variables in the objective function/constraints of the model so that the change in fuel type is reflected.
Luqman Hakeem
User
User
Posts: 30
Joined: 4 years ago

Re: Changing Index of Variables

Post by Luqman Hakeem »

Thanks!

Actually when fuel switching is done from coal to natural gas (NG) then all the parameters for a certain power plant should be changed. For example fuel cost should be changed from coal to NG. I tried it as:
FC(i,'Oil',t)$(hOil(i,tc)=1) = FC(i,'NG',t);
VC(i,'Oil',t)$(hOil(i,tc)=1) = VC(i,'NG',t);
FuelExi(i,'Oil',t)$(hOil(i,tc)=1) = FuelExi(i,'NG',t);
HRExi(i,'Oil',t)$(hOil(i,tc)=1) = HRExi(i,'NG',t);
CO2(i,'Oil',t)$(hOil(i,tc)=1) = CO2(i,'NG',t);
But it did not worked.
abhosekar
Moderator
Moderator
Posts: 295
Joined: 3 years ago

Re: Changing Index of Variables

Post by abhosekar »

If condition on a variable is probably the cause of your issues. PYou can make use of big-M reformulation.

You need not set FC(i,'Oil',t)$(hOil(i,tc)=1) = FC(i,'NG',t);
Instead, you may want to use FC(i, 'NG', t) if the binary variable hOil(i, tc) is 1.

One way to achieve this is by creating a variable FuelCost(i,t). Then using big-M you can set the corresponding values.
For example, FuelCost(i,t) =l= FC(i, 'NG', t) + M(1-hOil(i,tc));
and FuelCost(i,t) =g= FC(i, 'NG', t) - M(1-hOil(i,tc));
where M is a big enough number.
Luqman Hakeem
User
User
Posts: 30
Joined: 4 years ago

Re: Changing Index of Variables

Post by Luqman Hakeem »

Sorry to interept you again.

Big M formulation did not worked. Files are attached.
LGDPFSwlosses4.gms
(53.07 KiB) Downloaded 260 times
input26.xlsx
(2.96 MiB) Downloaded 262 times
Post Reply