sir i am not getting output from this coding
1 view (last 30 days)
Show older comments
newton raphson load flow m file.
Y = ybusint(); busdata = busdata6(); linedata = linedata6(); e_intv=1.02; f_intv=.11;
Pd=busdata(:,7); Qd=busdata(:,8); E=busdata(:,3); e = real(E); f = imag(E);
Pg =busdata(:,5); Qg =busdata(:,6); fb = linedata(:,1); % From bus number... tb = linedata(:,2); % To bus number...
nb = max(max(fb),max(tb)); G = real(Y); % Conductance matrix.. B = imag(Y); % Susceptance matrix.. bsf=busdata(:,2); bpq1=busdata(2,2); bpq2=busdata(3,2); bpq=[bpq1;bpq2]; for iter = 0 : 10 e1 = midrad(mid(e_intv), eps); f1 = midrad(mid(f_intv), eps); %----- P (real power) and Q (reactive power) ----- E1 = e1 + j * f1; I1 = Y * E1; S1 = E1 .* conj(I1); P1 = real(S1); Q1 = imag(S1); E = e_intv + j * f_intv; I = Y * E; %----- POWER MISMATCHES ----- dP = -P1(bsf) + Pg(bsf) - Pd(bsf); dQ = -Q1(bpq) + Qg(bpq) - Qd(bpq); fx = [ dP; dQ ]; %----- STOP CRITERIA -----
%----- JACOBIAN MATRIX ----- for i = 1 : nb K1 = e_intv(i) * G(i, i) + f_intv(i) * B(i, i); K2 = f_intv(i) * G(i, i) - e_intv(i) * B(i, i); J1(i, i) = K1 + real(I(i)); J2(i, i) = K2 + imag(I(i)); J3(i, i) = K2 - imag(I(i)); J4(i, i) =-K1 + real(I(i)); for l = adj(i) : adj(i + 1) - 1 k = b_adj(l); J1(i, k) = e_intv(i) * G(i, k) + f_intv(i) * B(i, k); J2(i, k) = f_intv(i) * G(i, k) - e_intv(i) * B(i, k); J3(i, k) = J2(i, k); J4(i, k) = - J1(i, k); end end J = [ J1(bsf, bsf) J2(bsf, bsf) J3(bpq, bsf) J4(bpq, bsf) ]; %----- LINEAR SYSTEM - Equation (3.9) ----- delta = - J \ fx; %----- VARIABLE UPDATE ----- e_old = e_intv; f_old = f_intv; e2 = e1(bsf) + delta(1 : nb-1); %----- Equation (3.10) f2 = f1(bsf) + delta(nb : 2*nb-2); %----- Equation (3.10) e_intv(bsf) = intersect(e_old(bsf), e2); %----- Equation (3.11) f_intv(bsf) = intersect(f_old(bsf), f2); %----- Equation (3.11) end
bus data m file
function busdata = busdata6() % Returns busdata.
% |Bus | Type | Vsp | theta | PGi | QGi | PLi | QLi | Qmin | Qmax | % busdata = [ 1 1 1.05 0 .23 0 0 0 0 0 2 2 1.05 0 .34 0 0 0 -0.5 1.0 ; 3 2 1.07 0 .35 0 0 0 -0.5 1.5 ;];
line data m file
function linedata = linedata6() % Returns linedata.
% | From | To | R | X | B/2 | a % | Bus | Bus | | | | linedata = [ 1 2 0.10 0.20 0.02 1; 1 3 0.05 0.20 0.02 1; 3 2 0.08 0.30 0.03 1;];
ybus m file
% Program to for Admittance And Impedance Bus Formation....
function Y = ybusint() % Returns Y
linedata = linedata6(); % Calling Linedatas... fb = linedata(:,1); % From bus number... tb = linedata(:,2); % To bus number... r = linedata(:,3); % Resistance, R... x = linedata(:,4); % Reactance, X... b = linedata(:,5); % Ground Admittance, B/2... a = linedata(:,6); % Tap setting value.. z = r + 1i*x; % z matrix... y = 1./z; % To get inverse of each element... b = i*b; % Make B imaginary...
nb = max(max(fb),max(tb)); % No. of buses... nl = length(fb); % No. of branches... Y = zeros(nb,nb); % Initialise YBus...
% Formation of the Off Diagonal Elements...
for k = 1:nl
Y(fb(k),tb(k)) = Y(fb(k),tb(k)) - y(k)/a(k);
Y(tb(k),fb(k)) = Y(fb(k),tb(k));
end
% Formation of Diagonal Elements....
for m = 1:nb
for n = 1:nl
if fb(n) == m
Y(m,m) = Y(m,m) + y(n)/(a(n)^2) + b(n);
elseif tb(n) == m
Y(m,m) = Y(m,m) + y(n) + b(n);
end
end
end
%Y; % Bus Admittance Matrix
%Z = inv(Y); % Bus Impedance Matrix
Answers (1)
Walter Roberson
on 5 Nov 2013
Your load flow is not a function, and it does not appear to contain any disp() or fprintf() or other output statements. None of your other routines appear to contain any output statements. I would thus not expect there to be any output displayed when your run the file.
0 Comments
See Also
Categories
Find more on Use COM Objects in MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!