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” /1*4/
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” /1*4/
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

\