## Uncertainty modelling

Problems with modeling
priyanka_shinde
User
Posts: 5
Joined: 4 months ago

### Uncertainty modelling

Hello,

I am trying to model uncertainty in electrical load using Information Gap Decision Theory as used in "https://link.springer.com/chapter/10.10 ... 87-302-6_5".
So, here I have to maximize alpha (which doesn't change with time). So the formulation is as follows:

Objective: max alpha
constraint: OF <= OF_b +beta*|OF_b|
Le(t)=(1+alpha)*Le_max

and there are several other constraints which are easy to code. But I just have doubts about the above three things. I am getting error that 'Unknown symbol' for objective function and for constraint of OF, that the set is already under control.

I am running an Energy hub management model for 24 hours with 10 EVs.
My code is given below:

set t /t1*t24/,
v /v1*v10/;

table data(t,*)
P_w_max lambda_e Le_max Lh
t1 4.79278846153845 44.6274038461538 3.26011692782526 2.81160523504273
t2 5.28986823361822 40.884169634378 4.02858796296296 3.51196047008547
t3 5.84521901709402 36.2274370845204 4.69979522792023 3.9498157051282
t4 5.6423611111111 33.0325362060778 4.94326626305793 4.47518963675214
t5 5.78937856125355 33.0364417141501 4.98254985754986 3.97679487179487
t6 6.34472934472933 36.4217361111111 4.982965337132 4.2746688034188
t7 6.25841346153846 42.9140574548908 4.99310303893637 4.21377403846154
t8 7.83472222222221 47.030267687559 4.86710885565052 4.50289797008544
t9 9.06090633903133 46.0287001424501 4.78002433523267 4.3282719017094
t10 10.8121527777778 45.5756612060778 4.75125237416904 4.08362713675213
t11 12.4757745726496 46.1279000474834 4.76139007597341 4.23275106837607
t12 13.614521011396 44.3954166666666 4.83956255935423 4.1631063034188
t13 14.4 45.4957935660019 4.78166547958214 3.99723023504273
t14 14.9294515669516 45.5908926875593 4.55842830009497 3.80508547008547
t15 14.5223646723647 39.3805490265907 4.37412155745489 3.6217094017094
t16 14.8152154558404 41.1204528727445 4.23840515194682 3.70956463675213
t17 15.0206285612535 42.0382472697056 4.23882063152897 3.56118856837607
t18 13.475917022792 43.0474305555555 3.889215337132 3.5178125
t19 11.9022257834758 41.1319741215574 3.58824192782526 3.18566773504273
t20 10.9118055555555 41.684212962963 3.2775462962963 2.70479166666666
t21 8.72548967236467 41.8707009734093 3.07377433523266 2.7926469017094
t22 6.88917378917378 41.143690645774 2.9380579297246 2.70550213675214
t23 6.51131588319087 41.8785119895536 2.87043862773029 2.51339476495726
t24 5.69583333333333 36.9472222222222 2.79305555555556 2.575 ;

table EV(t,v)
v1 v2 v3 v4 v5 v6 v7 v8 v9 v10
t1 0 0 0 4.6 0 0 0 4 0 0
t2 0 3.6 0 1.8 0 2 0 0 0 0
t3 0 5 0 0 0 2.2 0 0.6 0 2
t4 0 0 0 0 3.6 0 0 1.2 0 0
t5 2.4 0 0 0 1.8 4.2 2.8 3.6 0 4.4
t6 0 4.8 0 0 1.4 1.8 0 0 0 0
t7 0 0 0 0 1.6 2.6 0 0 0 0
t8 4.8 0 1 2 0 3.8 0 0 0 2
t9 0 0 0 0 1.2 3 1.2 0.8 0 1.2
t10 0 2.4 0 4 0 0 3.4 0 0 1
t11 0 0 0 4.6 2.4 0 0 4.4 0 0.4
t12 4 0 0 0 4.2 3 0 1.2 0 0
t13 0 0 0 0 2 0 3.4 0 4.2 0
t14 0 0 0 0 3 0 0 4 0 0
t15 0 0 0 0 0 1.4 0 0 3.8 0
t16 3.6 0 0 4.6 0 0 3.8 0 0 4
t17 0 0 3.6 0 1.6 0 0 3 0 4
t18 0 0 0 4 0 0 0 1.8 0 0
t19 0 0 4 0 2.2 2.6 0 0 2 4
t20 0 0 0 0 3 0 4.2 3.2 2.2 0
t21 0 0 4.8 3.8 0 0 0 2.6 1 1
t22 0 0 0 0 3.8 0 0 0.4 0 0
t23 0 4.8 0 0 0 0 0 0 0 2.2
t24 0 0 0 0 2.2 0 3.2 0 0.4 0

variable Pe_b(t), Pd(t,v), Pg(t), Pg_furnace(t), Pg_CHP(t), SoC(t,v), Pc(t,v), Pe_s(t), Pd(t,v), Pw(t), Le(t);

binary variable Uc(t,v), Ud(t,v);

free variable OF;

scalar OF_b /-700/, beta /0.3/, eta_ge_CHP /0.35/, eta_gh_CHP /0.45/, eta_gh_furnace /0.75/, Pe_max_s /7/, Pe_max_b /7/, eta_d_v /0.93/, eta_c_v /0.9/, E_0_v /3/, SoC_v_max /25/, SoC_v_min /1/, Pc_v_min /0/, Pd_v_min /0/, Pc_v_max /12.5/, Pd_v_max /12.5/, Omega_v /0.166/, lambda_g /30/;

parameter P_tr(t,v);

P_tr(t,v) = (EV(t,v))*Omega_v;

equations load_val(t),igdt_constraint(t),electricty_balance(t), heat_balance1(t), obj, heat_balance2(t), charge_balance(t,v), ch_dis_hibin(t,v), ch_dis_lobin(t,v), wind_lim(t) ;

obj .. OF =e= alpha;

igdt_constraint(t)..sum(t,lambda_g*Pg(t)) + sum(t,data(t,'lambda_e')*Pe_b(t))-sum(t,data(t,'lambda_e')*Pe_s(t))=l=OF_b+beta*abs(OF_b);

electricty_balance(t) .. Pe_b(t) + Pw(t)+ eta_ge_CHP*Pg_CHP(t)+sum(v,Pd(t,v)) =e= data(t,'Le') + Pe_s(t) +sum(v,Pc(t,v));

heat_balance2(t) .. Pg(t) =e= Pg_furnace(t) + Pg_CHP(t);

heat_balance1(t) .. data(t,'Lh') =e= eta_gh_furnace*Pg_furnace(t) + eta_gh_CHP*Pg_CHP(t);

charge_balance(t,v) .. SoC(t,v) =e= E_0_v\$(ord(t)=1) + SoC(t-1,v)\$(ord(t)>1) + Pc(t,v)*eta_c_v - Pd(t,v)*(1/eta_d_v) - P_tr(t,v);

wind_lim(t)..Pw(t) =l= data(t,'P_w_max');

ch_dis_hibin(t,v)..Uc(t,v) + Ud(t,v) =l= 1;

ch_dis_lobin(t,v)..Uc(t,v) + Ud(t,v) =g= 0;

********************************************

Pe_b.up(t)=Pe_max_b;
Pe_b.lo(t)=0;
Pe_s.up(t)=Pe_max_s;
Pe_s.lo(t)=0;

Pc.up(t,v) =Pc_v_max;
Pd.up(t,v) =Pd_v_max;

Pc.lo(t,v) =Pc_v_min;
Pd.lo(t,v) =Pd_v_min;

Pg.lo(t)=0;
Pg_CHP.lo(t)=0;
Pg_furnace.lo(t)=0;
Pg_CHP.up(t)=10;
Pg_furnace.up(t)=10;
Pw.lo(t)=0;

SoC.up(t,v)=SoC_v_max;
SoC.lo(t,v)=SoC_v_min;
SoC.fx('t24',v)=E_0_v;

model IGDT_case3 /all/;
solve IGDT_case3 max OF us mip;

Priyanka

Renger
Posts: 113
Joined: 1 year ago

### Re: Uncertainty modelling

Hi Pryanka

You didn't define the parameter alpha in your model
Something like this should appear before you use the parameter alpha:

Code: Select all

``````parameter
alpha 'my alpha parameter' /0.2/;``````

Code: Select all

``````igdt_constraint(t)..sum(t,lambda_g*Pg(t)) + sum(t,data(t,'lambda_e')*Pe_b(t))-sum(t,data(t,'lambda_e')*Pe_s(t))=l=OF_b+beta*abs(OF_b);
``````
is defined/indexed over the set t, but you also sum over t. It is liking trying this a(t) = sum(t, b(t)). Gams expects an expression on the RHS for each t.
This would only work if you drop the index in the constraint:

Code: Select all

``igdt_constraint..sum(t,lambda_g*Pg(t)) + sum(t,data(t,'lambda_e')*Pe_b(t))-sum(t,data(t,'lambda_e')*Pe_s(t))=l=OF_b+beta*abs(OF_b);``
Hope this helps

Cheers
Renger

priyanka_shinde
User
Posts: 5
Joined: 4 months ago

### Re: Uncertainty modelling

Dear Renger,

Thank you for your help. But I am still getting error, actually I want to check the constraint 'igdt_constraint(t)' for each value of t

igdt_constraint(t)..sum(t,lambda_g*Pg(t)) + sum(t,data(t,'lambda_e')*Pe_b(t))-sum(t,data(t,'lambda_e')*Pe_s(t))=l=-0.48+0.3*abs(-0.48);

So I want to remove summation over time t and check this constaint for every t. Is it possible?

My second doubt is that since RHS of the constraint is a constant value, is it possible to change igdt_constraint(t) into igdt_constraint (without any set )? if I do that then what happens to Pg(t), Pe_b(t) and Pe_s(t) ?

Can you please tell how to write this constraint?

Regards,
Priyanka

Renger
Posts: 113
Joined: 1 year ago

### Re: Uncertainty modelling

Hi Pryanka

You want also to sum up to t instead of summing over all t:
alias(t,tt);

igdt_constraint(t)..sum(tt\$(ord(tt) le ord(t)),lambda_g*Pg(tt)) + sum(tt\$(ord(tt) le ord(t)), data(tt,'lambda_e') * Pe_b(t)) - sum(tt\$(ord(tt) le ord(t)), data(t,'lambda_e')*Pe_s(t))=l=OF_b+beta*abs(OF_b);
Hope this helps

Cheers
Renger