Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Please quote for this assignment

1 answer below »
Please quote for this assignment
Answered Same Day Oct 23, 2021

Solution

Kshitij answered on Nov 05 2021
132 Votes
Nr_decouple/Nr_decouple
usdatas.m
% Returns Initial Bus datas of the system...
function busdt = busdatas(num)
% Type....
% 1 - Slack Bus..
% 2 - PV Bus..
% 3 - PQ Bus..
% |Bus | Type | Vsp | theta | PGi | QGi | PLi | QLi | Qmin | Qmax |
usdat5 = [1 2 1.00 0 0 0 0 0 0 0;
2 3 1.05 0 0 0 8.0 2.8 0 0;
3 1 1.05 0 5.2 0 0.8 0.4 -2.8 0;
4 3 1.05 0 0 0 0 0 0 0;
5 3 1.05 0 0 0 0 0 0 0;];

%
switch num
case 5
busdt = busdat5;

end
Nr_decouple/Nr_decouple/linedatas.m
% Returns Line datas of the system...
function linedt = linedatas(num)
% | From | To | R | X | B/2 | X'mer |
% | Bus | Bus | pu | pu | pu | TAP (a) |
linedat5 = [1 5 0.00 0.02 0 1
3 4 0.00 0.01 0 1
2 4 0.00 0.01 1.72 1
2 5 0.0 0.05 0.88 1
4 5 0.0 0.02 0.44 1];

switch num
case 5
linedt = linedat5;

end
Nr_decouple/Nr_decouple/loadflow.m
% Program for Bus Power Injections, Line & Power flows (p.u)...
% Updated on Jan-6-2018, Praviraj PG
function [Pi Qi Pg Qg Pl Ql] = loadflow(nb,V,del,BMva)
Y = ybusppg(nb); % Calling Ybus program..
lined = linedatas(nb); % Get linedats..
usd = busdatas(nb); % Get busdatas..
Vm = pol2rect(V,del); % Converting polar to rectangular..
Del = 180/pi*del; % Bus Voltage Angles in Degree...
fb = lined(:,1); % From bus number...
tb = lined(:,2); % To bus number...
nl = length(fb); % No. of Branches..
Pl = busd(:,7); % PLi..
Ql = busd(:,8); % QLi..
Iij = zeros(nb,nb);
Sij = zeros(nb,nb);
Si = zeros(nb,1);
% Bus Cu
ent Injections..
I = Y*Vm;
Im = abs(I);
Ia = angle(I);

%Line Cu
ent Flows..
for m = 1:nl
p = fb(m); q = tb(m);
Iij(p,q) = -(Vm(p) - Vm(q))*Y(p,q); % Y(m,n) = -y(m,n)..
Iij(q,p) = -Iij(p,q);
end
%Iij = sparse(Iij); % Commented out..
Iijm = abs(Iij);
Iija = angle(Iij);
% Line Power Flows..
for m = 1:n
for n = 1:n
if m ~= n
Sij(m,n) = Vm(m)*conj(Iij(m,n))*BMva;
end
end
end
%Sij = sparse(Sij); % Commented out..
Pij = real(Sij);
Qij = imag(Sij);

% Line Losses..
Lij = zeros(nl,1);
for m = 1:nl
p = fb(m); q = tb(m);
Lij(m) = Sij(p,q) + Sij(q,p);
end
Lpij = real(Lij);
Lqij = imag(Lij);
% Bus Power Injections..
for i = 1:n
for k = 1:n
Si(i) = Si(i) + conj(Vm(i))* Vm(k)*Y(i,k)*BMva;
end
end
Pi = real(Si);
Qi = -imag(Si);
Pg = Pi+Pl;
Qg = Qi+Ql;

disp('#########################################################################################');
disp('-----------------------------------------------------------------------------------------');
disp(' Newton Raphson Loadflow Analysis ');
disp('-----------------------------------------------------------------------------------------');
disp('| Bus | V | Angle | Injection | Generation | Load |');
disp('| No | pu | Degree | MW | MVar | MW | Mvar | MW | MVar | ');
for m = 1:n
disp('-----------------------------------------------------------------------------------------');
fprintf('%3g', m); fprintf(' %8.4f', V(m)); fprintf(' %8.4f', Del(m));
fprintf(' %8.3f', Pi(m)); fprintf(' %8.3f', Qi(m));
fprintf(' %8.3f', Pg(m)); fprintf(' %8.3f', Qg(m));
fprintf(' %8.3f', Pl(m)); fprintf(' %8.3f', Ql(m)); fprintf('\n');
end
disp('-----------------------------------------------------------------------------------------');
fprintf(' Total ');fprintf(' %8.3f', sum(Pi)); fprintf(' %8.3f', sum(Qi));
fprintf(' %8.3f', sum(Pi+Pl)); fprintf(' %8.3f', sum(Qi+Ql));
fprintf(' %8.3f', sum(Pl)); fprintf(' %8.3f', sum(Ql)); fprintf('\n');
disp('-----------------------------------------------------------------------------------------');
disp('#########################################################################################');
disp('-------------------------------------------------------------------------------------');
disp(' Line FLow and Losses ');
disp('-------------------------------------------------------------------------------------');
disp('|From|To | P | Q | From| To | P | Q | Line Loss |');
disp('|Bus |Bus| MW | MVar | Bus | Bus| MW | MVar | MW | MVar |');
for m = 1:nl
p = fb(m); q = tb(m);
disp('-------------------------------------------------------------------------------------');
fprintf('%4g', p); fprintf('%4g', q); fprintf(' %8.3f', Pij(p,q)); fprintf(' %8.3f', Qij(p,q));
fprintf(' %4g', q); fprintf('%4g', p); fprintf(' %8.3f', Pij(q,p)); fprintf(' %8.3f', Qij(q,p));
fprintf(' %8.3f', Lpij(m)); fprintf(' %8.3f', Lqij(m));
fprintf('\n');
end
disp('-------------------------------------------------------------------------------------');
fprintf(' Total Loss ');
fprintf(' %8.3f', sum(Lpij)); fprintf(' %8.3f', sum(Lqij)); fprintf('\n');
disp('-------------------------------------------------------------------------------------');
disp('#####################################################################################');
Nr_decouple/Nr_decouple/nR_Decouple.m
% Program for Newton-Raphson Load Flow Analysis..
number_of_bus = 5; % Number of buses 5
Ybus = ybusppg(number_of_bus); % y bus
usdatta = busdatas(number_of_bus);
%%
% Calling busdatas..
Base_Mva = 100; % Base MVA..
us =busdatta(:,1); % Number of buses
type = busdatta(:,2); % Bus Type
V = busdatta(:,3); % Voltage given
del = busdatta(:,4); % Angle of voltages
Pg = busdatta(:,5)/Base_Mva; % generatio powe
Qg = busdatta(:,6)/Base_Mva; % reactive powe
Pl =busdatta(:,7)/Base_Mva; % load powe
Ql = busdatta(:,8)/Base_Mva; % reactive load p.
Qmin = busdatta(:,9)/Base_Mva; % minimum Power Limit in case of reactive powe
Qmax = busdatta(:,10)/Base_Mva; % Maximum Power Limit in case of reactive powe
P = Pg - Pl;
Q = Qg - Ql;
Psp = P; % P
Qsp = Q; % Q .
G = real(Ybus); % Conductance matrix..
B = imag(Ybus); % Susceptance matrix..
pv = find(type == 2 | type == 1); % PV Buses..
pq = find(type == 3); % PQ Buses..
npv = length(pv); % Number of PV buses..
npq = length(pq); % Number of of PQ buses..
Tol = 1;
Iter = 1;
while (Tol > 1e-5)
P = zeros(number_of_bus,1);
Q = zeros(number_of_bus,1);
% Calculation of active power and reactive powe
for i = 1:number_of_bus
for k = 1:number_of_bus
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
% checking whether the q power limit is violted
if Iter <= 7 && Iter > 2
for n = 2:number_of_bus
if type(n) == 2
QG = Q(n)+Ql(n);
if QG < Qmin(n)
V(n) = V(n) +...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here