regarding equations Topic is solved

Problems with modeling
Post Reply
ravi9177
User
User
Posts: 4
Joined: 2 years ago

regarding equations

Post by ravi9177 »

please let me know how can we give the following equation in GAMS.
WhatsApp Image 2022-04-04 at 11.00.28 AM.jpeg
User avatar
bussieck
Moderator
Moderator
Posts: 1042
Joined: 7 years ago

Re: regarding equations

Post by bussieck »

That's too little information. What is a constant, what is a variable? In order to get help try to send a working GAMS source example that has most of this implemented, just the bit that is unclear.

-Michael
ravi9177
User
User
Posts: 4
Joined: 2 years ago

Re: regarding equations

Post by ravi9177 »

Hii ,
sets t,
parameters E(t), P(t), V(t) and below is the model


Code: Select all

Scalar V0 cutin wind speed /4/
       Vn  rated wind speed /7/
       Vmax cutout or maximum wind speed /25/
       Pr rated wind power /100000/
       P_der rated diesel generator power /4000/ ;




Variables
   P_pv(t)     power from pv cell
   N_pv     number of pv cells
   Nt number of wind turbines
  P_ES(t) Battery power
    w annual cost of the system
   SOC(t) state of charge
   C_ES(t) energy storage
   E_b battery size
   Pwt(t) wind power
   Nt number wind turbines
   P_de(t) deisel power
N_de No of deisel engines
F(t) fuel consumption;


Equations
eq1(t) 'Total load demand '
eq2(t) 'lower limit of number of pv panels'
eq3(t) 'upper limit of number of pv panels'
eq5(t) 'energy storage'
eq6(t) 'state of charge'
eq7(t) 'lower limit of soc'
eq8(t) 'upper limit of soc'
eq9(t) 'solar power'
eq10(t) 'energy storage lower limit'
eq11(t) 'energy storage upper limit'
eq12(t) 'battery power lower limit'
eq13(t) 'battery power upper limit'
eq14(t)
eq15(t)
eq16(t)
eq17(t)
eq21(t)
eq22(t)
eq23(t)
eq24(t)
eq29(t),

obj ;

eq1(t)..  P(t)=e=P_pv(t)+P_ES(t)+Pwt(t)+ P_de(t);
eq2(t)..  N_pv=g=0;
eq3(t)..  N_pv=l=9850;
eq5(t)..  C_ES(t) =e= (C_ES(t-1)*(1-0.05))+(P(t)-P_pv(t)-Pwt(t)-P_de(t));
eq6(t)..  SOC(t)*E_b =e= (C_ES(t));
eq7(t)..  SOC(t) =g= 0.1;
eq8(t)..  SOC(t) =l= 0.9;
eq9(t)..  P_pv(t) =e= 0.3*N_pv*E(t);
eq10(t).. E_b =g= 1000;
eq11(t).. E_b =l= (4690000);
eq12(t).. P_ES (t) =g= -325000;
eq13(t).. P_ES (t) =l= 250000;
eq14(t).. Pwt(t) =e= (Nt*Pr*((V(t)*V(t)*V(t))-(V0*V0*V0))/((Vn*Vn*Vn)-(V0*V0*V0)))$((V0 le V(t)) and ((V(t)<Vn)) );
eq15(t).. Pwt(t) =e= Nt*Pr $((Vn le V(t)) and ((V(t)<Vmax)) ) ;
eq16(t).. Nt=g=0;
eq17(t).. Nt=l=10;
eq21(t).. N_de =g= 0;
eq22(t).. N_de =l= 10;
eq23(t).. P_de(t) =l= 100000*N_de;
eq24(t).. P_de(t) =g= 20000*N_de;
eq29(t).. F(t) =e= (0.2*1e-3*P_de(t)) + (0.08*1e-3*N_de * P_der);

obj.. (0.1009*(10000*N_pv + 1000*E_b + Nt*225000)) + (150*E_b+ 100*Nt + sum(t,F(t)*95))
 + (5*(100*E_b *0.1674))=e= w ;

model MG2 /all/;
solve MG2  using nlp minimizing w;
display  w.l,N_pv.l,E_b.l,Nt.l,N_de.l;
ravi9177
User
User
Posts: 4
Joined: 2 years ago

Re: regarding equations

Post by ravi9177 »

i have problem with eq14 and eq15. please help me sir.
ravi9177
User
User
Posts: 4
Joined: 2 years ago

Re: regarding equations

Post by ravi9177 »

hello sir, Below is the complete file and i have problem with eq14 and 15
ravi.gms
(450.79 KiB) Downloaded 97 times
User avatar
bussieck
Moderator
Moderator
Posts: 1042
Joined: 7 years ago

Re: regarding equations

Post by bussieck »

I don't quite see the similarity in your code vs the algebra you pasted, but the condition when P_WT or Pwt(t) in your model should be equal are all exogenous, hence you can have three constraints (I see only two constrains in your model) that have the condition attached to the equations and if the condition is exclusive, then you will fall into one of these cases:

Code: Select all

eq14(t)$((V0 le V(t)) and ((V(t)<Vn)) ).. Pwt(t) =e= (Nt*Pr*((V(t)*V(t)*V(t))-(V0*V0*V0))/((Vn*Vn*Vn)-(V0*V0*V0)));
eq15(t)$((Vn le V(t)) and ((V(t)<Vmax)) ).. Pwt(t) =e= Nt*Pr ;
-Michael
Post Reply