0% found this document useful (0 votes)
3 views8 pages

Power Generation Cost Optimization

The document contains code that generates power outputs (Pg) for 10 generators across 3 time periods, calculates the total cost for each generator based on its power output, and finds the minimum (best) total cost. It: 1) Initializes variables and generates random power outputs for each generator and time period. 2) Iteratively adjusts the power outputs to satisfy constraints. 3) Calculates the total cost for each generator based on its power output values. 4) Finds and reports the minimum (best) total cost.

Uploaded by

Sampurna Das
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views8 pages

Power Generation Cost Optimization

The document contains code that generates power outputs (Pg) for 10 generators across 3 time periods, calculates the total cost for each generator based on its power output, and finds the minimum (best) total cost. It: 1) Initializes variables and generates random power outputs for each generator and time period. 2) Iteratively adjusts the power outputs to satisfy constraints. 3) Calculates the total cost for each generator based on its power output values. 4) Finds and reports the minimum (best) total cost.

Uploaded by

Sampurna Das
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

clear all;

clc;
PD=850;
ng=3;
np=10;
Pgmax=[800 1200 1100];
Pgmin=[320 300 275];
a=[0.001562 0.00194 0.00482];
b=[7.92 7.85 7.97];
c=[561 310 78];
Pg=zeros(10,6);
costm=zeros(1,30);
set=zeros(1,30);
for iter=1:100
for i=1:10
for j=1:3
Pg(i,j)=(rand-(1/2))*(Pgmax(j)Pgmin(j))+(1/2)*(Pgmax(j)+Pgmin(j));
end
end
end
Pg
for i=1:1:20
ng1=round(rand*(ng-1))+1;
for k=1:1:10
p=0;
for j=1:1:3
if j==1 break;
end
P=p+Pg(k,j);
end
for j=ng1+1:1:3
P=p+Pg(k,j);
end
Pg(k,ng1)=PD-P;
if Pg(k,ng1)==Pgmax(1,ng1);
else if Pg(k,ng1)< Pgmin(1,ng1)
Pg(k,ng1)=Pgmin(1,ng1);
end
end
end
Pg
cost=zeros(np,1);
for k=1:1:np
cost(k)=0;
for i=1:ng
cost(k)=cost(k)+c(i)+b(i)*Pg(k,i)+a(i)*Pg(k,i)^2;
end
end
end
cost
bestcost=min(cost)

RESULT :
Pg =
1.0e+003 *
0.4711
0.6995
0.3452
0.7741
0.5648
0.3572
0.4978
0.5683
0.5110
0.6789

0.9541
0.4840
1.0211
0.3824
0.8534
1.0656
0.8602
1.1915
0.9269
0.6784

0.7005
0.8344
0.8348
1.0245
0.5358
0.3942
1.0980
0.4619
0.3283
0.9443

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

0.7005
0.8344
0.8348
1.0245
0.5358
0.3942
1.0980
0.4619
0.3283
0.9443

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

0.7005
0.8344
0.8348
1.0245
0.5358
0.3942
1.0980
0.4619
0.3283

0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0

Pg =
1.0e+003 *
0.4711
0.6995
0.3452
0.7741
0.5648
0.3572
0.4978
0.5683
0.5110
0.6789

0.3000
0.3000
0.3000
0.3000
0.3142
0.4558
0.3000
0.3881
0.5217
0.3000

Pg =
1.0e+003 *
0.4711
0.6995
0.3452
0.7741
0.5648
0.3572
0.4978
0.5683
0.5110

0.3000
0.3000
0.3000
0.3000
0.3142
0.4558
0.3000
0.3881
0.5217

0.6789 0.3000 0.9443

Pg =
471.0961
699.5096
345.1931
774.0843
564.7775
357.1940
497.8332
568.3252
511.0425
678.8776

300.0000
300.0000
300.0000
300.0000
314.2413
455.7653
300.0000
388.1091
521.6714
300.0000

275.0000
275.0000
275.0000
275.0000
275.0000
275.0000
275.0000
275.0000
275.0000
275.0000

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

575.0000
575.0000
575.0000
575.0000
575.0000
575.0000
575.0000
575.0000
575.0000
575.0000

275.0000
275.0000
275.0000
275.0000
275.0000
275.0000
275.0000
275.0000
275.0000
275.0000

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

575.0000
575.0000
575.0000
575.0000
575.0000
575.0000
575.0000
575.0000
575.0000
575.0000

275.0000
275.0000
275.0000
275.0000
275.0000
275.0000
275.0000
275.0000
275.0000
275.0000

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

Pg =
471.0961
699.5096
345.1931
774.0843
564.7775
357.1940
497.8332
568.3252
511.0425
678.8776

Pg =
471.0961
699.5096
345.1931
774.0843
564.7775
357.1940
497.8332
568.3252
511.0425
678.8776

Pg =

575
575
575
575
575
575
575
575
575
575

575
575
575
575
575
575
575
575
575
575

275
275
275
275
275
275
275
275
275
275

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

575
575
575
575
575
575
575
575
575
575

275
275
275
275
275
275
275
275
275
275

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

575
575
575
575
575
575
575
575
575
575

275
275
275
275
275
275
275
275
275
275

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

575 575 275


575 575 275
575 575 275

0
0
0

0
0
0

0
0
0

Pg =
575
575
575
575
575
575
575
575
575
575

Pg =
575
575
575
575
575
575
575
575
575
575

Pg =

575
575
575
575
575
575
575

575
575
575
575
575
575
575

275
275
275
275
275
275
275

0
0
0
0
0
0
0

0
0
0
0
0
0
0

0
0
0
0
0
0
0

575
575
575
575
575
575
575
575
575
575

275
275
275
275
275
275
275
275
275
275

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

575
575
575
575
575
575
575
575
575
575

575
575
575
575
575
575
575
575
575
575

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

300
300
300
300
300
300
300

575
575
575
575
575
575
575

0
0
0
0
0
0
0

0
0
0
0
0
0
0

0
0
0
0
0
0
0

Pg =
575
575
575
575
575
575
575
575
575
575

Pg =
575
575
575
575
575
575
575
575
575
575

Pg =
575
575
575
575
575
575
575

575 300 575


575 300 575
575 300 575

0
0
0

0
0
0

0
0
0

Pg =
320
320
320
320
320
320
320
320
320
320

300
300
300
300
300
300
300
300
300
300

575
575
575
575
575
575
575
575
575
575

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

300
300
300
300
300
300
300
300
300
300

575
575
575
575
575
575
575
575
575
575

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

300
300
300
300
300
300
300
300
300
300

575
575
575
575
575
575
575
575
575
575

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

Pg =
320
320
320
320
320
320
320
320
320
320

Pg =
320
320
320
320
320
320
320
320
320
320

Pg =
320
320
320
320
320
320
320
320
320
320

300
300
300
300
300
300
300
300
300
300

275
275
275
275
275
275
275
275
275
275

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

575
575
575
575
575
575
575
575
575
575

275
275
275
275
275
275
275
275
275
275

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

575
575
575
575
575
575
575
575
575
575

275
275
275
275
275
275
275
275
275
275

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

320 575 275

Pg =
320
320
320
320
320
320
320
320
320
320

Pg =
320
320
320
320
320
320
320
320
320
320

Pg =

320
320
320
320
320
320
320
320
320

575
575
575
575
575
575
575
575
575

275
275
275
275
275
275
275
275
275

0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0

575
575
575
575
575
575
575
575
575
575

275
275
275
275
275
275
275
275
275
275

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0

Pg =
575
575
575
575
575
575
575
575
575
575

cost =
1.0e+004 *
1.3731
1.3731
1.3731
1.3731
1.3731
1.3731
1.3731
1.3731
1.3731
1.3731

bestcost =
1.3731e+004
>>

You might also like