Power System II Lab 5 Sem
Power System II Lab 5 Sem
EXPERIMENT LIST
6EE4-21: POWER SYSTEM-II LAB
1. Fault analysis (for 3 to 6 bus) and verify the results using MATLAB or any available software
(i) LG Fault (ii) LLG Fault (iii) LL Fault and (iv) 3-Phase Fault.
2. Load flow analysis for a given system (for 3 to 6 bus) using (i) Gauss Seidal (ii) Newton Raphson
(iii) Fast Decoupled Method and verify results using MATLAB or any available software.
3. Three phase short circuit analysis in a synchronous machine (symmetrical fault analysis)
any software.
7. Study of transient stability analysis using MATLAB/ETAP Software. 8. Power flow analysis of
Experiment NO:- 1
AIM:- Fault analysis (for 3 to 6 bus) and verify the results using MATLAB or any available
software for the cases: (i) LG Fault (ii) LLG Fault (iii) LL Fault and (iv) 3-Phase Fault.
THEORY
Symmetrical Fault
Three phase fault
From the thevenin’s equivalent circuit
𝐼𝑎1 = [𝑍 1+𝐸𝑍𝐴2+𝑍0 ]
𝐼𝑎1 = 𝑍 1𝐸+𝑎𝑍2
𝑰𝒂𝟏 = 𝒁𝟐𝑬(𝒁𝒂𝟎+𝟑𝒁𝒇)
𝒁𝟏+𝒁𝟐+𝒁𝟎+𝟑𝒁𝒇
Fault MVA = 3 * If * Vpu where, Ia1, Ia2 and Ia0 are positive, negative and zero
phase sequence currents.
Z1 ,Z2 and Zo are positive, negative and zero phase sequence impedances.
PROCEDURE
1. Enter the command window of the MATLAB.
2. Create a new M – file by selecting File - New – M – File
3. Type and save the program.
4. Execute the program by pressing Tools – Run.
5. View the results.
EXERCISE
The one line diagram of a simple power system is shown in figure. The neutral of each generator is
grounded through a current limiting reactor of 0.25/3 per unit on a 100MVA base. The system data
expressed in per unit on a common 100 MVA base is tabulated below. The generators are running
on no load at their rated voltage and rated frequency with their emf in phase.
Determine the fault current for the following faults.
(a) A balanced three phase fault at bus 3 through a fault impedance, Z f = j0.1 per unit.
(b) A single line to ground fault at bus3 through a fault impedance, Zf = j0.1 per unit.
(c) A line to line fault at bus3 through a fault impedance, Zf = j0.1 per unit.
(d) A double line to ground fault at bus3 through a fault impedance, Z f = j0.1 per unit.
Item Base MVA Voltage 𝑋1 𝑋2 𝑋0
Rating KV
𝐺1 100 20 0.15 0.15 0.05
𝐺2 100 20 0.15 0.15 0.05
𝑇1 100 20/200 0.10 0.10 0.10
𝐿12 100 20/200 0.10 0.10 0.10
𝐿13 100 220 0.125 0.125 0.30
𝐿23 100 220 0.15 0.15 0.35
100 220 0.25 0.25 0.7125
Enter Fault Impedance Zf = R + j*X in complex form (for bolted fault enter 0). Zf = .2
Enter Fault Impedance Zf = R + j*X in complex form (for bolted fault enter 0). Zf = 0
Enter Fault Impedance Zf = R + j*X in complex form (for bolted fault enter 0). Zf = 0
Enter Fault Impedance Zf = R + j*X in complex form (for bolted fault enter 0). Zf = 0
AIM:- Load flow analysis for a given system (for 3 to 6 bus) using Newton Raphson and Fast
Decoupled Method and verify results using MATLAB or any available software.
THEORY:- The Newton Raphson method of load flow analysis is an iterative method which
Approximates the set of non-linear simultaneous equations to a set of linear simultaneous equations
using Taylor’s series expansion and the terms are limited to first order approximation. The load
flow equations for Newton Raphson method are non-linear equations in terms of real and imaginary
part of bus voltages.
% Line code
% Bus bus R X 1/2 B = 1 for lines % nl
nr p.u. p.u. p.u. > 1 or < 1 tr. tap at bus nl linedata=[1
2 0.0192 0.0575 0.02640 1 1 3 0.0452
0.1852 0.02040 1
2 4 0.0570 0.1737 0.01840 1
3 4 0.0132 0.0379 0.00420 1
2 5 0.0472 0.1983 0.02090 1
2 6 0.0581 0.1763 0.01870 1
4 6 0.0119 0.0414 0.00450 1
5 7 0.0460 0.1160 0.01020 1
6 7 0.0267 0.0820 0.00850 1
6 8 0.0120 0.0420 0.00450 1
6 9 0.0 0.2080 0.0 0.978
6 10 0 .5560 0 0.969
9 11 0 .2080 0 1
9 10 0 .1100 0 1
4 12 0 .2560 0 0.932
12 13 0 .1400 0 1
12 14 .1231 .2559 0 1
12 15 .0662 .1304 0 1
12 16 .0945 .1987 0 1
14 15 .2210 .1997 0 1
16 17 .0824 .1923 0 1
15 18 .1073 .2185 0 1
18 19 .0639 .1292 0 1
19 20 .0340 .0680 0 1
10 20 .0936 .2090 0 1
10 17 .0324 .0845 0 1
10 21 .0348 .0749 0 1
10 22 .0727 .1499 0 1
21 22 .0116 .0236 0 1
15 23 .1000 .2020 0 1
22 24 .1150 .1790 0 1
23 24 .1320 .2700 0 1
24 25 .1885 .3292 0 1
25 26 .2544 .3800 0 1
25 27 .1093 .2087 0 1
28 27 0 .3960 0 0.968
27 29 .2198 .4153 0 1
27 30 .3202 .6027 0 1
29 30 .2399 .4533 0 1
8 28 .0636 .2000 0.0214 1
6 28 .0169 .0599 0.065 1];
--Line-- Power at bus & line flow --Line loss-- Transformer from
to MW Mvar MVA MW Mvar tap
Experiment NO:- 3
AIM:-. Load flow analysis for a given system (for 30 bus) using Gauss Seidal.
THEORY
The GAUSS – SEIDEL method is an iterative algorithm for solving a set of non-linear load flow
equations. The non-linear load flow equation is given by
𝑝−1 𝑛
1 𝑃
𝑉𝑝𝑘+1 = 𝑌 𝑝𝑝 [ 𝑝 −𝑉𝑝𝑘𝑗𝑄𝑝 − 𝑞∑−1 𝑌𝑝𝑞𝑉𝑞𝑘+1 −
𝑞=∑𝑝+1 𝑉𝑝𝑘𝑞]
PROCEDURE
1. Enter the command window of the MATLAB.
2. Create a new M – file by selecting File - New – M – File.
3. Type and save the program in the editor Window.
4. Execute the program by pressing Tools – Run.
5. View the results.
EXERCISE
For IEEE 30 bus system find the load flow solution using Gauss seidel Method Data is already
given in previous Experiment
RESULT
Line Flow and Losses
--Line-- Power at bus & line flow --Line loss-- Transformer from
to MW Mvar MVA MW Mvar tap
-
7 -22.800 -10.900 25.272
5 14.356 12.187 18.831 0.151 -1.687
6 -37.156 1.287 37.178 0.367 -0.598
-
14 -6.200 -1.600 6.403
12 -7.782 2.287 8.111 0.075 0.155
15 1.582 0.687 1.724 0.006 0.005
-
22 -1.877 -1.594 2.462 0.001 0.001
-
21 1.877 1.596 2.464 0.001 0.001
24 5.654 2.788 6.304 0.043 0.067
Experiment NO:- 4
AIM:-Study of voltage security analysis.
THEORY:- Reliable operation of large scale electric power networks requires that system
voltages and currents stay within design limits. Operation beyond those limits can lead to
equipment failures and blackouts. Security margins measure the amount by which system loads or
power transfers can change before a security violation, such as an overloaded transmission line, is
encountered. This thesis shows how to efficiently compute security margins defined by limiting
events and instabilities, and the sensitivity of those margins with respect to assumptions, system
parameters, operating policy, and transactions. Security margins to voltage collapse blackouts,
oscillatory instability, generator limits, voltage constraints and line overloads are considered. The
usefulness of computing the sensitivities of these margins with respect to interarea transfers,
loading parameters, generator dispatch, transmission line parameters, and VAR support is
established for networks as large as 1500 buses. The sensitivity formulas presented apply to a range
of power system models.
Conventional sensitivity formulas such as line distribution factors, outage distribution factors,
participation factors and penalty factors are shown to be special cases of the general sensitivity
formulas derived in this thesis. The sensitivity formulas readily accommodate sparse matrix
techniques. Margin sensitivity methods are shown to work effectively for avoiding voltage collapse
blackouts caused by either saddle node bifurcation of equilibria or immediate instability due to
generator reactive power limits. Extremely fast contingency analysis for voltage collapse can be
implemented with margin sensitivity based rankings. Interarea transfer can be limited by voltage
limits, line limits, or voltage stability. The sensitivity formulas presented in this thesis apply to
security margins defined by any limit criteria. A method to compute transfer margins by directly
locating intermediate events reduces the total number of loadflow iterations required by each
margin computation and provides sensitivity information at minimal additional cost. Estimates of
the effect of simultaneous transfers on the transfer margins agree well with the exact computations
for a network model derived from a portion of the U.S grid. The accuracy of the estimates over a
useful range of conditions and the ease of obtaining the estimates suggest that the sensitivity
computations will be of practical value.
Voltage stability margin is a measure of the available transfer capacity, net transfer
capacity, or total transfer capacity. The margin is the difference (or a ratio) between operation and
voltage collapse points based on the KSP (loading, line flow, etc.) and accounts for a pattern of
load increase or generation loss. As a concept for system operators, margin is a straightforward
and easily understood index, and thus, widely accepted. There are a number of advantages of the
stability margin as a collapse index.
• The margin is not based on a particular power system model and can be used with static or
dynamic models independent of the details of the power system dynamics.
• It is an accurate index that takes full account of the power system non-linearity and device
limits as loading is increased.
• Sensitivity analysis may be applied easily and quickly to study the effects of power system
parameters and controls.
• The margin accounts for patterns of load increase.
The primary disadvantage is that it may oversimplify the view of the stability problem
and may not account for the variety of ways in which instabilities can arise. In theory, the
computation of the stability margin should be performed for all contingencies. This would be an
excessively time-consuming process but is generally not necessary in practice. Instead, the
margin is determined based on the most critical contingency from a relatively short list of known
severe contingencies. Key to the analysis is the degree of experience that allows one to identify a
more manageable list of disturbances. Still, the precise computation of the margin is
timeconsuming, thus limiting application for on-line use. The most common methods to estimate
the proximity of the voltage collapse point are the minimum singular value, point of collapse
method, continuation power flow, and optimization methods. Some other methods are sensitivity
analysis, second order performance index, and the energy function method.
Experiment NO:- 5
AIM : Three phase short circuit analysis in a synchronous machine (symmetrical fault
analysis).
THEORY :
Symmetrical Fault :
Unsymmetrical Fault :
Single line to ground fault :
Fault current If = Ia = 3Ia1
Ia1 =Ea
Z1+Z2+Z0
Ea
Ia1 =
Z1 + Z0Z2
Z0+Z2
Ia2 = (- Ia1) * Z0
Z0+Z2
where, Ia1, Ia2 and Ia0 are positive, negative and zero phase sequence currents
Z1 ,Z2 and Zo are positive, negative and zero phase sequence impedances
PROCEDURE:
4. Execute the program by either pressing Tools – Run. View the results.
EXERCISE :
The one line diagram of a simple power system is shown in figure. The neutral of each
generator is grounded through a current limiting reactor of 0.25/3 per unit on a 100MVA
base. The system data expressed in per unit on a common 100 MVA base is tabulated below.
The generators are running on no load at their rated voltage and rated frequency with their
emfs in phase.
(b) A single line to ground fault at bus3 through a fault impedance Zf = j0.1 per unit.
(c) A line to line fault at bus3 through a fault impedance Zf = j0.1 per unit.
(d) A double line to ground fault at bus3 through a fault impedance Zf = j0.1 per unit.
PROGRAM:
zdata1 = [0 1 0 0.25
0 2 0 0.25
1 2 0 0.125
1 3 0 0.15
2 3 0 0.25];
zdata0 = [0 1 0 0.40
0 2 0 0.10
1 2 0 0.30
1 3 0 0.35
2 3 0 0.7125];
zdata2 = zdata1;
Zbus1 = zbuild(zdata1)
Zbus0 = zbuild(zdata0)
Zbus2 = Zbus1;
symfault(zdata1,Zbus1)
lgfault(zdata0, Zbus0, zdata1, Zbus1, zdata2, Zbus2)
llfault(zdata1, Zbus1, zdata2, Zbus2) dlgfault(zdata0,
Zbus0, zdata1, Zbus1, zdata2, Zbus2)
Experiment NO:- 6
PROCEDURE
1. Enter the command window of the MATLAB.
2. Create a new M – file by selecting File - New – M – File
3. Type and save the program.
4. Execute the program by either pressing Tools – Run.
5. View the results
EXERCISE
1. The fuel cost functions for three thermal plants in $/h are given by
C1 = 500 + 5.3 P1 + 0.004 P1
2 ; P1 in MW
C2 = 400 + 5.5 P2 + 0.006 P2
2 ; P2 in MW
C3 = 200 +5.8 P3 + 0.009 P3
2 ; P3 in MW
The total load, PD is 800MW.Neglecting line losses and generator limits, find the optimal
dispatch and the total cost in $/h by analytical method. Verify the result using MATLAB
program.
RESULT:
Total generation cost = 8236.25 $/h
Incremental cost of delivered power (system lambda) = 8.500000 $/MWh Optimal
Dispatch of Generation:
400.0000
250.0000
150.0000
Total system loss = 0 MW
Total generation cost = 6682.50 $/h
Experiment NO:- 7
FORMULA
Reactive power𝑄𝑒
Stator Current 𝐼𝑡 = 𝐸𝑆∗𝑡
= 𝑃𝑒−𝐸𝑡𝑗𝑄∗ 𝑒
Where, 𝑋3 = 𝑋 𝑋11+𝑋𝑋22
𝛿0 = 𝐸′ − 𝐸𝐵 Pre
fault operation:
𝑋 = 𝑗𝑋𝑑′ + 𝑗𝑋𝑡𝑟 + 𝑋𝑋11+𝑋𝑋22
PROCEDURE
1. Enter the command window of the MATLAB.
2. Create a new M – file by selecting File - New – M – File
3. Type and save the program.
4. Execute the program by pressing Tools – Run
5. View the results.
EXERCISE
1. Transient stability analysis of a 9-bus, 3-machine, 60 Hz power system with the following system
modeling requirements:
i. Classical model for all synchronous machines, models for excitation and speed governing systems
not included.
(a) Simulate a three-phase fault at the end of the line from bus 5 to bus 7 near bus 7 at time = 0.0 sec.
Assume that the fault is cleared successfully by opening the line 5-7 after 5 cycles ( 0.083 sec)
. Observe the system for 2.0 seconds
(b) Obtain the following time domain plots:
- Relative angles of machines 2 and 3 with respect to machine 1
- Angular speed deviations of machines 1, 2 and 3 from synchronous speed - Active power
variation of machines 1, 2 and 3.
(c) Determine the critical clearing time by progressively increasing the fault clearing time.
RESULT
Experiment NO:- 8
Aim: To perform power flow analysis of a slack bus connected to different loads.
Apparatus: MATLAB-PSAT
Theory:
Slack Bus: To calculate the angles θi (as discussed above), a reference angle (θi = 0) needs to
be specified so that all the other bus voltage angles are calculated with respect to this reference
angle. Moreover, physically, total power supplied by all the generation must be equal to the sum
of total load in the system and system power loss. However, as the system loss cannot be
computed before the load flow problem is solved, the real power output of all the generators in
the system cannot be pre-specified. There should be at least one generator in the system which
would supply the loss (plus its share of the loads) and thus for this generator, the real power
output can’t be pre-specified. However, because of the exciter action, Vi for this generator can
still be specified. Hence for this generator, Vi and θi(= 0) are specified and the quantities Pi and
Qi are calculated. This generator bus is designated as the slack bus. Usually, the largest
generator in the system is designated as the slack bus.
In the General Load Flow Problem the Bus with largest generating capacity is taken as the
Slack Bus or Swing Bus. The Slack Bus Voltage is taken to be 1.0 + j 0 P.U. and should be
capable of supplying total Losses in the System. But usually the generator bus are only having
station auxiliary which may be only up to 3% of total generation . If the Generation at Slack
Bus is more it can take more load connected to the slack bus.
A slack bus is usually a generator bus with a large real and reactive power output. It is assumed
that its real and reactive power outputs are big enough that they can be adjusted as required in
order to balance the power in the whole system so that the power flow can be solved. A slack
bus can have load on it because in real systems it is actually the bus of a power plant, which can
have its own load. It also takes care of the Line losses
Circuit Diagram:
Procedure :
PROGRAM 3
function eacpower(P0, E, V, X)
if exist('P0')~=1
P0 = input('Generator initial power in p.u. P0 = '); else, end if
exist('E')~=1
E = input('Generator e.m.f. in p.u. E = '); else, end if
exist('V')~=1
V = input('Infinite bus-bar voltage in p.u. V = '); else, end if
exist('X')~=1
X = input('Reactance between internal emf and infinite bus in p.u. X = '); else, end
Pemax= E*V/X; if
P0 >= Pemax
fprintf('\nP0 must be less than the peak electrical power Pemax = %5.3f p.u. \n', Pemax)
fprintf('Try again. \n\n') return, end
d0=asin(P0/Pemax);
delta = 0:.01:pi; Pe =
Pemax*sin(delta);
dmax=pi; Ddmax=1;
while abs(Ddmax) > 0.00001
Df = cos(d0) - (sin(dmax)*(dmax-d0)+cos(dmax));
J=cos(dmax)*(dmax-d0);
Ddmax=Df/J;
dmax=dmax+Ddmax;
end dc=pi-dmax;
Pm2=Pemax*sin(dc);
Pmx =[0 pi-d0]*180/pi; Pmy=[P0 P0]; Pm2x=[0
dmax]*180/pi; Pm2y=[Pm2 Pm2];
x0=[d0 d0]*180/pi; y0=[0 Pm2]; xc=[dc dc]*180/pi; yc=[0 Pemax*sin(dc)];
xm=[dmax dmax]*180/pi; ym=[0 Pemax*sin(dmax)];
d0=d0*180/pi; dmax=dmax*180/pi; dc=dc*180/pi;
x=(d0:.1:dc); y=Pemax*sin(x*pi/180);
%y1=Pe2max*sin(d0*pi/180);
%y2=Pe2max*sin(dc*pi/180);
x=[d0 x dc]; y=[Pm2 y
Pm2]; xx=dc:.1:dmax;
h=Pemax*sin(xx*pi/180)
; xx=[dc xx dmax];
hh=[Pm2 h Pm2];
delta=delta*180/pi;
%clc
fprintf('\nInitial power =%7.3f p.u.\n', P0)
fprintf('Initial power angle =%7.3f degrees \n', d0)
fprintf('Sudden additional power =%7.3f p.u.\n', Pm2-P0)
fprintf('Total power for critical stability =%7.3f p.u.\n', Pm2)
fprintf('Maximum angle swing =%7.3f degrees \n', dmax)
fprintf('New operating angle =%7.3f degrees \n\n\n', dc)
fill(x,y,'m') hold; fill(xx,hh,'c')
plot(delta, Pe,'-', Pmx, Pmy,'g', Pm2x,Pm2y,'g', x0,y0,'c', xc,yc, xm,ym,'r'), grid
Title('Equal-area criterion applied to the sudden change in power') xlabel('Power
angle, degree'), ylabel(' Power, per unit')
axis([0 180 0 1.1*Pemax])
hold off;
PROGRAM ............................................................................................................................................ 27
zdata1 = [0 1 0 0 ...................................................................................................................................... 27
0 2 0 0 ...................................................................................................................................... 27
1 2 0 0.125
1 3 0 0.15
2 3 0 0.25];
zdata0 = [0 1 0 0.40
0 2 0 0.10
1 2 0 0.30
1 3 0 0.35
2 3 0 0.7125]; zdata2 =
zdata1; Zbus1 =
zbuild(zdata1)
Zbus0 = zbuild(zdata0) Zbus2 = Zbus1;
symfault(zdata1,Zbus1) lgfault(zdata0, Zbus0,
zdata1, Zbus1, zdata2, Zbus2) llfault(zdata1, Zbus1,
zdata2, Zbus2) dlgfault(zdata0, Zbus0, zdata1, Zbus1,
zdata2, Zbus2)
PROGRAM 5
function dlgfault(zdata0, Zbus0, zdata1, Zbus1, zdata2, Zbus2, V)
if exist('zdata2') ~= 1
zdata2=zdata1; else,
end if exist('Zbus2')
~= 1
Zbus2=Zbus1;
else, end
nl = zdata1(:,1); nr = zdata1(:,2); nl0 = zdata0(:,1); nr0
= zdata0(:,2); nbr=length(zdata1(:,1)); nbus =
max(max(nl), max(nr)); nbr0=length(zdata0(:,1)); R0 =
zdata0(:,3); X0 = zdata0(:,4);
R1 = zdata1(:,3); X1 = zdata1(:,4);
R2 = zdata2(:,3); X2 = zdata2(:,4);
for n = 1:nbus
Vf0(n)= 0 - Zbus0(n, nf)*Ia0;
Vf1(n)= V0(n) - Zbus1(n, nf)*Ia1;
Vf2(n)= 0 - Zbus2(n, nf)*Ia2;
Vabc = sctm*[Vf0(n); Vf1(n); Vf2(n)]; Va(n)=Vabc(1);
Vb(n)=Vabc(2); Vc(n)=Vabc(3); fprintf(' %5g',n) fprintf('
%11.4f', abs(Va(n))),fprintf(' %11.4f', abs(Vb(n))) fprintf('
%11.4f\n', abs(Vc(n))) end
fprintf(' \n') fprintf('Line currents for fault at bus No. %g\n\n',
nf) fprintf(' From To -----Line Current Magnitude----
\n') fprintf(' Bus Bus Phase a Phase b Phase c \n')
for n= 1:nbus for I = 1:nbr if nl(I) == n | nr(I) == n if
nl(I) ==n k = nr(I); elseif nr(I) == n k = nl(I); end
if k ~= 0
Ink1(n, k) = (Vf1(n) - Vf1(k))/ZB1(I);
Ink2(n, k) = (Vf2(n) - Vf2(k))/ZB2(I);
else, end else, end end for I = 1:nbr0
if nl0(I) == n | nr0(I) == n if nl0(I) ==n
k = nr0(I); elseif nr0(I) == n k = nl0(I);
end
if k ~= 0
Ink0(n, k) = (Vf0(n) - Vf0(k))/ZB0(I);
else, end else, end end for I = 1:nbr
if nl(I) == n | nr(I) == n if nl(I) ==n
k = nr(I); elseif nr(I) == n k = nl(I);
end if k ~= 0
Inkabc = sctm*[Ink0(n, k); Ink1(n, k); Ink2(n, k)]; Inkabcm
= abs(Inkabc); th=angle(Inkabc); if real(Inkabc(2)) < 0
fprintf('%7g', n), fprintf('%10g', k), fprintf(' %11.4f',
abs(Inkabc(1))),fprintf(' %11.4f', abs(Inkabc(2))) fprintf('
%11.4f\n', abs(Inkabc(3))) elseif real(Inkabc(2)) ==0 &
imag(Inkabc(2)) > 0 fprintf('%7g', n), fprintf('%10g', k),
fprintf(' %11.4f', abs(Inkabc(1))),fprintf(' %11.4f', abs(Inkabc(2)))
fprintf(' %11.4f\n', abs(Inkabc(3))) else, end else, end
else, end end if n==nf fprintf('%7g',n), fprintf(' F'), fprintf('
%11.4f', Ifabcm(1)),fprintf(' %11.4f', Ifabcm(2)) fprintf(' %11.4f\n',
Ifabcm(3)) else, end end
resp=0; while strcmp(resp, 'n')~=1 & strcmp(resp, 'N')~=1 & strcmp(resp, 'y')~=1 & strcmp(resp,
'Y')~=1 resp = input('Another fault location? Enter ''y'' or ''n'' within single quote -> '); if
strcmp(resp, 'n')~=1 & strcmp(resp, 'N')~=1 & strcmp(resp, 'y')~=1 & strcmp(resp, 'Y')~=1
fprintf('\n Incorrect reply, try again \n\n'), end end if resp == 'y' | resp == 'Y' nf = 999; else
ff = 0; end end % end for while
PROGRAM 6
for k=1:nbr0
if R0(k)==inf | X0(k) ==inf
R0(k) = 99999999; X0(k) = 99999999;
else, end end
ZB1 = R1 + j*X1; ZB0 = R0 + j*X0;
ZB2 = R2 + j*X2;
if exist('V') == 1
if length(V) == nbus
V0 = V; else, end
else, V0 = ones(nbus, 1) + j*zeros(nbus, 1); end
fprintf('\nLine-to-ground fault analysis \n')
ff = 999; while ff > 0
nf = input('Enter Faulted Bus No. -> ');
rtn=isempty(nf); if rtn==1; nf=-1;
end while nf <= 0 | nf > nbus
fprintf('Faulted bus No. must be between 1 & %g \n', nbus)
nf = input('Enter Faulted Bus No. -> '); rtn=isempty(nf);
if rtn==1; nf=-1; end
end rtz=1;
while rtz==1
fprintf('\nEnter Fault Impedance Zf = R + j*X in ') Zf =
input('complex form (for bolted fault enter 0). Zf = ');
rtz=isempty(Zf);
end fprintf('
\n')
fprintf('Single line to-ground fault at bus No. %g\n', nf)
a =cos(2*pi/3)+j*sin(2*pi/3); sctm = [1 1 1; 1 a^2
a; 1 a a^2];
Ia0 = V0(nf)/(Zbus1(nf,nf)+Zbus2(nf, nf)+ Zbus0(nf, nf)+3*Zf); Ia1=Ia0; Ia2=Ia0;
I012=[Ia0; Ia1; Ia2];
Ifabc = sctm*I012; Ifabcm = abs(Ifabc); fprintf('Total fault
current = %9.4f per unit\n\n', Ifabcm(1)) fprintf('Bus
Voltages during the fault in per unit \n\n') fprintf(' Bus
-------Voltage Magnitude------- \n') fprintf(' No. Phase
a Phase b Phase c \n')
for n = 1:nbus
Vf0(n)= 0 - Zbus0(n, nf)*Ia0;
Vf1(n)= V0(n) - Zbus1(n, nf)*Ia1;
Vf2(n)= 0 - Zbus2(n, nf)*Ia2;
Vabc = sctm*[Vf0(n); Vf1(n); Vf2(n)];
Va(n)=Vabc(1); Vb(n)=Vabc(2); Vc(n)=Vabc(3); fprintf('
%5g',n)
fprintf(' %11.4f', abs(Va(n))),fprintf(' %11.4f', abs(Vb(n)))
fprintf(' %11.4f\n', abs(Vc(n))) end
fprintf(' \n')
fprintf('Line currents for fault at bus No. %g\n\n', nf) fprintf('
From To -----Line Current Magnitude---- \n')
fprintf(' Bus Bus Phase a Phase b Phase c \n')
for n= 1:nbus for I = 1:nbr if nl(I) == n | nr(I) == n
if nl(I) ==n k = nr(I); elseif nr(I) == n k = nl(I);
end
if k ~= 0
Ink1(n, k) = (Vf1(n) - Vf1(k))/ZB1(I);
Ink2(n, k) = (Vf2(n) - Vf2(k))/ZB2(I);
else, end else, end end for I = 1:nbr0
if nl0(I) == n | nr0(I) == n if nl0(I) ==n
k = nr0(I); elseif nr0(I) == n k = nl0(I);
end
if k ~= 0
Ink0(n, k) = (Vf0(n) - Vf0(k))/ZB0(I);
else, end else, end end for I = 1:nbr
if nl(I) == n | nr(I) == n if nl(I) ==n
k = nr(I); elseif nr(I) == n k = nl(I);
end
if k ~= 0
Inkabc = sctm*[Ink0(n, k); Ink1(n, k); Ink2(n, k)];
Inkabcm = abs(Inkabc); th=angle(Inkabc); if
real(Inkabc(1)) > 0 fprintf('%7g', n),
fprintf('%10g', k),
fprintf(' %11.4f', abs(Inkabc(1))),fprintf(' %11.4f', abs(Inkabc(2)))
fprintf(' %11.4f\n', abs(Inkabc(3))) elseif real(Inkabc(1)) ==0 &
imag(Inkabc(1)) < 0
fprintf('%7g', n), fprintf('%10g', k),
fprintf(' %11.4f', abs(Inkabc(1))),fprintf(' %11.4f', abs(Inkabc(2)))
fprintf(' %11.4f\n', abs(Inkabc(3)))
else, end
else, end else,
end end
if n==nf
fprintf('%7g',n), fprintf(' F'),
fprintf(' %11.4f', Ifabcm(1)),fprintf(' %11.4f', Ifabcm(2))
fprintf(' %11.4f\n', Ifabcm(3))
else, end
end resp=0;
while strcmp(resp, 'n')~=1 & strcmp(resp, 'N')~=1 & strcmp(resp, 'y')~=1 & strcmp(resp, 'Y')~=1
resp = input('Another fault location? Enter ''y'' or ''n'' within single quote -> ');
if strcmp(resp, 'n')~=1 & strcmp(resp, 'N')~=1 & strcmp(resp, 'y')~=1 & strcmp(resp, 'Y')~=1
fprintf('\n Incorrect reply, try again \n\n'), end end
if resp == 'y' | resp == 'Y'
nf = 999; else ff = 0; end
end % end for while
%Ink0
%Ink1
%Ink2
nl = zdata1(:,1); nr = zdata1(:,2); R1
= zdata1(:,3); X1 = zdata1(:,4);
R2 = zdata2(:,3); X2 = zdata2(:,4); ZB1
= R1 + j*X1; ZB2 = R2 + j*X2;
nbr=length(zdata1(:,1)); nbus = max(max(nl), max(nr));
if exist('V') == 1 if length(V) == nbus V0 = V;
else, end
else, V0 = ones(nbus, 1) + j*zeros(nbus, 1); end
fprintf('\nLine-to-line fault analysis \n')
ff = 999; while ff > 0
nf = input('Enter Faulted Bus No. -> ');
rtn=isempty(nf); if rtn==1; nf=-1;
end while nf <= 0 | nf > nbus
fprintf('Faulted bus No. must be between 1 & %g \n', nbus)
nf = input('Enter Faulted Bus No. -> '); rtn=isempty(nf);
if rtn==1; nf=-1; end
end rtz=1; while rtz==1 fprintf('\nEnter Fault
Impedance Zf = R + j*X in ') Zf = input('complex form
(for bolted fault enter 0). Zf = '); rtz=isempty(Zf); end
fprintf(' \n')
fprintf('Line-to-line fault at bus No. %g\n', nf)
a =cos(2*pi/3)+j*sin(2*pi/3); sctm
= [1 1 1; 1 a^2 a; 1 a a^2];
Ia0=0;
Ia1 = V0(nf)/(Zbus1(nf,nf)+Zbus2(nf, nf)+Zf); Ia2=-Ia1;
I012=[Ia0; Ia1; Ia2];
Ifabc = sctm*I012; Ifabcm = abs(Ifabc); fprintf('Total fault
current = %9.4f per unit\n\n', Ifabcm(2)) fprintf('Bus
Voltages during the fault in per unit \n\n') fprintf(' Bus
-------Voltage Magnitude------- \n')
fprintf(' No. Phase a Phase b Phase c \n')
for n = 1:nbus
Vf0(n)= 0;
Vf1(n)= V0(n) - Zbus1(n, nf)*Ia1;
Vf2(n)= 0 - Zbus2(n, nf)*Ia2;
Vabc = sctm*[Vf0(n); Vf1(n); Vf2(n)]; Va(n)=Vabc(1);
Vb(n)=Vabc(2); Vc(n)=Vabc(3); fprintf(' %5g',n)
fprintf(' %11.4f', abs(Va(n))),fprintf(' %11.4f', abs(Vb(n))) fprintf('
%11.4f\n', abs(Vc(n)))
end
fprintf(' \n')
fprintf('Line currents for fault at bus No. %g\n\n', nf) fprintf('
From To -----Line Current Magnitude---- \n') fprintf('
Bus Bus Phase a Phase b Phase c \n')
for n= 1:nbus
for I = 1:nbr
if nl(I) == n |
nr(I) == n
if nl(I) ==n k
= nr(I);
elseif nr(I) == n
k = nl(I);
end if k
~= 0 Ink0(n,
k) = 0;
Ink1(n, k) = (Vf1(n) - Vf1(k))/ZB1(I);
Ink2(n, k) = (Vf2(n) - Vf2(k))/ZB2(I);
for n = 1:nbus
if n==nf
Vf(nf) = V0(nf)*Zf/(Zf + Zbus(nf,nf)); Vfm = abs(Vf(nf)); angv=angle(Vf(nf))*180/pi;
else, Vf(n) = V0(n) - V0(n)*Zbus(n,nf)/(Zf + Zbus(nf,nf));
Vfm = abs(Vf(n)); angv=angle(Vf(n))*180/pi;
end
fprintf(' %4g', n), fprintf('%13.4f', Vfm),fprintf('%13.4f\n', angv)
end
fprintf(' \n')
if n==nf
fprintf('%7g',n), fprintf(' F'), fprintf('%12.4f', Ifm)
fprintf('%12.4f\n', Ifmang)
else, end end resp=0;
while strcmp(resp, 'n')~=1 & strcmp(resp, 'N')~=1 & strcmp(resp, 'y')~=1 & strcmp(resp, 'Y')~=1
resp = input('Another fault location? Enter ''y'' or ''n'' within single quote -> ');
if strcmp(resp, 'n')~=1 & strcmp(resp, 'N')~=1 & strcmp(resp, 'y')~=1 & strcmp(resp, 'Y')~=1
fprintf('\n Incorrect reply, try again \n\n'), end end
if resp == 'y' | resp == 'Y'
nf = 999; else ff = 0; end
end % end for while
PROGRAM 9
%Gauss Sedial
clc; data=[1 1 2 10-j*20 2 1 3 10-j*30 3
2 3 16-j*32] elements=max(data(:,1));
bus=max(max(data(:,2)),max(data(:,3)))
; y=zeros(bus,bus); for p=1:bus, for
q=1:elements,
if(data(q,2)==p|data(q,3)==p)
y(p,p)=y(p,p)+data(q,4); end end end for
p=1:bus,
for q=1:bus, if (p~=q) for r=1:elements
if((data(r,2)==p&data(r,3)==q)|(data(r,2)==q&data(r,3)==p))
y(p,q)=-(data(r,4)); end end end end end a1=input('enter p2
in MW:'); b1=input('enter q2 in MVAR:'); a2=input('enter p3
in MW:'); b2=input('enter q3 in MVAR'); pu=input('enter the
base value in MVA'); p2=(a1/pu); q2=(b1/pu); p3=(a2/pu);
q3=(b2/pu); dx1=1+j*0; dx2=1+j*0; v1=1.05; v2=1+j*0;
v3=1+j*0; iter=0; disp('iter v2 v3');
while(abs(dx1)&abs(dx2)>=0.00001)&iter<7; iter=iter+1;
g1=(((p2-j*q2)/conj(v2))+(-y(1,2)*v1)+(-y(2,3)*v3))/y(2,2);
g2=(((p3-j*q3)/conj(v3))+(-y(1,3)*v1)+(-y(2,3)*g1))/y(3,3);
dx1=g1-v2;
dx2=g2-v3; v2=v2+dx1;
v3=v3+dx2;
fprintf ('%g',iter),disp([v2,v3]); end
PROGRAM:-11