Indexing issue

Problems with modeling
Post Reply
marco
User
User
Posts: 6
Joined: 1 year ago

Indexing issue

Post by marco »

Hi everyone

I have a model of an electricity market with a given set of virtual power plants (i call them virtual because i take aggregated numbers/data for the diffrent power plants) with given capacities and costs for several interconnected countries. The power plants provide the optimal amount of electricity for every hour of the year depending on given marginal costs of production and availability (e.g. solar power and others are not always available).

As i try to analyze the effects of charging a large number of electric vehicles i created several different models. Ironically i have some problems with the apparently simpler models due to an indexing problem. The problem in this model is as follows:
The total demand for electricity consists of 2 components. The first component is the demand without electric vehicles (this is an exogenous parameter: DoM). The second component is a variable (xMob) which represents the demand of electric vehicles and which should be optimized over a certain time period --> in this example over the 48 hours of 2 days (i know that this is not realistic but i need it as comparison to the models with bidirectional charging, which already work). The according demand of the vehicles over the time period (here 2 days) is exogenously given (DMobD). So the model should optimize xMob over the 48 hours of any 2 days to match the given parameter DMobD. I take the calendar of 2018 so the model should optimize xMob over the 1. and 2. of January, then 3. and 4. of January...and so on.
The idea is, that the model tends to choose the midday hours for charging because then there is a lot of "cheap" electricity from solar power.

I tried to overcome the problem with an additional index t for the according time period (here 2 days). To get the model working i had to implement the index t to every parameter and every variable in the model. This was very inefficient and the model gets so big that my computer can't handle it (the model somehow calculates the new index t1 over all days instead of 1.+2. Jan. then 3.+4. Jan. and so on. I tried some modifications but still it does not work properly. The latest model is infeasible and i really don't know how i could overcome this problem.
The first attached model (1D.small) optimizes over just the 24 hours of one day. This seems to work.
The second attached model (2D.test2) should optimize over 48 hours of 2 days which does not work properly.

Has anyone an idea how this problem could be solved? It would be even more convenient if there was the possibility to somehow sum up the hourly demand of electric vehicles and set it equal to the sum of the variable xMob over the 48 hours of any 2 days of the year. Firstly because i have the hourly demand data available and secondly i could avoid the separate calculation of the demand over 2, 6 and 7 days (for additional models) in the excel files.

I hope i could somehow explain the problem (as my mathematical background is somewhat limited).

Any help would be greatly appreciated:)

Best, Marco
indata_B_var_1D.small.xlsx
(254.09 KiB) Downloaded 79 times
Model_B_var_2D.test2.gms
(10.23 KiB) Downloaded 79 times
indata_B_var_2D.test2.xlsx
(816.35 KiB) Downloaded 74 times
Model_B_var_1D.small.gms
(10.2 KiB) Downloaded 82 times
Fred
Posts: 373
Joined: 7 years ago

Re: Indexing issue

Post by Fred »

Hi Marco,

If I understand correctly what you want to do, you should not use index t in the domain of variable xMob. Basically what you seem to need is a mapping of the seven elements in set t (each representing 48 hours) to the pairs of days and hours (d,h). You can get this for example as follows:

Code: Select all

set map(t,d,h) ;
map(t,d,h) =  (48*(ord(t)-1) < 24*(ord(d)-1) + ord(h)) and (48*(ord(t)) >= 24*(ord(d)-1) + ord(h));
Then you could declare variable xMob without the t index

Code: Select all

Positive Variable    
    xMob(d,h,l)       'Strommenge pro Tag d, Stunde h und Land l für E-Mobilität' ;
and then you could kick out the t from the domain of several parameters, variables and equations and to make sure that xMob(d,h,l) meets the demand as given in parameter DMobD, you could rewrite equations DemandMobDCH and DemandMobDAnrainer.

Code: Select all

DemandMobDCH(t,ch)..         DMobD(t,ch)     =e= sum(map(t,d,h), xMob(d,h,ch)) ;

DemandMobDAnrainer(t,r)..   DMobD(t,r)        =e= sum(map(t,d,h), xMob(d,h,r)) ;
(btw. I am not sure why you have those two identical equations indexed over ch and r instead of just one equation indexed over superset l.)

I did not dive deeply into the model to understand all its details. So no guarantees that this is what you actually wanted but I hope this helps!

Fred
marco
User
User
Posts: 6
Joined: 1 year ago

Re: Indexing issue

Post by marco »

Hi Fred

Thanks a lot for helping me out. I'm so grateful.

Yes, i think your are right - it was a mapping problem (i just didn't know how to describe the problem properly).

Best, Marco
Post Reply