Gauss-Seidel Power Flow with PQ Buses

3 views (last 30 days)
Juan Quezada
Juan Quezada on 4 Feb 2020
Commented: KSSV on 4 Feb 2020
clc;
clear;
j = sqrt(-1);
%Input
z12 = 0.01+0.03j;%pu
z13 = 0.02+0.04j;%pu
z23 = 0.012+0.03j;%pu
Sbase = 100;%MVA
PL(2) = 150;%MW
QL(2) = 85;%MVAr
PL(3) = 120;%MW
QL(3) = 80;%MVAr
PG(3) = 20;%MW
V(1) = 1.05;%pu scheduled
VSc(3) = 1.03;%pu scheduled
epsilon = 1e-6;%threshold (pu)
%procedure
%YBus
Y = [1/z12+1/z13 -1/z12 -1/z13 -1/z12 1/z12+1/z23 -1/z23 -1/z13 -1/z23 1/z13+1/z23];
PLpu(2) = PL(2)/Sbase;
QLpu(2) = QL(2)/Sbase;
PLpu(3) = PL(3)/Sbase;
QLpu(3) = QL(3)/Sbase;
PGpu(3) = PG(3)/Sbase;
Pinj(2) = -PLpu(2);
Qinj(2) = -QLpu(2);
Pinj(3) = PGpu(3)-PLpu(3);
V(2) = 1;%pu initial guess
V(3) = VSc(3);%pu initial guess
iter = 0;
error = 10e10;%a big number!
while error > epsilon
iter = iter + 1;
Vprev = V;
V(2) = (((Pinj(2)-j*Qinj(2))/conj(V(2)))-Y(2,1)*V(1)- Y(2,3)*V(3))/Y(2,2);
Qinj(3) = -imag(conj(V(3))*(Y(3,1)*V(1)+Y(3,2)*V(2)+Y(3,3)*V(3)));
V(3) = (((Pinj(3)-j*Qinj(3))/conj(V(3)))-Y(3,1)*V(1)- Y(3,2)*V(2))/Y(3,3);
error = max(abs(errorVec));
end
for i=1:3
absV(i) = abs(V(i));
angV(i) = angle(V(i))*180/pi;
vol = strcat(num2str(absV(i)),'<',num2str(angV(i)));
display(strcat('V(',num2str(i),')=',vol))
end
display(strcat('Iteration=', num2str(iter)))
display(strcat('Error=', num2str(error)))

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!