Hello, I have just started to work with GAMS. I have already programmed a storage optimization tool, which is working fine. It optimizes the revenue at the spot market minus costs of storage and volume. But now I want to extend my model (I want to include self discharge). The self discharge depends on State of Charge (SOC  variable in my model) and of course the storage type (sto1, sto2, sto3  set u_S). I have the following parameters:
Depending on the level of my variable SOC  the self discharge differs. But I need just one SelDis variable(?), thats why I build the following if else term:
But unfortunately it is not working. Is my "if else" term wrong? Where do I have to put it? Under equations? Do you need more information? Thank you very much in advance! asked 29 Apr '14, 04:23 banolli 
I'm not a GAMS "expert" ...but if I understand you right, you need to express your conditional statement using constraints and a (binary) auxiliary variable:
IINM, LOOP is a control flow statement that can't be used as part of the model definition, and ifconditions involving variables make your model nonlinear (this might work for you if you're using a MINLP solver, though). answered 29 Apr '14, 07:13 fbahr ♦ P.S.: BTW, there's also a Google group, dedicated to "all things GAMS" https://groups.google.com/forum/#!forum/gamsworld
(29 Apr '14, 07:16)
fbahr ♦
Hey, thanks for your help. It's working! But now I have another linearity problem :/ I try to figure it out and write here again, when it is fixed :) Thanks again!
(29 Apr '14, 12:12)
banolli
