How to equalize the values of a variable in several time intervals

Problems with modeling
Post Reply
GrayLee
User
User
Posts: 8
Joined: 2 years ago

How to equalize the values of a variable in several time intervals

Post by GrayLee »

Dear all,

I am modeling the operating feature of a device capturing CO2 from the atmosphere. The function of the device is explained as follows. We assume that 96 time intervals in a day and one interval takes up 15min. The device can operate several cycles in one day. A thorough cycle should be finished to capture CO2 when the device works. A cycle of the device takes up three time intervals, that is, 45mins. In one cycle, there are two processes, which can be called process A and process B. Process A takes up one time interval (15min) and process B takes up two time intervals (30min). Process A and process B should be continuous (i.e., process B after process A). The mass of captured CO2 in a cycle is a variable, and the values of the variable in three intervals in a cycle equal (because a quantity of CO2 should experience both processes before it is fully captured).

I wrote a code that can realize the logic of the cycle in one day. You can find the code in the attachment. In the code, I use three kind of binary variables to describe the logic, that is, operating status (I_A and I_B), startup status (SU_A and SU_B) and shutdown status (SD_A and SD_B). However, I have no idea how to make the mass (m_CO2) equal in three time intervals in the same cycle (the value of m_CO2 in different cycles can be different). Can you please help me with this modeling problem? In brief, I wonder how to realize the following logic:

Code: Select all

if SU_B(t) = 1
then m_CO2(t-1) = m_CO2(t) = m_CO2(t+1);
Thanks in advance!

Best regards
Gray Lee
UC_test.gms
(1.86 KiB) Downloaded 61 times
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: How to equalize the values of a variable in several time intervals

Post by bussieck »

Gray, if you have this strict process ABB why do starts and shutdowns etc of A and B as individual decisions? Isn't it just sufficient to decided if in time step t this ABB process starts? Then you only needs the logic:

Code: Select all

set tx(t) allow start of ABB; tx(t) = ord(t)<card(t)-1;
binary variable startABB(t);
defCount.. sum(tx, startABB(tx)) =e= 20;
defOne(tx(t))$(ord(t)>2).. startABB(t-2) + startABB(t-1) + startABB(t)  =l= 1;
Now you need some logic that lets the model have some m_CO2. I don't know if the amount of CO2 capture depends on other things but for the moment let's assume that the total amount of the single ABB process is 90 units CO2 and you want this amount to be equally distributed over the three time period: 30+30+30. Then you can do this as follows:

Code: Select all

positive variable fullCapture(t), m_CO2(t);
deffullCapture(tx).. fullCapture(tx) =l= 90*startCapture(tx);
defm_CO2(t).. m_CO2(t) =e= (fullCapture(t)$tx(t) + fullCapture(t-1)$tx(t-1) + fullCapture(t-2)$tx(t-2)) / 3;
-Michael
GrayLee
User
User
Posts: 8
Joined: 2 years ago

Re: How to equalize the values of a variable in several time intervals

Post by GrayLee »

Dear Michael,

You provide me with a good idea, and reply to the post timely, as always! I think your idea can resolve my problem, and is more efficient than the older code. Thanks again for your help!

Best regards,
Gray Lee
Post Reply