Académique Documents
Professionnel Documents
Culture Documents
1
10
2
1
1
10
12
13
14
Output
Matrix X :
1
1
1
1.95
-0.86
2.95
3.60
-3.27
2.40
-2.14
-1.68
1.58
-3.20
1.86
-2.26
2.16
3.28
1.42
5.21
Output
Matrix X :
0.805827
0.238181
-0.106058
-0.360209
EXPERIMENT -2
SOLUTION OF SIMULATENOUS DIFFERENTIAL EQUATIONS USING RK METHOD IN MATLAB
1.196
end
end
fclose all;
EXPERIMENT -3
FORMULATION OF Y BUS BY DIRECT INSPECTION METHOD IN MATLAB
2
3
3
The Impedances
imp =
0+0.2000i
Line Capacitances
lca =
0
0
3
4
0+0.1000i
0+0.3000i
0+0.4000i
0+5.0000i
0-15.0000i
0+10.0000i
0
0+ 3.3333i
0+10.0000i
0-15.8333i
0+2.5000i
0
0
0+2.5000i
0-2.5000i
1
1
2
2
4
4
6
4
6
3
5
3
6
5
0.08
0.123
0.723
0.282
0.000
0.097
0.000
0.37
0.518
1.05
0.64
0.133
0.407
0.300
0.007
0.010
0.000
0.000
0.000
0.0076
0.000
0.007
0.010
0.000
0.000
0.000
0.0076
0.000
1
1
1
1
0.909
1
0.976
(0.99)+j(-4.39)
(0.00)+j(0.00)
(0.00)+j(0.00)
(-0.56)+j(2.58)
(0.00)+j(0.00)
(-0.43)+j(1.83)
(0.00)+j(0.00)
(1.02)+j(-1.95)
(-0.44)+j(0.65)
(0.00)+j(0.00)
(-0.58)+j(1.31)
(0.00)+j(0.00)
(0.00)+j(0.00)
(-0.44)+j(0.65)
(0.44)+j(-8.16)
(0.00)+j(8.27)
(0.00)+j(0.00)
(0.00)+j(0.00)
EXPERIMENT -4
FORMULATION OF Y BUS BY SINGULAT TRANSFORMATION METHOD IN MATLAB
1
1
2
2
2
3
4
2
3
3
4
5
4
5
0.02
0.08
0.06
0.06
0.04
0.01
0.08
0.06
0.24
0.18
0.18
0.12
0.03
0.24
0.060
0.240
0.180
0.180
0.120
0.030
0.240
Primitive Y Matrix :
(5.000)+j
(-15.000)
(0.000)+j
(0.000)
(0.000)+j
(0.000)
(0.000)+j
(0.000)
(0.000)+j
(0.000)
(0.000)+j
(0.000)
(-0.000)+j
(0.000)
(0.000)+j
(0.000)
(1.250)+j
(-3.750)
(0.000)+j
(0.000)
(0.000)+j
(0.000)
(0.000)+j
(0.000)
(0.000)+j
(0.000)
(-0.000)+j
(0.000)
(0.000)+j
(0.000)
(0.000)+j
(0.000)
(1.667)+j
(-5.000)
(0.000)+j
(0.000)
(0.000)+j
(0.000)
(0.000)+j
(0.000)
(-0.000)+j
(0.000)
(0.000)+j
(0.000)
(0.000)+j
(0.000)
(0.000)+j
(0.000)
(1.667)+j
(-5.000)
(0.000)+j
(0.000)
(0.000)+j
(0.000)
(-0.000)+j
(0.000)
(0.000)+j
(0.000)
(0.000)+j
(0.000)
(0.000)+j
(0.000)
(0.000)+j
(0.000)
(2.500)+j
(-7.500)
(0.000)+j
(0.000)
(-0.000)+j
(0.000)
(0.000)+j
(0.000)
(0.000)+j
(0.000)
(0.000)+j
(0.000)
(0.000)+j
(0.000)
(0.000)+j
(0.000)
(10.000)+j
(-30.000)
(-0.000)+j
(0.000)
(0.000)+j
(0.000)
(0.000)+j
(0.000)
(0.000)+j
(0.000)
(0.000)+j
(0.000)
(0.000)+j
(0.000)
(0.000)+j
(0.000)
(1.250)+j
(-3.750)
(-5.000)+j
(15.000)
(-1.250)+j
(3.750)
(0.000)+j
(0.000)
(0.000)+j
(0.000)
(-5.000)+j
(15.000)
(10.833)+j
(-32.500)
(-1.667)+j
(5.000)
(-1.667)+j
(5.000)
(-2.500)+j
(7.500)
(-1.250)+j
(3.750)
(-1.667)+j
(5.000)
(12.917)+j
(-38.750)
(-10.000)+j
(30.000)
(0.000)+j
(0.000)
(0.000)+j
(0.000)
(-1.667)+j
(5.000)
(-10.000)+j
(30.000)
(12.917)+j
(-38.750)
(-1.250)+j
(3.750)
(0.000)+j
(0.000)
(-2.500)+j
(7.500)
(0.000)+j
(0.000)
(-1.250)+j
(3.750)
(3.750)+j
(-11.250)
EXPERIMENT -5
FORMULATION OF Z BUS BY STEP BY STEP ALGORITHM IN MATLAB
PROGRAM FOR STEP BY STEP ALGORITHM
% FORMATION OF Z BUS BY BUS BUILDING ALGORITHM
ip=fopen('linedata.m','r');
M=fscanf(ip,'%g',[5,7]);
linedata=transpose(M)
nl=linedata(:,1);
nr=linedata(:,2);
R=linedata(:,3);
X=linedata(:,4);
ll=linedata(:,5);
nbr=length(nl);
nbus=max(max(nl),max(nr));
ZB=R+1j*X;
Zbus=zeros(nbus,nbus)
%Rule - 1
for I=1:nbr
if nl(I)==0 || nr(I)==0
if nl(I)==0
K=nr(I);
elseif nr(I)==0
K=nl(I);
end
Zbus(K,K)=ZB(I);
end
end
% rule -2
for J=1:nbr
if nl(J)>0 && nr(J) >0
if ll(J) == 0
Zbus(:,nr(J))=Zbus(:,nl(J));
Zbus(nr(J),:)=Zbus(nl(J),:);
Zbus(nr(J),nr(J))=Zbus(nr(J),nr(J))+ZB(J);
end
end
end
%Rule - 3
for J=1:nbr
if nl(J)>0 && nr(J) >0
if ll(J) ==1
delta_Z=Zbus(:,nr(J))-Zbus(:,nl(J));
Zll=ZB(J)+Zbus(nr(J),nr(J))+Zbus(nl(J),nl(J))-2*Zbus(nr(J),nl(J));
P=(delta_Z*(-delta_Z)')./Zll
Zbus=Zbus-P;
end
end
end
clc;
0 + 0.0295i
0 + 0.0705i
0 + 0.0580i
0 + 0.0517i
0 + 0.0420i
0 + 0.0580i
0 + 0.2041i
0 + 0.1271i
0 + 0.0483i
0 + 0.0517i
0 + 0.1271i
0 + 0.1648i
EXPERIMENT -6
POWER FLOW SOLUTION USING GAUSS SEIDEL METHOD IN MATLAB
for i=1:nline
yline(i)=1/complex(r(i),x(i));
if tap(i)~=1;
t1=((1/(tap(i))^2)-(1/tap(i)));
t2=(1-(1/tap(i)));
ycp(i)=yline(i)*t1;
ycq(i)=yline(i)*t2;
yline(i)=yline(i)/tap(i);
end
end
for i=1:nline
p=lp(i);
q=lq(i);
ybus(p,p)=ybus(p,p)+yline(i)+ycp(i);
ybus(q,q)=ybus(q,q)+yline(i)+ycq(i);
ybus(p,q)=ybus(p,q)-yline(i);
ybus(q,p)=ybus(p,q);
end
for i=1:n
ybus(i,i)=ybus(i,i)+ysh(i);
end
fprintf(op,'\nY Bus is obtained by using Direct Inspection as : \n\n');
for i=1:n
for j=1:n
fprintf(op,'(%0.4f)+j\t',real(ybus(i,j)));
end
fprintf(op,'\n');
for j=1:n
fprintf(op,'(%0.4f)\t',imag(ybus(i,j)));
end
fprintf(op,'\n');
end
for i=1:n;
pinj(i)=pgen(i)-pload(i);
qinj(i)=qgen(i)-qload(i);
end
for i=1:n
Eold(i)=complex(vsp(i),0);
end
iter=0;
itermax=20;
delEmax=0;
nslack=1;
E=Eold;
foriter=1:itermax
for i=1:n
if i~=nslack
csum = complex(0,0);
for j=1:n
if j~=i
csum=csum+ybus(i,j)*E(j);
end
end
E(i)=(((complex(pinj(i),-qinj(i)))/(conj(E(i))))-csum)*(1/ybus(i,i));
deltaE(i)=E(i)-Eold(i);
E(i)=Eold(i)+alpha*deltaE(i);
Eold(i)=E(i);
if abs(deltaE(i))>delEmax
delEmax=abs(deltaE(i));
end
end
end
ifdelEmax<=epsilon
break
else
iter=iter+1;
delEmax=0;
end
end
for i=1:nline
P=lp(i);
Q=lq(i);
I1(i)=((E(P)-E(Q))*yline(i))+(ycp(i)*E(P));
S1(i)=E(P)*conj(I1(i));
P1(i)=real(S1(i));
Q1(i)=imag(S1(i));
end
for i=1:nline
P=lp(i);
Q=lq(i);
I2(i)=((E(Q)-E(P))*yline(i))+(ycq(i)*E(Q));
S2(i)=E(Q)*conj(I2(i));
P2(i)=real(S2(i));
Q2(i)=imag(S2(i));
end
for i=1:nline
Ploss(i)=P1(i)+P2(i);
Qloss(i)=Q1(i)+Q2(i);
end
pgen(nslack)=P1(1)+P1(2);
qgen(nslack)=Q1(1)+Q1(2);
for i=1
Pgen(i)=pgen(nslack)+Ploss(i);
Qgen(i)=qgen(nslack)+Qloss(i);
end
tploss=sum(Ploss);
tqloss=sum(Qloss);
bvs=abs(E);
degE=angle(E)/pi*180;
ps=pgen(nslack);
qs=qgen(nslack);
pl=sum(pload);
ql=sum(qload);
tpg=pl+tploss;
tqg=ql+tqloss;
fprintf(op,'\nThePowerflow is Converged at Iteration : %d',iter);
fprintf(op,'\n\nPower Flow Solution is Obtained as:\n');
fprintf(op,'Bus No\tBus Type\t Generation\tLoad Demand\t\tBus Voltages
Solved\n');
fprintf(op,'\t\t\t\t\tReal\tReac\tReal\tReac\t Mag\tAngle(Deg)');
fprintf(op,'\n');
for i=1:n
fprintf(op,'%d\t\t\t%d\t\t%0.4f\t%0.4f\t%0.2f\t%0.2f\t%0.4f\t%0.4f',busno(i)
,itype(i),pgen(i),qgen(i),pload(i),qload(i),bvs(i),degE(i));
fprintf(op,'\n');
end
fprintf(op,'\nLine Flow Solution is Obtained as: \n');
fprintf(op,'From Bus\tTo Bus\tPLoss\t\tQLoss\t\tTotalPLoss\t\tTotalQLoss');
fprintf(op,'\n');
for i=1:nline
fprintf(op,'%d\t\t\t%d\t\t%0.4f\t\t%0.4f',lp(i),lq(i),P1(i),Q1(i));
fprintf(op,'\n');
ploss(i)=P1(i)+P2(i);
qloss(i)=Q1(i)+Q2(i);
fprintf(op,'%d\t\t\t%d\t\t%0.4f\t\t%0.4f\t\t%0.4f\t\t\t%0.4f',lp(i),lq(i),P2
(i),Q2(i),ploss(i),qloss(i));
fprintf(op,'\n');
end
fprintf(op,'\nTotal Line Loss is calculated as : (%f)+j(%f)',tploss,tqloss);
fprintf(op,'\nTotal Load is calculated as : (%f)+j(%f)',pl,ql);
fprintf(op,'\nSlack Bus Generation is calculated as : (%f)+j(%f)',ps,qs);
fprintf(op,'\nTotal Generation Required is : (%f)+j(%f)',tpg,tqg);
fclose all;
1
1
2
2
2
3
4
2
3
3
4
5
4
5
0.02
0.08
0.06
0.06
0.04
0.01
0.08
0.06
0.24
0.18
0.18
0.12
0.03
0.24
0.030
0.025
0.020
0.020
0.015
0.010
0.025
0.030
0.025
0.020
0.020
0.015
0.010
0.025
1
1
1
1
1
1
1
1
1
2
2
2
0
20
45
40
60
0
10
15
5
10
0
40
0
0
0
0
30
0
0
0
1.06
1
1
1
1
OUTPUT IS OBTAINED AS
Number of Lines: 7
Number of Buses: 5
Tolerance Value: 0.0001
Line Data is taken as:
kLpLq
R
X
1
1
2
2
1
3
3
2
3
4
2
4
5
2
5
6
3
4
7
4
5
Yshunt is assumed as :
YcpYcq
0.02
0.06
0.08
0.24
0.06
0.18
0.06
0.18
0.04
0.12
0.01
0.03
0.08
0.24
0
Tap
0.030
0.025
0.020
0.020
0.015
0.010
0.025
0
0.030
0.025
0.020
0.020
0.015
0.010
0.025
1
1
1
1
1
1
1
4
5
2
2
0.00
0.00
0.00
0.00
0.40
0.60
0.050
0.100
1.000
1.000
(-5.0000)+j
(15.0000)
(10.8333)+j
(-32.4150)
(-1.6667)+j
(5.0000)
(-1.6667)+j
(5.0000)
(-2.5000)+j
(7.5000)
(-1.2500)+j
(3.7500)
(-1.6667)+j
(5.0000)
(12.9167)+j
(-38.6950)
(-10.0000)+j
(30.0000)
(0.0000)+j
(0.0000)
(0.0000)+j
(0.0000)
(-1.6667)+j
(5.0000)
(-10.0000)+j
(30.0000)
(12.9167)+j
(-38.6950)
(-1.2500)+j
(3.7500)
(0.0000)+j
(0.0000)
(-2.5000)+j
(7.5000)
(0.0000)+j
(0.0000)
(-1.2500)+j
(3.7500)
(3.7500)+j
(-11.2100)
Load Demand
Real
Reac
0.00
0.00
0.20
0.10
0.45
0.15
0.40
0.05
0.60
0.10
Total
Total
Slack
Total
Total QLoss
-0.0243
-0.0186
-0.0324
-0.0297
0.0018
-0.0199
-0.0512
(0.045832)+j(-0.174353)
(1.650000)+j(0.400000)
(1.295189)+j(-0.075588)
(1.695832)+j(0.225647)
EXPERIMENT -7
SIMULATION OF TRANSMISSION LINE PERFORMANCE USING MATLAB
PROBLEM -1
A 500KV VOLTAGE A 3- Tr.Line is 250KM. The series impedance is
Z=(0.045+j0.4)/Ph/KM. The Shunt admittance is Y=j4*10 -6 .Evaluate Equivalent model &
trans mission network.
Program for Problem-1
clc
z=0.045+1i*0.4;
y=1i*4/1000000;
l=250;
op=fopen('trans.out','w+');
gamma=sqrt(z*y);
zc=sqrt(z/y);
a=cosh(gamma*l);
b=zc*sinh(gamma*l);
c=(1/zc)*sinh(gamma*l);
d=a;
abcd=[a b;c d];
Z=b;
Y=(2/zc)*tanh(gamma*(l/2));
fprintf(op,'SeriesImpedence z=(%f)+j(%f)\nShunt Admittance
y=(%f)+j(%f)\nGamma=(%f)+j(%f)\nCharacteristicImpedence
Zc=(%f)+j(%f)\nA=(%f)+j(%f)\nB=(%f)+j(%f)\nC=(%f)+j(%f)\nD=(%f)+j(%f)\nPI
Parameter Z=(%f)+j(%f)\nPI Parameter
Y=(%f)+j(%f)\n',real(z),imag(z),real(y),imag(y),real(gamma),imag(gamma),real(zc),i
mag(zc),real(a),imag(a),real(b),imag(b),real(c),imag(c),real(d),imag(d),real(Z),im
ag(Z),real(Y),imag(Y));
fclose all;
PROBLEM -2
A 3-, 60 Hz 500 KV Tr.Line is 300KM. The parameters per phase/unit are found to be
R=(0.016)/KM, L=(0.97)mH/KM, C=(0.05)F/KM..Determine the ohase constants . Surge
Impedance (Zc), Velocity of propagation () and line wave length().
Program for Problem-2
clc
l=input('\n Enter the Length of Transmission Line in KM:');
r=input('\n Enter the Resistance in Ohm/KM:');
L=input('\n Enter the Inductance value in H/KM:');
C=input('\n Enter the Capacitance value in F/KM:');
f=60;
w=2*pi*f;
beta=w*sqrt(L*C);
zc=sqrt(L/C);
velocity=1/sqrt(L*C);
lamda=velocity/f;
fprintf('\n Velocity of Propogation in KM/s:(%f)\n',velocity);
fprintf('\n Line Wavelength in KM is:(%f)\n',lamda);
fprintf('\n Phase Constant Beta is:(%f)\n',beta);
fprintf('\n Surge Impedance Zc is:(%f)\n',zc);
fclose all;
PROBLEM -3
Determine the pe rformance of 500KV transmission line, when the load at receiving end is
800MW @ 0.8 p.f lagging. Remaining all other parameters are same as problem -2
Program for Problem-3
clc
vr=input('\n Enter the Receiving End Line Voltage in KV:');
vrph=vr/sqrt(3);
load=input('\n Enter Load in MW:');
pf=input('\n Enter Power Factor:');
theta=acos(pf);
loadinmva=load/pf;
sr=load+(1i*loadinmva *sin(theta));
l=input('\n Enter the Length of Transmission Line:');
r=input('\n Enter the Resistance in Ohm/KM:');
L=input('\n Enter the Inductance Value in H/KM:');
C=input('\n Enter the Capacitance in F/KM:');
G=input('\n Enter the Conductance in Mho/KM:');
f=60;
w=2*pi*f;
beta=w*sqrt(L*C);
z=(r+1i*w*L);
y=(G+1i*w*C);
g=sqrt(z*y);
zc=sqrt(z/y);
a=cosh(g*l);
b=zc*sinh(g*l);
c=sinh(g*l)/zc;
d=cosh(g*l);
format long;
abcd=[a b;c d];
ir=(conj(sr)*(1000)/(3*vrph));
abs(ir);
angle((ir)*(180/pi));
vsis=abcd*[vrph*1000;ir];
vs=abs(vsis(1)*sqrt(3));
is=abs(vsis(2)*sqrt(3));
thetav =angle(vsis(1));
thetai=angle(vsis(2));
ps=vs*is*cos(thetav-thetai)/1000000;
qs=vs*is*sin(thetav-thetai)/1000000;
reg=(((vs/(cos(beta*l)*sqrt(3)))-(vrph*1000))/(vrph*1000))*100;
abs(reg);
efficency=(load/ps)*100;
fprintf('\n Voltage Regulation is:(%f)\n',abs(reg));
fprintf('\n Efficency is:(%f)\n',efficency);
fprintf('\n Sending End Voltage is:(%f)\n',vs);
fprintf('\n Sending End Current is:(%f)\n',is);
fprintf('\n Sending End Active Power is:(%f)\n',ps);
fprintf('\n sending End Reactive Power is:(%f)\n',qs);
fclose all;
EXPERIMENT -8
SHORT CIRCUIT STUDIES USING MATLAB
((vb-
(vb_LL*bv)/1.732
Ib_LLG=Ia0_LLG+(a*a*Ia1_LLG)+(a*Ia2_LLG);
Ic_LLG=Ia0_LLG+(a*Ia1_LLG)+(a*a*Ia2_LLG);
% actual line currents
Fault_curent_in_Amps_for_LLG_Fault=[Ia_LLG*bcIb_LLG*bcIc_LLG*bc]
%sequence voltages
va1_LLG=(E-(Ia1_LLG*z1));
va2_LLG=va1_LLG;
va0_LLG=va1_LLG;
%calculation of line to neutral voltages in pu.
va_LLG=va0_LLG+va1_LLG+va2_LLG;
vb_LLG=va0_LLG+(a*a*va1_LLG)+(a*va2_LLG);
vc_LLG=va0_LLG+(a*va1_LLG)+(a*a*va2_LLG);
Line_to_neutral_Voltages_in_kV_for_LLG_Fault=[(va_LLG*bv)/1.732
(vb_LLG*bv)/1.732
(vc_LLG*bv)/1.732]
0.0004 -15.7714i
-1.7075 + 7.8857i
Fault_curent_in_Amps_for_LL_Fault =
1.0e+003 *
0
-3.6232
3.6232
Line_to_neutral_Voltages_in_kV_for_LL_Fault =
9.2956
-4.6476
-4.6476
Fault_curent_in_Amps_for_LLG_Fault =
1.0e+003 *
0 + 0.0000i
-4.0531 + 4.4673i
4.0531 + 4.4675i
Line_to_neutral_Voltages_in_kV_for_LLG_Fault =
5.6719
0.0001
0.0001
EXPERIMENT -8
DETERMINATION OF CRITICAL CLEARING TIME AND SWING CURVE USING MATLAB
PROGRAM FOR DETERMINATION OF CRITICAL CLEARING TIME AND SWING CURVE USING MATLAB
clc;
clear all;
pm=1;
H=5;
f=60;
x1=input('\n Enter the value of Generator Reactance:');
x2=input('\n Enter the value of Tr.Line-1 Reactance:');
x3=input('\n Enter the value of Tr.Line-2 Reactance:');
x4=input('\n Enter the value of Load Reactance:');
E=input('\n Enter the value of Generator Voltage in (P.U):');
V=1;
fprintf('\n During the Pre-Fault Condition:');
x5=(x2*x3)/(x2+x3);
X=x1+x5+x4
pmax1=(E*V)/X
pe1=pm
delta=asin(pe1/pmax1)
fprintf('\n During Fault Condition:');
pe2=0
pmax2=0
fprintf('\n Post Fault Condition');
x23=x1+x2+x4
pmax3=(E*V)/x23
deltamax=pi-asin(pm/pmax3)
pe3=pmax3*sin(deltamax)
fprintf('\n Critical Clearing angle:');
deltacr=acos(((pm*(deltamax-delta))(pmax2*cos(delta))+(pmax3*cos(deltamax)))/(pmax3-pmax2))
fprintf('\n Clearing Time:');
tcr=sqrt((2*H*(deltacr-delta))/(pi*f*pm))
fclose all;
0.25
0.5
0.4
0.05
0.5222
pmax1 =
2.2979
pe1 =
delta =
0.4502
pmax2 =
0.8000
pmax3 =
1.5000
deltamax =
2.4119
pe3 =
1.0000
0.9735
Clearing Time:
tcr =
0.1666
EXPERIMENT -10
SIMULATION OF ROTOR ANGLE STABILITY USING MATLAB
SUBSYSTEM 1
SUB SYSTEM -2
EXPERIMENT -11
LOAD FLOW BY NR METHOD USING MATLAB
Type....
1 - Slack Bus..
2 - PV Bus..
3 - PQ Bus..
%
|Bus | Type | Vsp | theta | PGi | QGi | PLi | QLi |
busdat14 = [1
1
1.060
0
0
0
0
0
2
2
1.045
0
40
42.4 21.7
12.7
3
2
1.010
0
0
23.4 94.2
19.0
4
3
1.0
0
0
0
47.8
-3.9
5
3
1.0
0
0
0
7.6
1.6
6
2
1.070
0
0
12.2 11.2
7.5
7
3
1.0
0
0
0
0.0
0.0
8
2
1.090
0
0
17.4
0.0
0.0
9
3
1.0
0
0
0
29.5
16.6
10
3
1.0
0
0
0
9.0
5.8
11
3
1.0
0
0
0
3.5
1.8
12
3
1.0
0
0
0
6.1
1.6
13
3
1.0
0
0
0
13.5
5.8
14
3
1.0
0
0
0
14.9
5.0
Qmin | Qmax |
0
0;
-40
50;
0
40;
0
0;
0
0;
-6
24;
0
0;
-6
24;
0
0;
0
0;
0
0;
0
0;
0
0;
0
0;];
switch num
case 14
busdt = busdat14;
end
|
|
R
|
X
|
pu
| pu
|
0.01938
0.05917
0.05403
0.22304
0.04699
0.19797
0.05811
0.17632
0.05695
0.17388
0.06701
0.17103
0.01335
0.04211
0.0
0.20912
0.0
0.55618
0.0
0.25202
0.09498
0.19890
0.12291
0.25581
0.06615
0.13027
B/2
pu
0.0264
0.0246
0.0219
0.0170
0.0173
0.0064
0.0
0.0
0.0
0.0
0.0
0.0
0.0
| X'mer |
| TAP (a) |
1
1
1
1
1
1
1
0.978
0.969
0.932
1
1
1
7
7
9
9
10
12
13
8
9
10
14
11
13
14
0.0
0.0
0.03181
0.12711
0.08205
0.22092
0.17093
0.17615
0.11001
0.08450
0.27038
0.19207
0.19988
0.34802
0.0
0.0
0.0
0.0
0.0
0.0
0.0
1
1
1
1
1
1
1 ];
switch num
case 14
linedt = linedat14;
end
% Returns Y
linedata = linedatas(num);
fb = linedata(:,1);
tb = linedata(:,2);
r = linedata(:,3);
x = linedata(:,4);
b = linedata(:,5);
a = linedata(:,6);
z = r + i*x;
y = 1./z;
b = i*b;
%
%
%
%
%
%
%
%
%
%
Calling Linedatas...
From bus number...
To bus number...
Resistance, R...
Reactance, X...
Ground Admittance, B/2...
Tap setting value..
z matrix...
To get inverse of each element...
Make B imaginary...
nb = max(max(fb),max(tb));
nl = length(fb);
Y = zeros(nb,nb);
% No. of buses...
% No. of branches...
% InitialiseYBus...
PROGRAM FOR BUS POWER INJECTION AND LINE AND POWER FLOWS
% Program for Bus Power Injections, Line & Power flows (p.u)...
function [Pi Qi PgQg Pl Ql] = loadflow(nb,V,del,BMva)
Y = ybusppg(nb);
lined = linedatas(nb);
busd = busdatas(nb);
Vm = pol2rect(V,del);
Del = 180/pi*del;
fb = lined(:,1);
tb = lined(:,2);
nl = length(fb);
Pl = busd(:,7);
Ql = busd(:,8);
%
%
%
%
%
%
%
%
%
%
Iij = zeros(nb,nb);
Sij = zeros(nb,nb);
Si = zeros(nb,1);
% Bus Current Injections..
I = Y*Vm;
Im = abs(I);
Ia = angle(I);
%Line Current 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);
Iijm = abs(Iij);
Iija = angle(Iij);
% Line Power Flows..
for m = 1:nb
for n = 1:nb
if m ~= n
Sij(m,n) = Vm(m)*conj(Iij(m,n))*BMva;
end
end
end
Sij = sparse(Sij);
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:nb
for k = 1:nb
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 RaphsonLoadflow Analysis ');
disp('----------------------------------------------------------------------------------------');
disp('| Bus |
V
| Angle |
Injection
|
Generation
|
Load
|');
disp('| No |
pu
| Degree |
MW
|
MVar
|
MW
| Mvar
|
MW
| MVar | ');
for m = 1:nb
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('------------------------------------------------------------------------------------');
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
PV Buses..
PQ Buses..
No. of PV buses..
No. of PQ buses..
% 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
% Checking Q-limit violations..
if Iter<= 7 &&Iter> 2
% Only checked up to 7th iterations..
for n = 2:nbus
if type(n) == 2
QG = Q(n)+Ql(n);
if QG <Qmin(n)
V(n) = V(n) + 0.01;
elseif QG >Qmax(n)
V(n) = V(n) - 0.01;
end
end
end
end
% Calculate change from specified value
dPa = Psp-P;
dQa = Qsp-Q;
k = 1;
dQ = zeros(npq,1);
for i = 1:nbus
if type(i) == 3
dQ(k,1) = dQa(i);
k = k+1;
end
end
dP = dPa(2:nbus);
M = [dP; dQ];
% Mismatch Vector
% Jacobian
% J1 - Derivative of Real Power Injections with Angles..
J1 = zeros(nbus-1,nbus-1);
for i = 1:(nbus-1)
m = i+1;
for k = 1:(nbus-1)
n = k+1;
if n == m
for n = 1:nbus
J1(i,k) = J1(i,k) + V(m)* V(n)*(-G(m,n)*sin(del(m)-del(n)) +
B(m,n)*cos(del(m)-del(n)));
end
J1(i,k) = J1(i,k) - V(m)^2*B(m,m);
else
J1(i,k) = V(m)* V(n)*(G(m,n)*sin(del(m)-del(n)) B(m,n)*cos(del(m)-del(n)));
end
end
end
% J2 - Derivative of Real Power Injections with V..
J2 = zeros(nbus-1,npq);
for i = 1:(nbus-1)
m = i+1;
for k = 1:npq
n = pq(k);
if n == m
for n = 1:nbus
J2(i,k) = J2(i,k) + V(n)*(G(m,n)*cos(del(m)-del(n)) +
B(m,n)*sin(del(m)-del(n)));
end
J2(i,k) = J2(i,k) + V(m)*G(m,m);
else
J2(i,k) = V(m)*(G(m,n)*cos(del(m)-del(n)) + B(m,n)*sin(del(m)del(n)));
end
end
end
% J3 - Derivative of Reactive Power Injections with Angles..
J3 = zeros(npq,nbus-1);
for i = 1:npq
m = pq(i);
for k = 1:(nbus-1)
n = k+1;
if n == m
for n = 1:nbus
J3(i,k) = J3(i,k) + V(m)* V(n)*(G(m,n)*cos(del(m)-del(n)) +
B(m,n)*sin(del(m)-del(n)));
end
J3(i,k) = J3(i,k) - V(m)^2*G(m,m);
else
J3(i,k) = V(m)* V(n)*(-G(m,n)*cos(del(m)-del(n)) B(m,n)*sin(del(m)-del(n)));
end
end
end
% J4 - Derivative of Reactive Power Injections with V..
J4 = zeros(npq,npq);
for i = 1:npq
m = pq(i);
for k = 1:npq
n = pq(k);
if n == m
for n = 1:nbus
J4(i,k) = J4(i,k) + V(n)*(G(m,n)*sin(del(m)-del(n)) B(m,n)*cos(del(m)-del(n)));
end
J4(i,k) = J4(i,k) - V(m)*B(m,m);
else
J4(i,k) = V(m)*(G(m,n)*sin(del(m)-del(n)) - B(m,n)*cos(del(m)del(n)));
end
end
end
J = [J1 J2; J3 J4];
X = inv(J)*M;
dTh = X(1:nbus-1);
dV = X(nbus:end);
% Jacobian Matrix..
% Correction Vector
% Change in Voltage Angle..
% Change in Voltage Magnitude..
% Voltage Angle..
k = 1;
for i = 2:nbus
if type(i) == 3
V(i) = dV(k) + V(i);
k = k+1;
end
end
Iter = Iter + 1;
Tol = max(abs(M));
end
loadflow(nbus,V,del,BMva);
% Voltage Magnitude..
% Tolerance..
% Calling Loadflow.m..
-------------------------------------------------------------------------------------------------------------------------------------------------------| From | To |
P
| Q
| From | To
| P
| Q
| Line Loss
|
|Bus
|Bus
| MW
| MVar | Bus
| Bus
| MW
| MVar
| MW
| MVar
|
-------------------------------------------------------------------------------------------------------------------------------------------------------1
2
157.080 -17.484
2
1
-152.772
30.639
4.309
13.155
-------------------------------------------------------------------------------------------------------------------------------------------------------1
5
75.513
7.981
5
1
-72.740
3.464
2.773
11.445
-------------------------------------------------------------------------------------------------------------------------------------------------------2
3
73.396
5.936
3
2
-71.063
3.894
2.333
9.830
-------------------------------------------------------------------------------------------------------------------------------------------------------2
4
55.943
2.935
4
2
-54.273
2.132
1.670
5.067
-------------------------------------------------------------------------------------------------------------------------------------------------------2
5
41.733
4.738
5
2
-40.813
-1.929
0.920
2.809
-------------------------------------------------------------------------------------------------------------------------------------------------------3
4
-23.137 7.752
4
3
23.528
-6.753
0.391
0.998
-------------------------------------------------------------------------------------------------------------------------------------------------------4
5
-59.585 11.574
5
4
60.064
-10.063
0.479
1.511
-------------------------------------------------------------------------------------------------------------------------------------------------------4
7
27.066
-15.396
7
4
-27.066
17.327
0.000
1.932
----------------------------------------------------------------------------------------------------------------------------------------- --------------4
9
15.464
-2.640
9
4
-15.464
3.932
-0.000
1.292
----------------------------------------------------------------------------------------------------------------------------------------------------- --5
6
45.889
-20.843
6
5
-45.889
26.617
0.000
5.774
-------------------------------------------------------------------------------------------------------------------------------------------------------6
11
8.287
8.898
11
6
-8.165
-8.641
0.123
0.257
-------------------------------------------------------------------------------------------------------------------------------------------------------6
12
8.064
3.176
12
6
-7.984
-3.008
0.081
0.168
-------------------------------------------------------------------------------------------------------------------------------------------------------6
13
18.337
9.981
13
6
-18.085
-9.485
0.252
0.496
-------------------------------------------------------------------------------------------------------------------------------------------------------7
8
-0.000
-20.362
8
7
0.000
21.030
0.000
0.668
-------------------------------------------------------------------------------------------------------------------------------------------------------7
9
27.066
14.798
9
7
-27.066
-13.840
-0.000
0.957
------------------------------------------------------------------------------------------------------------------------------------------------------9
10
4.393
-0.904
10
9
-4.387
0.920
0.006
0.016
-------------------------------------------------------------------------------------------------------------------------------------------------------9
14
8.637
0.321
14
9
-8.547
-0.131
0.089
0.190
-------------------------------------------------------------------------------------------------------------------------------------------------------10
11
-4.613
-6.720
11
10
4.665
6.841
0.051
0.120
-------------------------------------------------------------------------------------------------------------------------------------------------------12
13
1.884
1.408
13
12
-1.873
-1.398
0.011
0.010
-------------------------------------------------------------------------------------------------------------------------------------------------------13
14
6.458
5.083
14
13
-6.353
-4.869
0.105
0.215
-------------------------------------------------------------------------------------------------------------------------------------------------------Total Loss
13.593
56.910
-------------------------------------------------------------------------------------------------------------------------------------------------------#############################################################################################