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

Ilovepdf Merged

The document outlines a MATLAB script for performing Economic Load Dispatch calculations, detailing the power generation from multiple generators based on given cost coefficients and power demand. It includes iterations to adjust the Lagrange multiplier (lambda) to minimize operating costs while meeting power demand, displaying results such as total operating cost and power generation for each generator. The script also generates convergence plots to visualize the cost reduction over iterations.

Uploaded by

Hashua War
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views8 pages

Ilovepdf Merged

The document outlines a MATLAB script for performing Economic Load Dispatch calculations, detailing the power generation from multiple generators based on given cost coefficients and power demand. It includes iterations to adjust the Lagrange multiplier (lambda) to minimize operating costs while meeting power demand, displaying results such as total operating cost and power generation for each generator. The script also generates convergence plots to visualize the cost reduction over iterations.

Uploaded by

Hashua War
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

MATLAB Command Window Page 1

Enter the initial value of lambda: 10


Final value of lambda:
10.4787

Total operating cost:


8.2455e+03

Power generation for each generator:


442.5474 303.6059 150.0930

Total losses:
96.2465

Iteration Results:
1.0e+03 *

0.0103 0.3889 0.2547 0.1216 0.0716 7.0683


0.0104 0.4268 0.2893 0.1416 0.0886 7.8953
0.0105 0.4378 0.2992 0.1475 0.0939 8.1383
0.0105 0.4411 0.3023 0.1493 0.0955 8.2124
0.0105 0.4421 0.3032 0.1498 0.0960 8.2353
0.0105 0.4424 0.3035 0.1500 0.0962 8.2424
0.0105 0.4425 0.3036 0.1501 0.0962 8.2446
0.0105 0.4425 0.3036 0.1501 0.0962 8.2452
0.0105 0.4425 0.3036 0.1501 0.0962 8.2455
0.0105 0.4425 0.3036 0.1501 0.0962 8.2455
0.0105 0.4425 0.3036 0.1501 0.0962 8.2455
0.0105 0.4425 0.3036 0.1501 0.0962 8.2455
0.0105 0.4425 0.3036 0.1501 0.0962 8.2455

>>
Figure 1 : Convergence Characteristics graph of Economic Load Dispatch without losses

Figure 2 : Convergence Characteristics graph of Economic Load Dispatch with losses


5/11/24 6:32 PM C:\Users\mayan\Downloads\dfds.m 1 of 3

clc
clear all

% Define the cost coefficients for the generators


data = [510 7.2 0.00142;
310 7.85 0.00194;
18 7.97 0.0082];

% Extracting cost coefficients


A = data(:, 1);
Beta = data(:, 2);
G = data(:, 3);

% Define power generation limits for each generator


Pmax = [600, 400, 200];
Pmin = [150, 100, 50];

PD = 800; % Total power demand

% Define loss coefficients for the system


B1 = ([0.0218, 0.0093, 0.0028; % Loss coefficients matrix
0.0093, 0.0228, 0.0017;
0.0028, 0.0031, 0.0015]) / 100;

B2 = ([0.0003, 0.0031, 0.0015]); % Loss coefficients vector


B3 = 0.00030523; % Additional loss coefficient

% Input for initial value of lambda


L = input('Enter the initial value of lambda: ' );

% Define tolerance and initial power mismatch


E = 0.0001; % Tolerance for convergence
Pdel = 1; % Initial power mismatch

% Initialize iteration counter


iter = 0;

% Iteration until the power mismatch is within tolerance


while abs(Pdel) > E
iter = iter + 1; % Increment iteration count

%........ Power generation calculation..............%


for i = 1:3
% Calculate power output with loss
P(i) = (L - Beta(i)) / (2 * (G(i) + L * B1(i, i)));

% Check upper limit for power generation


P(i) = min(P(i), Pmax(i));
% Check lower limit for power generation
5/11/24 6:32 PM C:\Users\mayan\Downloads\dfds.m 2 of 3

P(i) = max(P(i), Pmin(i));


end
% Store power generation for each generator
P1gen(iter) = P(1);
P2gen(iter) = P(2);
P3gen(iter) = P(3);

%..... Loss calculation...............%


Loss1 = 0; % Initialize total transmission loss
for i = 1:3
for j = 1:3
Loss1 = Loss1 + P(i) * B1(i, j) * P(j); % Calculate transmission losses
end
end

Loss2 = 0; % Initialize additional loss


for m = 1:3
Loss2 = Loss2 + P(m) * B2(m); % Calculate additional losses
end

Loss3 = B3; % Additional constant loss


Loss = Loss1 + Loss2 + Loss3; % Total losses

% %.......... End of Loss calculation.......%

% Calculate power mismatch with losses


Pdel = PD + Loss - sum(P); % Power mismatch including losses

f = 0; % Initialize variable for correction in lambda


% %....... Calculation for the correction in Lambda and its update.......%
for l = 1:3
f = f + (1 / (2 * (G(l) + L * B1(l, l))));
end

% Calculate change in lambda


del_l = Pdel / f;

% Total power generated


Psum = sum(P);

% Update lambda based on power mismatch


if Psum > (PD + Loss) % If generated power exceeds demand plus losses
L = L - del_l; % Decrease lambda
elseif Psum < (PD + Loss) % If generated power is less than demand plus losses
L = L + del_l; % Increase lambda
end
% %.......... End of lambda update.......%

% %....... Calculation of total operating cost.......%


5/11/24 6:32 PM C:\Users\mayan\Downloads\dfds.m 3 of 3

for m = 1:3
C(m) = A(m) + (Beta(m) * P(m)) + (G(m) * (P(m)^2));
end

Cost(iter) = sum(C);
Lambda(iter) = L;
Totalloss(iter) = Loss;
end

% %........ Display of results and plot for convergence....%


disp('Final value of lambda: ');
disp(L); % Final value of lambda

disp('Total operating cost: ');


disp(sum(C)); % Total operating cost

disp('Power generation for each generator: ' );


disp(P); % Power generation for each generator

disp('Total losses: ');


disp(Loss); % Total losses

% Plotting the cost convergence


figure;
plot(Cost, 'LineWidth', 2); % Plot total cost against iterations
xlabel('Number of iterations');
ylabel('Cost ($)');
title('Convergence Plot of Total Cost' );

% Prepare results for display


result = [Lambda' P1gen' P2gen' P3gen' Totalloss' Cost'];
disp('Iteration Results:');
disp(result);
MATLAB Command Window Page 1

Enter the value of lambda=10


Final Lambda: 8.7045
Total Cost: 7292.7745
Generated Power:
529.7620 220.2381 50.0000

Iterations, Lambda, P1, P2, P3, Cost


1.0e+04 *

0.0010 0.0600 0.0400 0.0124 1.0232


0.0010 0.0600 0.0400 0.0109 1.0086
0.0009 0.0600 0.0400 0.0095 0.9951
0.0009 0.0600 0.0376 0.0082 0.9599
0.0009 0.0600 0.0326 0.0070 0.9035
0.0009 0.0600 0.0289 0.0061 0.8614
0.0009 0.0584 0.0260 0.0054 0.8155
0.0009 0.0558 0.0241 0.0050 0.7724
0.0009 0.0545 0.0232 0.0050 0.7528
0.0009 0.0538 0.0226 0.0050 0.7421
0.0009 0.0534 0.0224 0.0050 0.7363
0.0009 0.0532 0.0222 0.0050 0.7331
0.0009 0.0531 0.0221 0.0050 0.7314
0.0009 0.0531 0.0221 0.0050 0.7304
0.0009 0.0530 0.0221 0.0050 0.7299
0.0009 0.0530 0.0220 0.0050 0.7296
0.0009 0.0530 0.0220 0.0050 0.7295
0.0009 0.0530 0.0220 0.0050 0.7294
0.0009 0.0530 0.0220 0.0050 0.7293
0.0009 0.0530 0.0220 0.0050 0.7293
0.0009 0.0530 0.0220 0.0050 0.7293
0.0009 0.0530 0.0220 0.0050 0.7293
0.0009 0.0530 0.0220 0.0050 0.7293
0.0009 0.0530 0.0220 0.0050 0.7293
0.0009 0.0530 0.0220 0.0050 0.7293
0.0009 0.0530 0.0220 0.0050 0.7293
0.0009 0.0530 0.0220 0.0050 0.7293
0.0009 0.0530 0.0220 0.0050 0.7293
0.0009 0.0530 0.0220 0.0050 0.7293
0.0009 0.0530 0.0220 0.0050 0.7293

>>
3/11/24 6:42 PM C:\Users\mayan\Downloads\eld.m 1 of 2

clc;
clear all;

%% System Information
data = [510 7.2 0.00142;
310 7.85 0.00194;
18 7.97 0.0082];

% Extract parameters from the data matrix


a = data(:, 1);
b = data(:, 2);
c = data(:, 3);

PD = 800; % Power demand

% Entering the maximum and minimum generation limits for each generator
Pmax = [600, 400, 200];
Pmin = [150, 100, 50];

% User inputs the initial value of lambda (Lagrange multiplier)


L = input('Enter the value of lambda=' ); % Incremental cost

% Tolerance and initialization for the iterative process


E = 0.0001;
Pdel = 1;
iter = 0;

while abs(Pdel) > E


iter = iter + 1; % Increment iteration counter

% Power generation calculation


for i = 1:3
% Power generated by each generator without losses
P(i) = (L - b(i)) / (2 * c(i));

% Check upper limit for power generation


P(i) = min(P(i), Pmax(i));
% Check lower limit for power generation
P(i) = max(P(i), Pmin(i));
end

% Store generated power for each generator


P1gen(iter) = P(1);
P2gen(iter) = P(2);
P3gen(iter) = P(3);

% Calculate power mismatch


Pdel = PD - sum(P); % Difference between demand and generated power
3/11/24 6:42 PM C:\Users\mayan\Downloads\eld.m 2 of 2

% Calculate total cost for each generator


for m = 1:3
C(m) = a(m) + (b(m) * P(m)) + (c(m) * (P(m)^2));
end
Cost(iter) = sum(C); % Total cost at this iteration
Psum = sum(P); % Total generated power

% Calculate the correction in Lambda and its update


f = 0; % Initialize variable for the sum of inverse gradients
for i = 1:3
f = f + (1 / (2 * c(i))); % Calculate the sum of inverse gradients
end

% Calculate change in lambda


del_l = abs(Pdel / f);

% Update lambda based on the total generated power


if Psum > PD
L = L - del_l / 2;
else
L = L + del_l / 2;
end

% Store lambda value for each iteration


Lambda(iter) = L;
end

% Display final results


disp(['Final Lambda: ', num2str(L)]);
disp(['Total Cost: ', num2str(Cost(iter))]);
disp('Generated Power: ');
disp(P);

% Plotting the cost convergence


figure;
plot(Cost);

xlabel('Number of Iterations');
ylabel('Cost ($)');
title('Convergence Plot');

% Display all results in a table format


result = [Lambda', P1gen', P2gen', P3gen', Cost'];
disp('Iterations, Lambda, P1, P2, P3, Cost' );
disp(result);

You might also like