0% found this document useful (0 votes)
36 views

Experiment-5 MATLAB Codes

Power System Operation & Control Lab Experiment-5 Solution

Uploaded by

WAQAR BHATTI
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)
36 views

Experiment-5 MATLAB Codes

Power System Operation & Control Lab Experiment-5 Solution

Uploaded by

WAQAR BHATTI
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/ 2

Experiment-5

ECONOMIC DISPATCH OF THERMAL POWER SYSTEM WITH TRANSMISSION LINE LOSSES

MATLAB Code:
function [cost, lamda, P] = iter_lamb_loss(pd, A, g, B, pmax, pmin)
% Initialize variables
pd = 150;
A = [200, 7.0, 0.008;
180, 6.3, 0.009;
140, 6.8, 0.007];
g = max(A(:, 2)) + 0.1; % Initial guess of lambda
B = [0.000218, 0.000228, 0.000179];
pmax = [85; 80; 70];
pmin = [10; 10; 10];
n = length(A);
dg = 10;
a = zeros(n, 1);
b = zeros(n, 1);
c = zeros(n, 1);

% Extract coefficients from A matrix


for i = 1:n
a(i) = A(i, 1);
b(i) = A(i, 2);
c(i) = A(i, 3);
end

% Main iteration loop


while (abs(dg) > 0.0001)
% Calculate denominator for power calculation
den = zeros(n, 1);
den1 = zeros(n, 1);
for u = 1:n
den(u) = 2 * (c(u) + g * B(1, u));
den1(u) = 2 * (c(u) + g * B(1, u))^2;
end

% Calculate power generation for each generator


p = (g - b) ./ den;

% Check if calculated power is within limits


for k = 1:n
if p(k) > pmax(k)
p(k) = pmax(k);
elseif p(k) < pmin(k)
p(k) = pmin(k);
end
end

% Calculate power loss


pl = sum(B * (p.^2));

% Calculate delta P
dp = pd - sum(p) + pl;
s = (c + B * b) ./ den1;
dg = dp / sum(s);

% Update lambda
g = g + dg;
lamda = g;
end

% Calculate total cost


cost = sum(a) + sum(b .* p) + sum(c .* (p.^2));
% Solve economic dispatch problem
pl = sum(B * (p.^2));
% Display results
disp('Results:');
disp(['Total cost of Generation: $', num2str(cost)]);
disp(['Lambda (lamda): ', num2str(lamda)]);
disp('Generation of Individual Generators (P):');
disp(p);
disp(['Power Losses: ', num2str(pl)]);
end

Output:

You might also like