Include 'either-or' constraint in linear model

Problems with modeling
Post Reply
mielke
User
User
Posts: 8
Joined: 6 years ago

Include 'either-or' constraint in linear model

Post by mielke »

Hey guys


I'm new to GAMS (which seems to be a common introduction of a problem, here), and I'm developing a cost minimisation model for adding capacity to the electricity system and the generation dispatch of the different technologies. Apart from conventional and renewable generation technologies, I also include several storage technologies for which the model calculates the required capacity and the dispatch (charge or discharge) of that capacity. Should it be relevant to my question below, I would be happy to go more into detail, but I figure this would be enough.
For now the model is completely linear, and successfully solved by cplex.

The problem in my results is that it suggests to charge and discharge my storage capacity simultaneously. However, this is physically not possible, so it should be constrained. The relevant parameters, variables and constraints are given below.

set t; --> time step
parameter PC_stor_old; --> installed storage capacity
positive variable SC SD PC_stor_new; --> storage charge, storage discharge, storage capacity to be installed
max_charge(t) .. SC(t) =l= PC_stor_old + PC_stor_new; --> storage charge is limited to the storage capacity
max_discharge(t) .. SD(t) =l= PC_stor_old + PC_stor_new; --> storage discharge is limited to the storage capacity

Now, what I'd like to do is modify these equations or add a new constraint so that either SC(t) or SD(t) (or both) equals zero for every time t. I thought about modifying it like this:

binary variable(t) .. z;
max_charge(t) .. SC(t) =l= (PC_stor_old + PC_stor_new)*z(t);
max_discharge(t) .. SD(t) =l= (PC_stor_old + PC_stor_new)*(1-z(t));

However, as we multiply two variables (PC_stor_new and z) by each other, this cannot be done through a linear solver like cplex.
Another approach could be to add following logical constraint:

no_simult_cd(t) .. ((SC(t) =e= 0) or (SD(t) =e= 0)) =e= 1;

But this failed due to error: "57 equation no_simult_cd.. VAR operands relational or boolean"

Of course, a possibility would be to just use the first solution and use a non-linear solver. If that's the way to go: can someone recommend a commonly used non-linear solver?
However, I believe (hope) there is a more elegant way to go around this, because using a non-linear solver will probably take up more CPU time as well?

Any thoughts? Feel free to ask for more information if you need it!


Thanks in advance
Michiel
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: Include 'either-or' constraint in linear model

Post by bussieck »

Hi,

Just add some extra constraints. I am sure you can limit the maximum expansion on your storage, let's say PC_stor_new.up. Now you can keep your old constraints:

max_charge(t) .. SC(t) =l= PC_stor_old + PC_stor_new; --> storage charge is limited to the storage capacity
max_discharge(t) .. SD(t) =l= PC_stor_old + PC_stor_new; --> storage discharge is limited to the storage capacity

and have a new ones with the .up:

binary variable(t) .. z;
max_charge(t) .. SC(t) =l= (PC_stor_old + PC_stor_new.up)*z(t);
max_discharge(t) .. SD(t) =l= (PC_stor_old + PC_stor_new.up)*(1-z(t));

You should also ask yourself why your model wants to use SC and SD simultaneously. It might be that the model want to get rid of energy (if the content in the storage degrades) or you can find equally good solutions without the simultaneous in/out flow. In this case a small cost for the inflow should also avoid the problem.

-Michael
mielke
User
User
Posts: 8
Joined: 6 years ago

Re: Include 'either-or' constraint in linear model

Post by mielke »

Hey


Thanks for your quick reply!

This certainly would be a possibility. However, as I do not really want to constrain power capacity, I would have to set PC_stor_new.up to be a very large number. This, together with the use of a binary variable z, would significantly increase calculation time as well, am I right? Although for now, this seems the best option indeed!

As to why it returns this result: this is because I constrained the curtailing of energy to zero, in this particular case. When no curtailment is allowed, he tries to spill energy by the simultaneous charge/discharge storage facilities through efficiency losses, because that is cheaper than installing an extra GW(h) of storage capacity just to deal with some peaks that only occur 1% or less of the time.

Thank you very much!


Michiel
Post Reply