Infeasible solution for Hydro Optimization Problem

Problems with syntax of GAMS
Post Reply
priyamjain123
User
User
Posts: 1
Joined: 1 month ago

Infeasible solution for Hydro Optimization Problem

Post by priyamjain123 » 1 week ago

*Demo of Unit commitment
Set
t time /1*12/
g plants
n maximum number of units /1*4/
;

Parameters Data (g,*), Demanddata (t,*), Availableunits (g,t);
$Call GDXXRW Demo.xlsx set=g RDim=1 rng=Data!a2:a4 par=Data RDim=1 CDim=1 rng=Data!a1:f20 par=Demanddata RDim=1 CDim=1 rng=Data!I1:K13 par=Availableunits RDim=1 CDim=1 rng=DC!A1:M4
$GDXIN Demo.gdx
$LOAD g Data Demanddata Availableunits
$GDXIN

Parameters
Energy (g) Total Energy of plant
Demand (t) Time block wise demand
Differential (t) Demand differential
totalnumberofunits (g) Total units in a plant
Plantcapacity (g) Capacity of plant
unitcapacity (g) Capacity of unit of a plant
P3 (g) Minimum generation limit
P4 (g) Maximum generation limit to maintain reserves
capacity (g,t,n) Capacity of all the units of a plant
P3capacity (g,t,n) P3 Capacity of all the units in a plant
P4capacity (g,t,n) P4 Capacity of all the units in a plant
;

*Parameter assignment

Energy(g) = Data (g, "Energy");
totalnumberofunits (g) = Data (g, "Totalunits");
unitcapacity (g) = Data (g, "Ucapacity");
Demand (t) = Demanddata (t, "Demand");
Differential (t) = Demanddata (t, "Differential");
Plantcapacity (g) = unitcapacity (g)*totalnumberofunits (g);
P3 (g) = Data (g, "P3");
P4 (g) = Data (g, "P4");

*Unit capacity, P3, P4 assignment

Loop (g,

loop ((n)$(ord(n) < totalnumberofunits (g)+1),
capacity (g,t,n) = unitcapacity (g);
P3capacity (g,t,n) = P3 (g);
P4capacity (g,t,n) = P4 (g);
);

);

display g, Energy, totalnumberofunits, Plantcapacity, unitcapacity, demand, Differential, capacity, availableunits;

positive variables
unitgeneration (g,t,n) Unit wise generation
plantgeneration (g,t) Plant wise generation
;

unitgeneration.lo(g,t,n) = 0;

Variable X
;




Equations

Energylim(g) Total energy
Plantgen (g,t) Plant Generation should be equal to sum of generation of all its units
Unitmaxgen(g,t,n) Unit maximum generation limit for units in service
Unit_outmaxgen(g,t,n) Unit maximum generation limit for units out of service
Unitmingen (g,t,n) Unit minimum
Objfn

;

*Equations

Unitmaxgen (g,t,n)$(ord(n)<availableunits(g,t)+1).. unitgeneration(g,t,n) =l= P4capacity (g,t,n);
Unit_outmaxgen (g,t,n)$(ord(n)>availableunits(g,t)).. unitgeneration(g,t,n) =e= 0;
Unitmingen (g,t,n)$(ord(n)<availableunits(g,t)+1).. unitgeneration(g,t,n) =g= P3capacity (g,t,n);
Plantgen(g,t).. plantgeneration (g,t) =e= sum (n, unitgeneration (g,t,n));
Energylim(g).. Sum(t, plantgeneration(g,t)) =e= Energy (g);
objfn.. X =e= Sum((g,t),plantgeneration(g,t)*demand(t)) + Sum((g,t),plantgeneration(g,t)*differential(t));
*objfn.. X =e= Sum((g,t),plantgeneration(g,t)*demand(t)) ;

Model POSOCO /All/;

Solve POSOCO using nlp maximizing X;

Display unitgeneration.l, plantgeneration.l;

Parameters TotalGeneration(t);

TotalGeneration(t) = Sum(g,plantgeneration.l(g,t));

EXECUTE_UNLOAD 'Summary', TotalGeneration;
EXECUTE 'GDXXRW Summary.gdx par=TotalGeneration rng=Output!A5 o=Demo.xlsx';
Attachments
Demo.xlsx
(13.89 KiB) Downloaded 1 time

User avatar
gamsadmin
Site Admin
Site Admin
Posts: 11
Joined: 2 years ago

Re: Infeasible solution for Hydro Optimization Problem

Post by gamsadmin » 1 week ago

Hi

If you check your output, you will see that two of the energylim equations are limited.
You limit the total production by P4capacity, so there be at least enough capacity to produce energy(g).
However, There is no feasible solution because the maximum capacity is less than the demand

Cheers
Renger
PS. Next time, please either attach your gams file or put the code between the code tags (use the "</>"-symbol to insert these tags).

Code: Select all

parameter check;

check(g) = sum((t,n), P4capacity(g,t,n)) - energy(g);
display check;


----     90 PARAMETER check  

G1   60.000,    G2 -120.000,    G3 -640.000



Post Reply