Demo of Unit commitment
Set
t time /112/
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’;
Demo.xlsx (13.9 KB)