Print-PSA Lab-2023
Print-PSA Lab-2023
MATLAB PROGRAM:-
clear;
clc;
basemva =100;
nbus=5;
linedata=[ 1 2 0.02 0.06 0.03 1
1 3 0.08 0.24 0.025 1
2 3 0.06 0.18 0.02 1
2 4 0.06 0.18 0.02 1
2 5 0.04 0.12 0.015 1
3 4 0.01 0.03 0.01 1
4 5 0.08 0.24 0.025 1];
nline=length(linedata(:,1));
j=sqrt(-1);
for k = 1:nline
lp(k)=linedata(k,1);
lq(k)=linedata(k,2);
r(k)=linedata(k,3);
x(k)=linedata(k,4);
ysh(k)=linedata(k,5);
a(k)=linedata(k,6);
z(k)=r(k)+j*x(k);
y(k)=1/z(k);
end
ybus=zeros(nbus,nbus);
for k=1:nline
ylp(k) =[1/(a(k)^2)-1/a(k)]*y(k);
ylq(k)=[1-1/a(k)]*y(k);
y(k)=y(k)/a(k);
end
for k=1:nline
ybus(lp(k),lq(k))=ybus(lp(k),lq(k))-y(k);
ybus(lq(k),lp(k))= ybus(lp(k),lq(k));
ybus(lp(k),lp(k))=ybus(lp(k),lp(k))+y(k)+ylp(k)+j*ysh(k);
ybus(lq(k),lq(k))=ybus(lq(k),lq(k))+y(k)+ylq(k)+j*ysh(k);
end
ybus
1
2
EXPERIMENT-2
FORMATION OF ZBUS USING ZBUS BUILDING ALGORITHM
MATLAB PROGRAM:-
clear all;
close all;
clc;
zbus=[0];
q=1;
j=sqrt(-1);
i=0;
while q==1
Case = input('which case is to be implemented=')
if Case == 1
if i==0
zb= input('Enter the value of impedance=')
zbus=[zb]
end
if i>0
zb=input('Enter the value of impedance=')
l=Length(zb1);
for d=1: l+1
for e=i: l+1
if d<=1 && e<=1
zbus1(d,e)=zb1(d,e);
end
if d== l +1 && e== l +1
zbus1(d,e)=zb;
end
if d== l +1 && d~=e || e== l +1 && d~=e
zbus1(d,e)=0;
end
end
end
zbus=[zbus1]
end
end
if Case == 2
z_new =input('Enter the value of impedance for new bus =')
m= length(zbus);
for a=1:m
for b=1:m
z_temp(a,b) = zbus(a,b)
end
3
end
for c = 1:m
z_temp(c,m+1) =zbus(c,m);
z_temp(m+1,c) =zbus(c,m);
z_temp(m+1,m+1)= zbus(m,m)+z_new;
end
zbus = [z_temp]
i = i+1;
end
if Case == 3
z_new = input('Enter the value of impedance =');
m = length(zbus);
for a=1:m
for b=1:m
z_temp(a,b) = zbus(a,b);
end
end
for c = 1:m
z_temp(c,m+1) = zbus(c,m);
z_temp(m+1,c) = zbus(m,c);
z_temp(m+1,m+1) = zbus(m,m)+z_new;
end
zbus = [z_temp];
m = length(zbus);
for i=1:m-1
for k =1:m-1
z(i,k) = zbus(i,k) - ((zbus(i,m)*zbus(m,k))/zbus(m,m));
end
end
zbus = [z]
end
if Case == 4
z1 = input('Enter the value of impedance = ');
j = input('Enter the value of bus j = ');
k = input('Enter the value of bus k = ');
m = length(zbus);
for a=1:m
for b=1:m
z_temp(a,b) = zbus(a,b);
end
end
for c = 1:m
z_temp(c,m+1) = zbus(c,j)-zbus(c,k);
z_temp(m+1,c) = z_temp(c,m+1);
end
z_temp(m+1,m+1) = z1+zbus(j,j)+zbus(k,k)-2*zbus(j,k);
zbus = [z_temp];
4
m = length(zbus);
for i=1:m-1
for k = 1:m-1
z(i,k) = zbus(i,k) - ((zbus(i,m)*zbus(m,k))/zbus(m,m));
end
end
zbus = [z]
end
q = input('do you want to quit = ');
zb1 = [zbus];
end
5
EXPERIMENT-3
6
GAUSS-SEIDEL METHOD
Aim : To conduct Load Flow analysis for the given 4-Bus system using Gauss-Seidel method
% Y-BUS FORMATION
clear;
clc;
basemva=100;
% n code v delta Pg Qg Pd Qd Qmin Qmax Qsh
busdata = [ 1 0 1.04 0 0 0 0 0 0 0 0
2 1 1.04 0 100 0 50 0 20 100 0
3 2 1.00 0 0 0 100 -50 0 0 0
4 2 1.00 0 0 0 -30 10 0 0 0];
% lp lq r x ysh tap
linedata =[ 1 2 0.05 0.15 0.0 1
1 3 0.1 0.3 0.0 1
2 3 0.15 0.45 0.0 1
2 4 0.1 0.3 0.0 1
3 4 0.05 0.15 0.0 1];
nline=length(linedata(:,1));
j=sqrt(-1);
i=sqrt(-1);
for k=1:nline
lp(k)=linedata(k,1);
lq(k)=linedata(k,2);
r(k)=linedata(k,3);
x(k)=linedata(k,4);
ysh(k)=linedata(k,5);
a(k)=linedata(k,6);
z(k)= r(k)+j*x(k);
y(k)=1/z(k);
end
nbus=length(busdata(:,2));
ybus=zeros(nbus,nbus);
% PI METHOD FOR OFF-NOMINAL ADMITTANCE OF TRANSFORMER
for k=1:nline
ylp(k)=[1/(a(k)^2)-1/a(k)]*y(k);
ylq(k)=[1-1/a(k)]*y(k);
y(k)=y(k)/a(k);
7
end
for k=1:nline
ybus(lp(k),lq(k))=ybus(lp(k),lq(k))-y(k);
ybus(lq(k),lp(k))=ybus(lp(k),lq(k));
ybus(lp(k),lp(k))=ybus(lp(k),lp(k))+y(k)+ylp(k)+0.5*j*ysh(k);
ybus(lq(k),lq(k))=ybus(lq(k),lq(k))+y(k)+ylq(k)+0.5*j*ysh(k);
end
% Load flow solution by Gauss-Seidel Method
nbus=length(busdata(:,1));
for n=1:nbus
bus(n)=busdata(n,1);
kb(n)=busdata(n,2);
vm(n)=busdata(n,3);
delta(n)=busdata(n,4);
Pg(n)=busdata(n,5);
Qg(n)=busdata(n,6);
Pd(n)=busdata(n,7);
Qd(n)=busdata(n,8);
Qmin(n)=busdata(n,9);
Qmax(n)=busdata(n,10);
Qsh(n)=busdata(n,11);
delta(n)=pi/180*delta(n);
e(n)=vm(n)*cos(delta(n))+j*vm(n)*sin(delta(n));
P(n)=(Pg(n)-Pd(n))/basemva;
Q(n)=(Qg(n)-Qd(n))/basemva;
S(n)=P(n)+j*Q(n);
dv(n)=0;
end
maxerror=0.1;
iter=0;
for n=1:nbus
vc(n)=0+0*j;
vnew(n)=0+0*j;
8
end
while (maxerror>0.00001 & iter<15)
for m=1:nbus
for n=1:nbus
yv(n)=0+0*j;
end
if kb(m)==0 % Slack bus
vc(m)=vm(m);
e(m)=vc(m) ;
end
if kb(m)==2 %Load bus
(k+1 ) 1
%V p = ¿
Y pp
for k=1:nbus
if k~=m
yv(m)=yv(m)+ybus(m,k)*e(k);
end
end
vc(m)=(conj(S(m))/conj(e(m))-yv(m))/ybus(m,m);
% Vp(k+1) (accelerated) = Vp(k) + a (Vpk+1 -Vpk)
error(m)=abs(vc(m)-e(m));
e(m)=e(m)+1.4*(vc(m)-e(m));
end
if kb(m)==1 %Generator bus
n
% Ip = ∑ Y pq V q
q =1
% Ip = YppVp + ∑ Y pq V q
q =1
q≠ p
% S = VI*; S* = V*I; P - jQ = V*I ; Q = - imag (V*I)
n
9
end
cos(m)=real(e(m))/abs(e(m));
sin(m)=imag(e(m))/abs(e(m));
e(m)=vm(m)*cos(m)+j*vm(m)*sin(m);
Qnew(m)=-imag(conj(e(m))*(yv(m)+ybus(m,m)*e(m)))*100;
if(Qnew(m))<Qmin(m)
Q(m)=Qmin(m)/basemva;
S(m)=P(m)+j*Q(m);
e(m)=1.0+0*j;
vc(m)=((conj(S(m))/conj(e(m)))-yv(m))/ybus(m,m);
e(m)=e(m)+1.4*(vc(m)-e(m));
elseif Qnew(m) >Qmax(m)
Q(m)=Qmax(m)/basemva;
S(m)=P(m)+j*Q(m);
e(m)=1+0*j;
vc(m)=((conj(S(m))/conj(e(m)))-yv(m))/ybus(m,m);
e(m)=e(m)+1.4*(vc(m)-e(m));
else
Q(m)=Qnew(m)/basemva;
S(m)=P(m)+j*Q(m);
vc(m)=((conj(S(m))/conj(e(m)))-yv(m))/ybus(m,m);
% Vi (new) = Vispecified Cosm
cos(m)=real(vc(m))/(abs(vc(m)));
sin(m)=imag(vc(m))/(abs(vc(m)));
vnew(m)=vm(m)*cos(m)+j*vm(m)*sin(m);
e(m)=vnew(m);
end
end
end
maxerror=max(error);
iter=iter+1;
iter
e
end
10
% CALCULATION OF LINE POWER FLOWS
ysh=zeros(nbus,nbus);
yln=zeros(nbus,nbus);
for k=1:nline
yln(lp(k),lq(k))=yln(lp(k),lq(k))+y(k);
yln(lq(k),lp(k))=yln(lp(k),lq(k));
ysh(lp(k),lq(k))=ysh(lp(k),lq(k))+j*ysh(k);
ysh(lq(k),lp(k))=ysh(lp(k),lq(k));
end
for i=1:nbus
for k=1:nbus
sln(i,k)=0+0*i;
end
end
% Spq = VI* = {Vp [(Vp -Vq )*Y*lnpq]+ Vp.Vp*Y*shpq}
for m=1:nbus
for n=1:nbus
sln(m,n)=((e(m)*(conj(e(m))-conj(e(n)))*conj(yln(m,n)))+
(e(m)*conj(e(m))*conj(ysh(m,n))))*basemva;
end
end
sln
11
12
13
14
EXPERIMENT - 4
SHORT CIRCUIT ANALYSIS IN A POWER SYSTEM
15
Zero sequence impedance of the line : 1.0 + j 0.30
* Convert impedance to Inductance/kilometer and resistance/ kilometer Apply a
very minimal value for capacitance may be give n, so that it can be neglected
(approximately 0.000001)
9. Select “Series RLC Branch” as load and specify the parameters
Positive sequence: 3+j0.25
* Convert reactance to Inductance
10. Select “Three phase fault” block to form SLG fault and specify the parameters
Select phase A to ground fault
Fault resistance : 0.01ohms
Ground resistance: 0.01ohms
The fault transition time shall be 0.1s and 0.3s.
11. Measurements blocks are connected suitably to show the current and voltage
waveforms
12. Setup the simulation time as 4seconds and obtain the waveforms of the fault
current and the phase to ground voltages.
16
17
EXPERIMENT-5
TRANSIENT STABILITY ANALYSIS BY “POINT BY POINT METHOD”
Aim: To perform transient stability analysis and draw Swing Curve for the given power
system Network by Point by Point Method.
clear;
clc;
t=0;
tf=0;
tfinal=0.5;
tc=0.125; %(FOR FAULT CLEARED AT 2.5 CYCLES:tc=0.05,
6.25CYCLES:tc=0.125, SUSTAINED FAULT:tc=0.5to1.0)
tstep=0.05;
M=2.52/(180*50); % M = H/πf
i=2;
delta=21.64*pi/180;
ddelta=0;
time(1)=0;
ang(1)=21.64;
pm=0.9;
pmaxbf=2.44;
pmaxdf=0.88;
pmaxaf=2.00;
d2 δ
M 2 =Ps −Pe =Pa
dt
%
d2 δ
M =Ps −Pm Sin δ
dt 2
%
% M: Moment of Inertia ; : Torque angle; Ps = Shaft Power,
% Pe = Electromagnetic Power ; Pa : Accelerating Power
while t<tfinal
if t==tf
paminus=0.9-pmaxbf*sin(delta);
paplus=0.9-pmaxdf*sin(delta);
paav=(paminus+paplus)/2;
pa=paav;
18
end
if(t==tc)
paminus=0.9-pmaxdf*sin(delta);
paplus=0.9-pmaxaf*sin(delta);
paav=(paminus+paplus)/2;
pa=paav;
end
if(t>tf&t<tc)
pa=0.9-pmaxdf*sin(delta);
end
if(t>tc)
pa=0.9-pmaxaf*sin(delta);
end
t
pa
% ∆n = ∆n-1 + [Pa(n-1). ∆t2]/M
ddelta=ddelta+(tstep*tstep*pa/M);
% n = n-1 + ∆n
delta=(delta*180/pi+ddelta)*pi/180;
deltadeg=delta*180/pi;
t=t+tstep;
pause
time(i)=t;
ang(i)=deltadeg
i=i+1;
end
axis ([0 0.6 0 160])
plot(time,ang,'ko-')
grid
19
20
21
22
23
EXPERIMENT-6
CONTINGENCY ANALYSIS
Line data:
24
Procedure:
1. Open Power World Simulator.
2. Click on ‘File’ tab on top right corner of the simulator window.
3. Select ‘New Case’ and click on it. This opens a new .pwd file where various components of
the power system are to be placed and connected.
4. Select ‘Edit Mode’.
5. Click on ‘Draw’ tab.
6. Click on ‘Network’ icon.
7. Select a ‘Bus’ from components listed under ‘Network’ icon and place it in the presently
opened .pwd file. A dialogue box corresponding to this bus bar is opened, in which name
of the bus bar (if any), voltage rating (in kV), etc., can be given. Select ‘System Slack bus’
option under the ‘Bus Information’ tab in the dialogue box. Specify the Voltage
magnitude (in pu) and Voltage angle (in degrees) in this tab.
8. Select rest of the buses in the system from components listed under ‘Network’ icon and
place them in the presently opened .pwd file. Mention Voltage magnitude (in pu) if the
selected bus is a PV bus else leave the default value (flat voltage profile) unchanged.
9. Select a ‘Transmission Line’ from components listed under ‘Network’ icon and place it in
between respective buses in the presently opened .pwd file by first clicking on the
sending end bus, moving the mouse to increase the visible length of the line and double
25
clicking on the receiving end bus. A dialogue box corresponding to this line is opened, in
which the series resistance, series reactance, shunt conductance, shunt susceptance, line
26
27
EXPERIMENT-7
DISTRIBUTION SYSTEM RELIABILITY ANALYSIS
AIM:-To apply cutset approach to 6-bus RDS using MATLAB programming and to validate
results for performance indices with theoretical calculations.
Reliability Evaluation
A Radial Distribution System consists of a set of series components, including lines,
cables, disconnects (or isolators), bus bars, etc. A customer connected to any load point
of such a system requires all components between customer and the supply point to be
operating. Consequently the principle of series systems can be applied directly to these
systems.
Load Point Indices
It is important to mention that load point indices are vital to calculate system reliability indices.
These load point indices are characterized as:
1) Average failure rate (λ): Frequency of interruption the load point has suffered over a
Particular period.
2) Average outage time (r): The average outage time for each interruption over a particular
Period.
28
3) Average annual outage time (U): Average unavailability time for load point due to all
Interruption suffered over the reporting epoch.
The following Equations describe the mathematical representation of load point indices.
SAIDI is also very commonly used. It is the average duration of an interruption and is
29
Total Duration of Customer Interruptions
SAIDI=
Total Number of Customers Served hr/yr
by
This describes the average interruption frequency for customers who were counted as
30
A cut set is a set of system components which, when fail, cause failure of the entire
system.
Minimal cut set:A minimal cut set is a set of system components which, when fail, cause
failure of the entire system; but when any one component in the set does not fail, the
system will not fail as a whole.
From the definition, all components of each cut set must fail in order for the system to
fail. Consequently, the components in one cut set are effectively connected in parallel.
Furthermore, if there are more than one cut set, then the system fails if all the
components in any one of the cut sets fails. Hence, all the cut sets are effectively
connected in series. Therefore, given a system/network, one can obtain a simple
parallel-series model based on the cut sets for the reliability analysis.
31
lr=lr+(l(j,i)*r(j,i));
end
lx(j)=ls;
rx(j)=lr/ls;
ux(j)=lr;
end
Rdata=zeros(n,3);
for j=1:n
Rdata(j,1)=lx(j);
Rdata(j,2)=ux(j);
Rdata(j,3)=Nc(j);
end
x1=0;
x2=0;
x3=0;
for i=1:length(Rdata(:,1))
x1=x1+(Rdata(i,1)*Rdata(i,3));
x2=x2+(Rdata(i,2)*Rdata(i,3));
x3=x3+(Rdata(i,3));
end
lx
rx
ux
SAIFI=x1/x3
SAIDI=x2/x3
CAIDI=SAIDI/SAIFI
x4=x3*8760;
ASAI=(x4-x2)/x4
ASUI=1-ASAI
32
33
34
35
EXPERIMENT-8
ECONOMIC DISPATCH OF THERMAL UNITS
AIM: To perform economic dispatch of thermal units using MATLAB programming.
Software Used: MATLAB
Theory:
Scheduling is the process of allocation of generation among different generating units.
Economic dispatch is cost effect mode of allocation of generation among different units in
such a way that the overall cost of generation should be minimum. For economic dispatch
there are 3 methods.
1) Analytic Method
2) Graphical Method
3) λ- iterative Method
These methods to be adopted depends on
a) No. of generating Units
b) Incremental fuel cost curves
c) Mathematical formulation
ALGORITHM:
1. Read the given cost data and find number of generators
2. Read the values of a,b,d, po,E, Pgi(min),Pgi(max) and ∆λ.
36
3. Choose a suitable value of lamda.
4. Set generator counti=1.
5. Compute Pgi.
6. Check whether Pgi is greater than Pgi(max).
7. If yes then set Pgi=Pgi(max).
8. If no check whether Pgi is less than Pgi(min).
9. If yes then set Pgi=Pgi(min).
10. If no then increment i=i+1.
11. Check i=n or not.
12. If yes then compute ∆p=[ƩPgi-pd].
13. If no go to step no.5.
14. Check if ∆p<E.
15. If yes then print power generations of all units and compute cost of generation.
16. If no check ƩPgi>pd
17. If yes decrease λ by ∆λ i.e. λ=λ-∆λ
18. If no increase λ by ∆λ i.e λ=λ+∆λ
19. Go to step no.3 and repeat the procedure until the last generator done.
MATLAB PROGRAM:
clc
clear all
pd=259; % 259 MW
costdata=[ 1 0.074 1.083 100
2 0.089 1.033 70
3 0.074 1.083 100
4 0.089 1.033 70
5 0.053 1.17 40];
ng=length(costdata(:,1));
uno=costdata(:,1);
a=costdata(:,2);
b=costdata(:,3);
c=costdata(:,4);
lambda=1;
37
delp=0.001;
dellambda=0;
iter=0;
while abs(delp)>=0.001
iter=iter+1;
lambda=lambda+dellambda;
sum=0;
totgam=0;
for i=1:ng
p(i)=(lambda-b(i))/(2*a(i));
sum=sum+p(i);
totgam=totgam+0.5*(1/a(i));
end
delp=pd-sum;
dellambda=delp/totgam;
end
p'
num=1./(2*a);
pf=num/totgam
38
39
EXPERIMENT - 9
FDLF METHOD FOR DISTRIBUTION SYSTEM LOAD FLOW ANALYSIS
clear;
clc;
rxratio=1.5;
% n v delta pd qd ysh
busdata=[ 1 1.05 0 0.000 0.000 0
2 1.00 0 0.278 0.069 0
3 1.00 0 0.442 0.084 0
4 1.00 0 0.195 0.066 0
5 1.00 0 0.149 0.05 0
6 1.00 0 0.26 0.016 0.5 ];
% lp lq z
linedata=[ 1 2 0.052
2 3 0.035
2 4 0.0645
4 5 0.0117
4 6 0.075 ];
nline=length(linedata(:,1));
40
nbus=length(busdata(:,1));
j=sqrt(-1);
for k=1:nline
lp(k)=linedata(k,1);
lq(k)=linedata(k,2);
z(k)=linedata(k,3);
x(k)=sqrt((z(k)^2)/(((rxratio)^2)+1));
r(k)=rxratio*x(k);
z(k)=r(k)+j*x(k);
y(k)=1/z(k); %branch admittance
end
%initiation of G MATRIX
G=zeros(nbus,nbus);
%finding off diagonal elements of G MATRIX
for k=1:nline
G(lp(k),lq(k))=G(lp(k),lq(k))-real(y(k));
G(lq(k),lp(k))=G(lp(k),lq(k));
end
%finding diagonal elements of G MATRIX
for n=1:nbus
for k=1:nline
if ((lp(k)==n)||(lq(k)==n))
G(n,n)=G(n,n)+real(y(k));
end
end
end
invG=inv(G(2:nbus,2:nbus));
%reading the bus data
for k=1:nbus
bus(k)=busdata(k,1);
vm(k)=busdata(k,2);
delta(k)=busdata(k,3);
pd(k)=busdata(k,4);
qd(k)=busdata(k,5);
41
delta=pi/180*delta;
end
maxerror=1;
iter=0;
while(maxerror>0.0001 & iter<30)
iter=iter+1;
%initialisation of isp,ical % Specified and calculated currents
for k=1:nbus-1
isp(k)=0;
ik(k)=0;
end
%calculation of specified e.c.i. % Equivalent current injection
for k=1:nbus-1
isp(k)=[conj(pd(k+1)+j*qd(k+1))/vm(k+1)];
end
%calculation of ik
for n=2:nbus
for k=1:nline
if lp(k)==n||lq(k)==n
if lp(k)==n
ik(n-1)=ik(n-1)+y(k)*(vm(lp(k))-vm(lq(k)));
end
if lq(k)==n
ik(n-1)=ik(n-1)+y(k)*(vm(lq(k))-vm(lp(k)));
end
end
end
end
%calculation of ical including the effect of shunt capacitance
for n=2:nbus
ik(n-1)=ik(n-1)+(j*busdata(n,6)*vm(n));
end
%finding e.c.i.mismatcher
for n=1:nbus-1
42
id(n)=-isp(n)-ik(n);
end
for i=1:nbus-1
delir(i,1)=real(id(i));
delii(i,1)=imag(id(i));
end
dele=invG*delir; %change in bus voltage(real part)
delf=invG*delii; %change in bus voltage(imag part)
%calculation of modified bus voltages
for i=1:nbus-1
e(i)=real(vm(i+1))+dele(i);
f(i)=imag(vm(i+1))+delf(i);
vm(i+1)=e(i)+j*f(i);
end
maxerror=max(max(abs(dele)),max(abs(delf)));
Em=abs(vm);
ang=angle(vm);
iter
Em
ang
end
43
EXPERIEMENT-10
YBUS BY SINGULAR TRANSFORMATION METHOD
MATLAB Program :
clc;
clear all;
disp( ' formation of bus admittance matrix ');
nb = input ( 'enter the no of buses' );
nl = input ( 'enter the no of lines' );
for j= 1:nl
sb(j)=input ('enter the starting bus');
eb(j)=input ('enter the ending bus ');
z(j) =input ('enter the input values');
b(j) =input ('enter the values');
end
y=zeros(nl,nb);
for i=1:nl
k=sb(i);
m=eb(i);
y(i,k)=1;
y(i,m)=-1;
end
44
u=zeros(nl, nl);
for i=1:nl
u(i, i)=1/z(i)+b(i)/2;
end
t=y';
x=t*u*y;
x
y
u
t
45
46