ASSIGMENT 3
Name: Aaina Jain
Student ID: 2022UEE1052
Batch: E2
Q1. The fuel-cost function for three thermal plants in Rs./h are given by:
C1 = 500 + 5.3P1 + 0.004 P12
C2 = 400 + 5.5P2 + 0.006 P22
C3 = 200 + 5.8P3 + 0.009 P32
Where P1, P2 and P3 are in MW. The total load, PD is 800 MW. Neglecting line losses and generator limits,
find the optimal dispatch and the total cost in Rs./h. (a) by analytical method. (b) by graphical
demonstration. (c) by gradient method
Ans. CODE:
clc
clear
% Iterative solution Using Newton method
alpha =[500; 400; 200];
beta = [5.3; 5.5; 5.8]; gama=[.004; .006; .009];
PD=800;
DelP = 10; % Error in DelP is set to a high value
lambda = input('Enter estimated value of Lambda = ');
fprintf('\n ')
disp([' Lambda P1 P2 P3 DP'...
' grad Delambda'])
iter = 0; % Iteration counter
while abs(DelP) >= 0.001 % Test for convergence
iter = iter + 1; % No. of iterations
P = (lambda - beta)./(2*gama);
DelP =PD - sum(P); % Residual
J = sum( ones(length(gama), 1)./(2*gama)); % Gradient sum
Delambda = DelP/J; % Change in variable
disp([lambda, P(1), P(2), P(3), DelP, J, Delambda])
lambda = lambda + Delambda; % Successive solution
end
totalcost = sum(alpha + beta.*P + gama.*P.^2);
disp(totalcost);
%Graphical Demonstration of Example 7.4
axis([0 450 6.5 10.5]);
P1=250:10:450; P2 = 150:10:350; P3=100:10:250;
IC1= 5.3 + 0.008*P1;
IC2= 5.5 + 0.012*P2;
IC3= 5.8 + 0.018*P3;
Px = 0:100:400;
plot(P1, IC1, P2, IC2, P3, IC3, Px, lambda*ones(1, length(Px)),'-m'),
xlabel('P, MW'), ylabel(' $/MWh'), grid
OUTPUT:
Enter estimated value of Lambda = 6
Lambda P1 P2 P3 DP grad Delambda
6.0000 87.5000 41.6667 11.1111 659.7222 263.8889 2.5000
8.5000 400.0000 250.0000 150.0000 0 263.8889 0
6.6825e+03
Q2. Find the optimal dispatch iteratively using gradient method and the total cost in Rs./h for the thermal
plants of the above example, when the total load is 975 MW with the following generator limits (in MW):
200 ≤ P1 ≤ 450
150 ≤ P2 ≤ 350
100 ≤ P3 ≤ 225
Ans. CODE:
clc;clear;
alpha = [500; 400; 200];
beta = [5.3; 5.5; 5.8];
gamma = [ 0.004; 0.006; 0.009];
pd = 975;
pmin = [200; 150; 100];
pmax = [450; 350; 225];
delp = 10;
lambda = input("enter estimated value of lambda = ");
fprintf('\n');
disp("iter lambda p1 p2 p3 dp grad")
iter = 0;
while abs(delp)>= 0.001
iter = iter +1;
p = (lambda - beta)./(2*gamma);
for i= 1:length(p)
if p(i)<pmin(i)
p(i)=pmin(i);
elseif p(i)>pmax(i)
p(i)=pmax(i);
end
end
delp = pd - sum(p);
j = sum(ones(length(gamma),1)./(2*gamma));
delambda = delp/j;
disp([iter,lambda,p(1),p(2),p(3),delp,j,delambda ...
])
lambda = lambda + delambda;
end
totalcost = sum(alpha + beta.*p +gamma.*p.^2);
fprintf("totalcost = %f (rs/hr) \n",totalcost)
OUTPUT:
enter estimated value of lambda = 6
iter lambda p1 p2 p3 dp grad
1.0000 6.0000 200.0000 150.0000 100.0000 525.0000 263.8889 1.9895
2.0000 7.9895 336.1842 207.4561 121.6374 309.7222 263.8889 1.1737
3.0000 9.1632 450.0000 305.2632 186.8421 32.8947 263.8889 0.1247
4.0000 9.2878 450.0000 315.6510 193.7673 15.5817 263.8889 0.0590
5.0000 9.3469 450.0000 320.5715 197.0477 7.3808 263.8889 0.0280
6.0000 9.3748 450.0000 322.9023 198.6015 3.4962 263.8889 0.0132
7.0000 9.3881 450.0000 324.0064 199.3376 1.6561 263.8889 0.0063
8.0000 9.3944 450.0000 324.5293 199.6862 0.7845 263.8889 0.0030
9.0000 9.3973 450.0000 324.7770 199.8514 0.3716 263.8889 0.0014
10.0000 9.3987 450.0000 324.8944 199.9296 0.1760 263.8889 0.0007
11.0000 9.3994 450.0000 324.9500 199.9666 0.0834 263.8889 0.0003
12.0000 9.3997 450.0000 324.9763 199.9842 0.0395 263.8889 0.0001
13.0000 9.3999 450.0000 324.9888 199.9925 0.0187 263.8889 0.0001
14.0000 9.3999 450.0000 324.9947 199.9965 0.0089 263.8889 0.0000
15.0000 9.4000 450.0000 324.9975 199.9983 0.0042 263.8889 0.0000
16.0000 9.4000 450.0000 324.9988 199.9992 0.0020 263.8889 0.0000
17.0000 9.4000 450.0000 324.9994 199.9996 0.0009 263.8889 0.0000
totalcost = 8236.241147 (rs/hr)
Q3. The fuel-cost of three thermal plants of a power system are:
C1 = 200 + 7.0 P1 + 0.008 P12
C2 = 180 + 6.3 P2 + 0.009 P22
C3 = 140 + 6.8 P3 + 0.007 P32
where P1, P2 and P3 are in MW. Plant outputs are subject to the following limits (in MW)
10 ≤ P1 ≤ 85
10 ≤ P2 ≤ 80
10 ≤ P3 ≤ 70
For this problem, assume the real power loss is given by the simplified expression:
PL (pu) = 0.0218 P12 (pu) + 0.0228 P22 (pu) + 0.0179 P32 (pu)
where the loss coefficients are specified in per unit on a 100 MVA base. Determine the optimal dispatch of
generation when the total system load is 150 MW iteratively using gradient method.
Ans. CODE:
clc;
clear;
alpha = [ 200; 180; 140];
beta = [7; 6.3; 6.8];
gama = [0.008; 0.009; 0.007];
pmax = [85; 80; 70];
pmin = [10; 10; 10];
pd = 150;
n = 3;
base_mva = 100;
pl = [0.0218; 0.0228;0.0179]/base_mva;
delp = 10;
iter = 0;
lambda = input("enter the initial estimate of lambda = ");
fprintf("\n")
disp("iter lambda p1 p2 p3 dp dellambda")
while abs(delp)>= 0.0001 & iter<200
iter = iter +1;
for i = 1:n
p(i,1) = (lambda- beta(i))./(2*(gama(i)+lambda*pl(i)));
end
for i = i:n
if p(i)<pmin(i)
p(i)=pmin(i);
elseif p(i)>pmax(i)
p(i)=pmax(i);
end
end
ploss = sum(pl.*(p.^2));
delp = pd +ploss -sum(p);
for i = 1:n
k(i) = (gama(i)+pl(i)*beta(i))/(2*(gama(i)+lambda*pl(i))^2);
end
dellambda = delp/sum(k);
disp([iter,lambda,p(1),p(2),p(3),delp,dellambda])
lambda = lambda +dellambda;
end
totalcost = sum(alpha +beta.*p +gama.*p.^2);
fprintf("total cost =%f (rs/hr) \n",totalcost);
OUTPUT:
enter the initial estimate of lambda = 10
iter lambda p1 p2 p3 dp dellambda
1.0000 10.0000 147.3477 164.0071 70.0000 -219.6118 -1.5670
2.0000 8.4330 72.8268 97.6404 70.0000 -86.2602 -0.5763
3.0000 7.8567 44.1028 72.1283 62.8525 -26.7662 -0.1744
4.0000 7.6823 35.2608 64.2827 52.6725 -0.5062 -0.0033
5.0000 7.6790 35.0942 64.1349 52.4807 -0.0105 -0.0001
6.0000 7.6789 35.0907 64.1318 52.4768 -0.0002 -0.0000
7.0000 7.6789 35.0907 64.1318 52.4767 -0.0000 -0.0000
total cost =1592.649583 (rs/hr)