Unit commitment and economic dispatch

Hi guys,
I am doing optimal economic dispatch of sources with regard maximum
profit. I decided to use the GAMS software at first. I built simple
model of it and run by GAMS, but it still shows me 2 errors. Here is
my code:

Sets
n “number of generators” /14/
t “number of time windows” /1
3/
head “head of table” /up_bound, lo_bound, prize, fix_cost, dep_cost/;
Parameters P_doh(t) contracted amount of power
/1 3510, 2 2720, 3 510/
Table Par(n,head) “generators parameters”
up_bound lo_bound prize fix_cost
dep_cost
1 1200 0 97.98e-3 10
14.4625e-3
2 1800 900 129.44e-3 30
50.575e-3
3 200 0 58.6e-3
0 0
4 5000 0 0
0 1500e-3;
Variables
P(n,t) power of n-th generator in time t
Z profit from selling energy;
P.up(n,t) = Par(n,“up_bound”);
P.lo(n,t) = Par(n,“lo_bound”);
Equations
Obj objective function
GenLow(n,t) lower bound
GenUp(n,t) upper bound
SysBal(n,t) power balance equation;
Obj…Z=e=sum((n,t),Par(n,“prize”)*P(n,t)-
Par(n,“dep_cost”)*P(n,t)-Par(n,“fix_cost”));
GenLow(n,t) … P(n,t) =g= Par(n,“lo_bound”);
GenUp(n,t) … P(n,t) =l= Par(n,“up_bound”);
SysBal (n,t)… sum((n),P(n,t))-P_doh(t)=e=0;
Model VPP “controling OZE” /all/;
solve VPP using mip maximizing Z;

And here is GAMS report:
GAMS Rev 238 WIN-VS8 23.8.2 x86/MS Windows 06/21/12
11:55:30 Page 1
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
C o m p i l a t i o n


1 Sets
2 n “number of generators” /14/
3 t “number of time windows” /1
3/
4 head “head of table” /up_bound, lo_bound, prize, fix_cost,
dep_cost/;
5 Parameters P_doh(t) contracted amount of power
6 /1 3510, 2 2720, 3 510/
7 Table Par(n,head) “generators parameters”
8 up_bound lo_bound prize
fix_cost dep_
cost
9 1 1200 0 97.98e-3
10 14.4
625e-3
10 2 1800 900 129.44e-3
30 50.5
75e-3
11 3 200 0 58.6e-3
0 0
12 4 5000 0 0
0 1500
e-3;
13 Variables
14 P(n,t) power of n-th generator in time t
15 Z profit from selling energy;
16 P.up(n,t) = Par(n,“up_bound”);
17 P.lo(n,t) = Par(n,“lo_bound”);
18 Equations
19 Obj objective function
20 GenLow(n,t) lower bound
21 GenUp(n,t) upper bound
22 SysBal(n,t) power balance equation;
23 Obj…Z=e=sum((n,t),Par(n,“prize”)*P(n,t)-
Par(n,“dep_cost”)*P(n,t)
-Par(n,“fix_cost”));
24 GenLow(n,t) … P(n,t) =g= Par(n,“lo_bound”);
25 GenUp(n,t) … P(n,t) =l= Par(n,“up_bound”);
26 SysBal (n,t)… sum((n),P(n,t))-P_doh(t)=e=0;
**** $125
27 Model VPP “controling OZE” /all/;
28 solve VPP using mip maximizing Z;
**** $257
GAMS Rev 238 WIN-VS8 23.8.2 x86/MS Windows 06/21/12
11:55:30 Page 2
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
Error Messages


125 Set is under control already
257 Solve statement not checked because of previous errors

**** 2 ERROR(S) 0 WARNING(S)


COMPILATION TIME = 0.000 SECONDS 3 Mb WIN238-238 Apr
3, 2012

I suspect that something is wrong with power balance equation but I
have no idea what. I will appreciate it very much for your warm help.
Please feel free to contact me.

Thank you in advance. Jan

\

Hi Ján!!!

In your system balance equation, what you want to do is the sum(n,…) for all your set t. Thus your equation must be defined as SysBal(t) and not like you has. It should work now.

Cheers!

2012/6/21 Ján Ivanecký

Hi guys,
I am doing optimal economic dispatch of sources with regard maximum
profit. I decided to use the GAMS software at first. I built simple
model of it and run by GAMS, but it still shows me 2 errors. Here is
my code:

Sets
n “number of generators” /14/
t “number of time windows” /1
3/
head “head of table” /up_bound, lo_bound, prize, fix_cost, dep_cost/;
Parameters P_doh(t) contracted amount of power
/1 3510, 2 2720, 3 510/
Table Par(n,head) “generators parameters”
up_bound lo_bound prize fix_cost
dep_cost
1 1200 0 97.98e-3 10
14.4625e-3
2 1800 900 129.44e-3 30
50.575e-3
3 200 0 58.6e-3
0 0
4 5000 0 0
0 1500e-3;
Variables
P(n,t) power of n-th generator in time t
Z profit from selling energy;
P.up(n,t) = Par(n,“up_bound”);
P.lo(n,t) = Par(n,“lo_bound”);
Equations
Obj objective function
GenLow(n,t) lower bound
GenUp(n,t) upper bound
SysBal(n,t) power balance equation;
Obj…Z=e=sum((n,t),Par(n,“prize”)*P(n,t)-
Par(n,“dep_cost”)*P(n,t)-Par(n,“fix_cost”));
GenLow(n,t) … P(n,t) =g= Par(n,“lo_bound”);
GenUp(n,t) … P(n,t) =l= Par(n,“up_bound”);
SysBal (n,t)… sum((n),P(n,t))-P_doh(t)=e=0;
Model VPP “controling OZE” /all/;
solve VPP using mip maximizing Z;

And here is GAMS report:
GAMS Rev 238 WIN-VS8 23.8.2 x86/MS Windows 06/21/12
11:55:30 Page 1
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
C o m p i l a t i o n


1 Sets
2 n “number of generators” /14/
3 t “number of time windows” /1
3/
4 head “head of table” /up_bound, lo_bound, prize, fix_cost,
dep_cost/;
5 Parameters P_doh(t) contracted amount of power
6 /1 3510, 2 2720, 3 510/
7 Table Par(n,head) “generators parameters”
8 up_bound lo_bound prize
fix_cost dep_
cost
9 1 1200 0 97.98e-3
10 14.4
625e-3
10 2 1800 900 129.44e-3
30 50.5
75e-3
11 3 200 0 58.6e-3
0 0
12 4 5000 0 0
0 1500
e-3;
13 Variables
14 P(n,t) power of n-th generator in time t
15 Z profit from selling energy;
16 P.up(n,t) = Par(n,“up_bound”);
17 P.lo(n,t) = Par(n,“lo_bound”);
18 Equations
19 Obj objective function
20 GenLow(n,t) lower bound
21 GenUp(n,t) upper bound
22 SysBal(n,t) power balance equation;
23 Obj…Z=e=sum((n,t),Par(n,“prize”)*P(n,t)-
Par(n,“dep_cost”)*P(n,t)
-Par(n,“fix_cost”));
24 GenLow(n,t) … P(n,t) =g= Par(n,“lo_bound”);
25 GenUp(n,t) … P(n,t) =l= Par(n,“up_bound”);
26 SysBal (n,t)… sum((n),P(n,t))-P_doh(t)=e=0;
**** $125
27 Model VPP “controling OZE” /all/;
28 solve VPP using mip maximizing Z;
**** $257
GAMS Rev 238 WIN-VS8 23.8.2 x86/MS Windows 06/21/12
11:55:30 Page 2
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
Error Messages


125 Set is under control already
257 Solve statement not checked because of previous errors

**** 2 ERROR(S) 0 WARNING(S)


COMPILATION TIME = 0.000 SECONDS 3 Mb WIN238-238 Apr
3, 2012

I suspect that something is wrong with power balance equation but I
have no idea what. I will appreciate it very much for your warm help.
Please feel free to contact me.

Thank you in advance. Jan


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

\

To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

Thank you Sérgio,
Program was compilated without errors now. But offered results seem
strange! As you can see (below) for contracted amount of power at time
window 3, the program computed the negative value of power for source
1 (what is physical nonsense). In spite of bounds (power limits) are
treated as variables P.up(n,t) = Par(n,“up_bound”); P.lo(n,t) =
Par(n,“lo_bound”); with specified lower and upper bounds according to
table Par(n, head). That means that program did not respect the bounds
(feasible region). Why it happened? How to treat this problem? Thank
you in advance for your warm help.
Kindly, Jan

VAR P power of n-th generator in time t

LOWER LEVEL UPPER MARGINAL

1.1 . 1200.000 1200.000 EPS
1.2 . 1200.000 1200.000 EPS
1.3 . -390.000 1200.000 1.000 INFES
2.1 900.000 1800.000 1800.000 EPS
2.2 900.000 1520.000 1800.000 .
2.3 900.000 900.000 1800.000 2.000 INFES
3.1 . 200.000 200.000 EPS
3.2 . . 200.000 EPS
3.3 . . 200.000 2.000 INFES
4.1 . 310.000 5000.000 .
4.2 . . 5000.000 EPS
4.3 . . 5000.000 2.000 INFES

LOWER LEVEL UPPER MARGINAL

---- VAR Z -INF 780.000 +INF .

Z profit from selling energy


**** REPORT SUMMARY : 0 NONOPT
5 INFEASIBLE (INFES)
SUM 780.000
MAX 390.000
MEAN 156.000
0 UNBOUNDED

\

Hi Ján!!

Are you sure that your parameter values P_doh(t) is right? Because the problem is that equation balance gives an infeasible solution for P_doh(3). The value 510 is a small value that will not be able to meet your power balance constraint. Try to change that vale and you will see that it works good.

Cheers
Sérgio

2012/6/22 Ján Ivanecký

Thank you Sérgio,
Program was compilated without errors now. But offered results seem
strange! As you can see (below) for contracted amount of power at time
window 3, the program computed the negative value of power for source
1 (what is physical nonsense). In spite of bounds (power limits) are
treated as variables P.up(n,t) = Par(n,“up_bound”); P.lo(n,t) =
Par(n,“lo_bound”); with specified lower and upper bounds according to
table Par(n, head). That means that program did not respect the bounds
(feasible region). Why it happened? How to treat this problem? Thank
you in advance for your warm help.
Kindly, Jan

VAR P power of n-th generator in time t

LOWER LEVEL UPPER MARGINAL

1.1 . 1200.000 1200.000 EPS
1.2 . 1200.000 1200.000 EPS
1.3 . -390.000 1200.000 1.000 INFES
2.1 900.000 1800.000 1800.000 EPS
2.2 900.000 1520.000 1800.000 .
2.3 900.000 900.000 1800.000 2.000 INFES
3.1 . 200.000 200.000 EPS
3.2 . . 200.000 EPS
3.3 . . 200.000 2.000 INFES
4.1 . 310.000 5000.000 .
4.2 . . 5000.000 EPS
4.3 . . 5000.000 2.000 INFES

LOWER LEVEL UPPER MARGINAL

---- VAR Z -INF 780.000 +INF .

Z profit from selling energy


**** REPORT SUMMARY : 0 NONOPT
5 INFEASIBLE (INFES)
SUM 780.000
MAX 390.000
MEAN 156.000
0 UNBOUNDED


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

\

To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

Hi Ján

Part of the problem is in your “unit commitment” formulation.
The lower bound on the production of the second unit is 900MW, which
is higher than the contracted level of power in time 3 (which is
510MW)
Hence the infeasibility .

You declared your problem as a MIP although, as you stated it, it is
pure LP.
Typically, in a unit commitment problem, you should include binary
variables U(n,t) indicating whether or not the unit n is committed to
supply power at time t.
And this would then result in constraints of the type:

GenLow(n,t) … P(n,t) =g= U(n,t) * Par(n,“lo_bound”);
GenUp(n,t) … P(n,t) =l= U(n,t) * Par(n,“up_bound”);

where the generated power would be constrained by “lo_bound” and
“up_bound” if and only if the unit is committed (i.e. only when U(n,t)
= 1).
Then this would make your problem a true MIP. And this would also
avoid the kind of inconsistent results you reported.

Hope this helps
cheers
dax

\

Thanks a lot guys for your very useful advices to solve my problem.
I found now that using binary variables is necessity. I will continue in my problem to make it more complex (ramp constraints, up and down time constrains, energy constraints…).
I appreciate your warm help and hope that I will need it still less and less.
Cheers, Jan


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/pbXYlb7lnIIJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

Dear Jan

I want to start optimization with Gams for Unitcommitment,if is
possible send to me sample unitcommitment problems that optimization
with GAMS?

REGARSD

On 6/26/12, Ján Ivanecký wrote:

Thanks a lot guys for your very useful advices to solve my problem.
I found now that using binary variables is necessity. I will continue in my

problem to make it more complex (ramp constraints, up and down time
constrains, energy constraints…).
I appreciate your warm help and hope that I will need it still less and
less.
Cheers, Jan


“gamsworld” group.
To view this discussion on the web visit
https://groups.google.com/d/msg/gamsworld/-/pbXYlb7lnIIJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to
gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/gamsworld?hl=en.


\