Académique Documents
Professionnel Documents
Culture Documents
Data14;
Y; % Calling ybusppg.m to get Y-Bus Matrix..
busd = busdata; % Calling busdatas..
BMva = 100; % Base MVA..
bus = busdata(:,1); % Bus Number..
type = busd(:,10); % Type of Bus 1-Slack, 2-PV, 3-PQ..
V = busd(:,2); % Specified Voltage..
del = busd(:,3); % Voltage Angle..
Pg = busd(:,4)/BMva; % PGi..
Qg = busd(:,5)/BMva; % QGi..
Pl = busd(:,6)/BMva; % PLi..
Ql = busd(:,7)/BMva; % QLi..
Qmin = busd(:,8)/BMva; % Minimum Reactive Power Limit..
Qmax = busd(:,9)/BMva; % Maximum Reactive Power Limit..
P = Pg - Pl; % Pi = PGi - PLi..
Q = Qg - Ql; % Qi = QGi - QLi..
Psp = P; % P Specified..
Qsp = Q; % Q Specified..
G = real(Y); % Conductance matrix..
B = imag(Y); % Susceptance matrix..
Tol = 1;
Iter = 1;
while (Tol > 0.00001) % Iteration starting..
P = zeros(nbus,1);
Q = zeros(nbus,1);
% Calculate P and Q
for i = 1:nbus
for k = 1:nbus
P(i) = P(i) + V(i)* V(k)*(G(i,k)*cos(del(i)-del(k)) +
B(i,k)*sin(del(i)-del(k)));
Q(i) = Q(i) + V(i)* V(k)*(G(i,k)*sin(del(i)-del(k)) -
B(i,k)*cos(del(i)-del(k)));
end
end
Iter = Iter + 1;
Tol = max(abs(M)); % Tolerance..
end
P
Q
G
B
V
del
%Loss Calculation
Vs=V(fb);
Vr=V(tb);
dels=del(fb);
delr=del(tb);
G=real(y);
for i=1:20
Pl(i)=G(i)*((Vs(i)^2)+(Vr(i)^2)-2*Vs(i)*Vr(i)*cos(dels(i)-delr(i)));
end
sum(Pl)