How to simplify the CCGT unit commitment model?

Problems with modeling
Post Reply
TsungHaoHu
User
User
Posts: 6
Joined: 4 weeks ago

How to simplify the CCGT unit commitment model?

Post by TsungHaoHu » 4 weeks ago

Subject: How to simplify the CCGT unit commitment model?

Hi all,

I used GAMS to model the combined cycle gas turbine (CCGT) unit commitment problem
,but the model has too many rows in CCGT constraints.
I tried to "GAMS SET" to simplify the model but failed.
How to write the constraints in GAMS efficiently?
Related program files such as attachments.

Thanks.

For example, the "CCGT" constraints as follow:

Code: Select all

CCGT_trans_excl(H)..
    S("CCGT_M0","CCGT_M1",H) + S("CCGT_M1","CCGT_M0",H)
     + S("CCGT_M1","CCGT_M2",H) + S("CCGT_M2","CCGT_M1",H)
      + S("CCGT_M2","CCGT_M3",H) + S("CCGT_M3","CCGT_M2",H)
          =l= 1;

CCGT_trans_M0(H)$(ord(H) > 1)..
    U("CCGT_M0",H) - U("CCGT_M0",H - 1)
          =e= sum(CCGT_FS_0,S(CCGT_FS_0,"CCGT_M0",H))
               - sum(CCGT_FS_0,S("CCGT_M0",CCGT_FS_0,H));

CCGT_trans_M1(H)$(ord(H) > 1)..
    U("CCGT_M1",H) - U("CCGT_M1",H - 1)
          =e= sum(CCGT_FS_1,S(CCGT_FS_1,"CCGT_M1",H))
               - sum(CCGT_FS_1,S("CCGT_M1",CCGT_FS_1,H));

CCGT_trans_M2(H)$(ord(H) > 1)..
    U("CCGT_M2",H) - U("CCGT_M2",H - 1)
          =e= sum(CCGT_FS_2,S(CCGT_FS_2,"CCGT_M2",H))
               - sum(CCGT_FS_2,S("CCGT_M2",CCGT_FS_2,H));

CCGT_trans_M3(H)$(ord(H) > 1)..
    U("CCGT_M3",H) - U("CCGT_M3",H - 1)
          =e= sum(CCGT_FS_3,S(CCGT_FS_3,"CCGT_M3",H))
               - sum(CCGT_FS_3,S("CCGT_M3",CCGT_FS_3,H));
               
Attachments
UC_CCGT.7z
(6.81 KiB) Downloaded 5 times

User avatar
bussieck
Moderator
Moderator
Posts: 208
Joined: 2 years ago

Re: How to simplify the CCGT unit commitment model?

Post by bussieck » 4 weeks ago

The key is to introduce a set that represents your network:

Code: Select all

Set
Gen_CCGT(Gen)   /"CCGT_M0","CCGT_M1","CCGT_M2","CCGT_M3"/
net(Gen,Gen)    / CCGT_M0.CCGT_M1, CCGT_M1.(CCGT_M0,CCGT_M2),
                  CCGT_M2.(CCGT_M1,CCGT_M3), CCGT_M3.CCGT_M2 /;
Then the algebra is easy:

Code: Select all

CCGT_trans_excl(H)..
    sum((Gen,Gen2)$(net(Gen,Gen2) and net(Gen2,Gen)), S(Gen,Gen2,H) + S(Gen2,Gen,H)) =l= 1;

CCGT_trans(Gen_CCGT(Gen),H)$(ord(H) > 1)..
    U(Gen,H) - U(Gen,H - 1)
          =e= sum(net(Gen2,Gen),S(Gen2,Gen,H))
               - sum(net(Gen,Gen2),S(Gen,Gen2,H));
I am not sure if I got the logic you wanted to implement with CCGT_trans_excl right. With the data it generates the same equation as your initial model, but if there would be arcs CCGT_M0.CCGT_M3 and CCGT_M3.CCGT_M0 then this would also count in the sum. Moreover, from the name (and some background in network flows) it seems that you want to avoid having flow on antiparallel arcs (a->b, b->a). In your constraint you allow flow on one arc for all antiparallel arc pairs. So I think you should make a constraint for each antiparallel arc pair:

Code: Select all

CCGT_trans_excl(Gen,Gen2,H)$(net(Gen,Gen2) and net(Gen2,Gen))..
    S(Gen,Gen2,H) + S(Gen2,Gen,H) =l= 1;
I have attached the modified code.

-Michael
Attachments
Sim_UC.gms
(4.69 KiB) Downloaded 5 times

TsungHaoHu
User
User
Posts: 6
Joined: 4 weeks ago

Re: How to simplify the CCGT unit commitment model?

Post by TsungHaoHu » 4 weeks ago

Thank you for your guidance.

I have not yet fully understood the "Set syntax", but I first check the correctness of the revised program.
So I did some test. According to the program you modified, only "CCGT_trans_excl(H)" should be incorrect.
If I replace the original "CCGT_trans_excl(H)", the program can be simplified and the "Sim_UC_rev.gms" (out2.gdx) result is exactly the same as original "Sim_UC.gms" (out.gdx) result.
Related program files such as attachments.

Original
CCGT_trans_excl(H)..
S("CCGT_M0","CCGT_M1",H) + S("CCGT_M1","CCGT_M0",H)
+ S("CCGT_M1","CCGT_M2",H) + S("CCGT_M2","CCGT_M1",H)
+ S("CCGT_M2","CCGT_M3",H) + S("CCGT_M3","CCGT_M2",H)
=l= 1;

Code: Select all

Revised:
CCGT_trans_excl(H)..
      sum((Gen,Gen2)$(net(Gen,Gen2) and net(Gen2,Gen)), S(Gen,Gen2,H) + S(Gen2,Gen,H)) =l= 1;

Code: Select all

Original:
CCGT_trans_excl(H)..
    S("CCGT_M0","CCGT_M1",H) + S("CCGT_M1","CCGT_M0",H)
     + S("CCGT_M1","CCGT_M2",H) + S("CCGT_M2","CCGT_M1",H)
      + S("CCGT_M2","CCGT_M3",H) + S("CCGT_M3","CCGT_M2",H)
          =l= 1;
I am very grateful for your help.
Attachments
UC_CCGT_rev.7z
(8.06 KiB) Downloaded 4 times

User avatar
bussieck
Moderator
Moderator
Posts: 208
Joined: 2 years ago

Re: How to simplify the CCGT unit commitment model?

Post by bussieck » 4 weeks ago

"My" compact CCGT_trans_excl was indeed incorrect, I counted every variable twice, so if you replace this with this constraint, you will get the same solution:

Code: Select all

CCGT_trans_excl(H)..
    sum((Gen,Gen2)$(net(Gen,Gen2) and net(Gen2,Gen) and ord(Gen)<ord(Gen2)), S(Gen,Gen2,H) + S(Gen2,Gen,H)) =l= 1;
The "and ord(Gen)<ord(Gen2)" is new.

-Michael

TsungHaoHu
User
User
Posts: 6
Joined: 4 weeks ago

Re: How to simplify the CCGT unit commitment model?

Post by TsungHaoHu » 4 weeks ago

I got it ! Thanks a lot. :)

TsungHaoHu
User
User
Posts: 6
Joined: 4 weeks ago

Re: How to simplify the CCGT unit commitment model?

Post by TsungHaoHu » 4 weeks ago

Hi all,
I succeeded in simplifying "CCGT_trans", but another problem has arisen.
When I added the model to 2 or more CCGT units, it was also difficult to simplify in "CCGT_excl" and "CCGT_trans_excl".
For example, if I have 2 "CCGTs" (named CCGT1, CCGT2) in the model, it will become
"CCGT1_excl", "CCGT2_excl", "CCGT1_trans_excl", "CCGT2_trans_excl".

How to write the constraints in GAMS efficiently?

Related program files such as attachments.

Thanks.
Attachments
UC_CCGTs.rar
(12.43 KiB) Downloaded 6 times

User avatar
bussieck
Moderator
Moderator
Posts: 208
Joined: 2 years ago

Re: How to simplify the CCGT unit commitment model?

Post by bussieck » 3 weeks ago

I think you still have difficulties organizing your data in a relational form. You might want to talk to your database friends/colleagues how to organize data in a relational database. That's also the way to organize data in GAMS. The choice of label names suggest the same thing. You try to put structure in the names (e.g. ''CCGT1_M0,CCGT1_M1,CCGT1_M2,CCGT1_M3") , but you should put this structure in different symbols and relation between these symbols. I have no clue that the M1*M3 is but it's probably something related to CCGT1. So make a set ccgt / CCGT1, CCGT2 /, a set M / M1*M3 / and make a relation ccgt_m_map(ccgt,m) / CCGT1.M1, CCGT1.M2, ... /. This allows you to formulate your model properly. Another way of achieving the same goal it to write the mathematical algebra with indexes. If you have a compact representation, you will have a compact representation in GAMS. If you have all this you can easily add the gtcc index to the equation and achieve what you want in a single indexed equation. Such a change will ripple through your entire mode and many of the symbols will be effected, but in the end you model will be much better.

-Michael

TsungHaoHu
User
User
Posts: 6
Joined: 4 weeks ago

Re: How to simplify the CCGT unit commitment model?

Post by TsungHaoHu » 3 weeks ago

Thank you for your suggestion.
I might try to change the CCGT structure in different symbols
or making a relation of CCGTs to simplify the model.
Thank a lot.

Post Reply