Download as pdf or txt
Download as pdf or txt
You are on page 1of 38

NATIONAL INSTITUTE OF TECHNOLOGY WARANGAL

DEPARTMENT OF ELECTRICAL ENGINEERING


M.TECH-POWER SYSTEMS ENGINEERING-I SEMESTER
EE5205: POWER SYSTEM COMPUTATION LAB

List of Experiments

1. Solution of set of Simultaneous Linear Algebraic Equations by


i. Gauss-Elimination Method
ii. Cholesky Method
Merits, Demerits and their applications in power system studies.

2. Formation of YBUS matrix using two dimensional arrays by inspection method.

3. Formation of YBUS matrix using Sparsity Technique

4. Load Flow Study by Gauss-Seidel Method.

5. Load Flow Study by Newton-Raphson (Polar) Method

6. Load Flow Study by Fast-Decoupled Method

7. AC/DC Load Flow Study with FACTs Controllers.


1. Solution of set of Simultaneous Linear Algebraic Equations by
Gauss-Elimination Method

Aim: To find solution of set of simultaneous linear equation AX=B using gauss elimination
method.

Apparatus required: Computer with installed MATLAB and Turbo C softwares.


Theory:
Gauss elimination method is used to solve the set of linear equations AX=B. In this method, the
augmented matrix [A:B] is converted into upper triangular form by elementary row operations of
matrix.
For n-sets of linear equations, matrix form of equations is,
Anxn Xnx1=Bnx1
Augmented matrix,

[A:B]=

Upper triangular matrix after elementary row operations is,

[A:B]=

This elimination process is also called forward elimination method. Now these new set of equations
can be solved using backward substitution method.
ALGORITHM
STEP 1: Read n //system size
Read A(i,j)
for i=1 to n
for j=1 to n
Read b(i) for i=1 to n
STEP 2: for i=1 to n
fact =1/A(i,i)
A(i,i)=1
for j=i+1 to n
A(i,j)=A(i,j)*fact
//end of jth loop
B(i)=B(i)*fact
//end of ith loop
STEP 3: k= i+1 to n
fact=A(k,i)
A(k,i)=0
STEP 4: For j=i+1 to n
A(k,j)=A(k,j)-A(i,j)*fact
//End of jth loop
B(k)=B(k)-fact*B(i)
// End of kth loop
//End of ith loop

//Print out the upper triangular matrix


STEP 5: // Start backward substitution
x(n)=B(n)
for i=n-1 to 1
sum=0
for j=i+1 to n
sum=sum + A(i,j)*x(j)
// End of jth loop
x(i)=(B(i)-sum) // as A(i,i)=1 in the above step
// End of ith loop
// Print the results

Note: Gauss-elimination approach is widely used for real square symmetric 'or' unsymmetric
matrices case where the matrix A is calculated in each iteration like Jacobian matrix of Newton-
Raphson load flow studies. Inverse takes N3 operations Gauss-elimination needs N3/3 operations .
Thus, for all power system studies with Newton-Raphson technique are usually solved by using
Gauss-elimination technique.
b) Solution of set of Simultaneous Linear Algebraic Equations by
Cholesky Method

AIM: To write a program to solve a set of simultaneous linear equation Ax=B, using Cholesky
decomposition.
APPARATUS REQUIRED: Computer with installed MATLAB and TURBO C++ software.
THEORY: Cholesky decomposition method is used to solve a set of linear equations AX=B. In this
method any symmetric, positive definite matrix ‘A’ can be decomposed into a product of lower
triangular and upper triangular matrix form by elementary operations of matrix as A=U TU.
Let us suppose a 3x3 matrix A= a11 a12 a13
a21 a22 a23
a31 a32 a33

l11 0 0 l11 l12 l13


= l21 l22 0 x l21 l22 0
l31 l32 l33 l31 0 0

= l112 l21 l11 l31 l11


l21 l11 l212+ l222 l31 l21+ l32 l22
l31 l11 l31 l21+ l32 l22 l312+ l322+ l332

= UTU.

where, l11 =

l21= a21/ l11


l22= l21= a21/ l11
l22= l32= (a32- l31 l21)/ l22

or lkk

After the decomposition the system can be easily solved by further doing forward and backward
substitution method.

ALGORITHM

STEP1: Read n // system size


Read A(i,j)
for i=1 to n
for j=1 to n
read b(i) for i=1 to n
STEP 2: // A will be decomposed and stored in it. No extra memory required
A(1.1)=sqrt(A(1,1))
for j= 2 to n
A(1,j)=A(1,j)/A(1,1)
A(j,1)=A(1,j) //symmetry
//end j// //first is over
STEP3: for i=2 to n
sum=0
for k=1 to i-1
sum=sum+A(i,k)*A(i,k)
//end of kth loop
A(i,i)=sqrt(A(i,i)-sum)
// diagonal is over
// for off-diadonals
for j=i+1 to n
sum=0
for k= 1 to i-1
sum=sum+A(i,k)*A(k,j)
// end of kth loop
A(i,j)=(A(i,j)-sum)/A(i,i)
A(j,i)=A(i,j) //symmetry
// off diagonals over
//end jth loop
//end ith loop
STEP4: // LU=A
// for forward substitution
//solution of AX=B
//LUX=B
//LY=B (forward substitution) where UX=Y (backward substitution)
y(1)=b(1)/A(1,1)
for i=2 to n
sum=0
for j=1 to i-1
sum=sum + A(i,j)*y(j)
y(i)=(b(i)-sum)/A(i,i)
//end of jth loop
//end ith loop
// backward substitution now starts Uy=b //U=A
x(n)=y(n)/A(n,n)
for i=n-1:1
sum=0
for j=i+1:n
sum=sum+A(i,j)*x(j)
x(i)=(y(i)-sum)/A(i,i)
//end jth loop
//end ith loop
NOTE: Cholesky decomposition technique is widely used for constant slope real symmetric
matrices case, like in fast decoupled load flow studies. Inverse takes N3 operations Gauss-
elimination needs N3/3 operations and cholesky approach offers solution in N 3/6 operations. Thus,
in real time operation studies of modern large power systems are usually FDC(fast decoupled) load
flows with cholesky technique.
2.Formation of YBUS matrix using two dimensional arrays by inspection method.
Aim : Formation of Ybus using two dimensional approach.
Apparatus Required : Computer with installed MATLAB & TURBO C++ software.
Theory : In two dimensional approach Ybus formation is carried out using concept of
Inspection technique.
Yii-- Diagonal element of Ybus of ith row.
By looking only we can give sum of the primitive admittances of those set of elements
connected to ith bus.
Ypp--Diagonal element of Ybus pth row.
Yij--( effective primitive admittance of the line between i & j nodes/buses)
Ypq( effective primitive admittance of the lines b/w p&q buses)
Yij-0 if there is no physical line b/w ith & jth bus.
Ypq-0 if there is no physical line between p &q bus.

These above explanation is referred as formation of Ybus by inspection technique.It involves


only 2equations and readily can use same equation through a small 3-bus system to a very big
system of 3000 buses.
ALGORITHM
STEP1: Read System data
a) n ,nline /system size
b) for k:1 to nline; lp(k),lq(k),r(k),x(k),ycp(k),ycq(k),tap(k);
c) for i:1 to n; yshunt(i).

-------------------------PRINTOUT WHAT ALL READ IN------------------------------------------------


Ypq= -(primitive admittance of line between p&q nodes )
Ypp =sum of the primitive admittances of all these lines connected to p bus
Ypq =0 if there is no line between p &q

STEP2: // Calculate primitive admittance of line between p&q nodes


For k:l to nline
Yline(k) = 1/complex(r(k),x(k));
//Now check whether the given line represents a transmission line
or a transformer with off-nominal tap ratio
if(tap(k)#1)
t1=1-(1/tap(k))
t2= - t1/ tap(k)
ycp(k) = t2 * yline(k) //leg on 1 pth side
ycq(k) = tl * yline(k) // leg 2 on qth side
yline(k) = yline(k)/tap(k)
//end if loop
// end of k th loop.
STEP3 : // lnitialization of vbus matrix
For i =l to n
For j:1 to n
Y(i,j) = 0.0 // complex(0.0,0.0)
// End of j th loop
// End of i th loop
// any kth line between p&q buses will change the values of Ypp,Yqq,Ypq,Yqp only at
four locations. We use this concept in forming the Ybus element by processing one line at a time.

STEP4 : for k:1 to nline


p =lp(k) //sending end side
q =lq(k) //receiving end side
Y(p,q) =Y(p,q)-yline(k)
Y(q,p) =Y(p,q)
Y(p,p) =Y(p,p) + yline(k) + ycp(k)
Y(q,q) =Y(q,q) + yline(k) + ycq(k)
//End of k th loop

STEP5: // Add yshunt elements


For i =1 to n
Y(i,i) = Y(i,i)+yshunt(i)
//end of i th loop
// formation of Ybus is over
//print out the Ybus matrix and STOP
3. Formation of YBUS matrix using Sparsity Technique
Aim : To form Ybus matrix using sparsity technique.

Apparatus : Computer with MATLAB and C++ installed.

Theory : A matrix is said to be sparse if it contains more number of zero elements than that
of non-zero elements .A good example of sparse matrix is Ybus.

If there are 500 buses and 750 buses,these area a total elements of 500x500.The number of non-
zero elements are elements are 1500+500=2000

Now % of sparsity = No. of Zeros/ Total no. of elements

=( 500x500-200)/(500x500)
= 99.2%

As the power system size increases,the % sparsity increases to 99.5% or more.In computer
applications of power systems,there is no need to store and operate on zero elements,if at all
we store and operate on zero elements,memory requirements go very high,and cpu time increases
enormously to overcome the disadvantage we use sparsity test.

ALGORITHM

STEP1: read system data


a) n, nline
b)for k =l to nline; lp(k),lq(k),r(k),x(k),ycp(k),ycq(k),tap(k)
c)for i=1 to n; yshunt(i).

------------------- PRINTOUT WHAT ALL READ IN-------------------------------------------

STEP2: // form vectors required to exploit sparsity of Ybus


a) for i =l to n
nlcont(i)= 0 // initialization
end // end of i th loop.
b) //calculate no.of lines connected to
for k =1 to nline
p =lp(k)
q =1q(k)
nlcont(p) = nlcont(p)+ 1
nlcont(q) = nlcont(q) + 1
end //end of k th loop.
c) // To prepare the reservation chart to store the location numbers
of the non-zero Ypq elements.
itagf(1) =1
itagto(l ) =nlcont( 1 )
for i:2 to n
itagf(i) = itagto(i- 1 )+ 1
itagto(i) = itagto (i- 1 )+ nlcont(i)
end
//end of i th loop.
//formation of adjl & adjq vectors required to exploit the sparsity of ybus
//adjq(j) ----stores the column number of Ypq non-zero element
//adjl(j)-----stores the line number which is causing a non-zero ypq element

d) for i =l to n
nlcont(i) =0 // initialization
end // end of i th loop.

e) for k =1 to nline
p =lp(k)
q =lq(k)
lpq =itagf(p) + nlcont(p)
lqp = itagf(q) + nlcont( q)
nlcont(p) = nlcont(p)+1 // update nlcont vector
nlcont(q) = nlcont(q)+ I
adjq(lpq) = q // Column no. of Ypq
adjl(lpq) = k // Line no. associated with ypq
adjq(lqp) = p //Column no. of yqp
adjl(1qp) =k // Line no. associated with yqp
end // end of kth loop

STEP 3 : // CALCULATION OF PRIMITIVE ADMITTANCES


For k=1 to nline
Z(k) = cmplex* (r(k),x(k))
Yline (k) = 1/ Z(k);
End // end of kth loop

STEP 4 :// MODELLING OF OFF NOMINAL-TAP RATIO TRANSFORMERS

a) For k=1 to nline


If tap(k)=! 1
a1=(1-1/tap(k))
a2 = -a1/tap(k)
ycp(k) = a2* yline (k)
ycq(k) = a1* yline(k)
yline(k) = yline(k)/tap(k)
end of if loop
// end of kth loop
STEP 5 : // FORMATION OF DIAGONAL ELEMENTS OF Ypp

a)For i= 1 to n
Ypp(i)=0
//end ith loop // initializationEnd
b) For k=1 to nline
p =lp(k)
q= lq(k)
Ypp(p) =Ypp(p) + yline(k) + ycp (k)
Ypp(q) =Ypp(q) +yline (k) +ycq(k)
// end of kth loop
c) For i= 1 to n
Ypp(i) =Ypp(i) + Yshunt(i)
// end of ith loop

STEP6 : // FORMATION OF OFF-DIAGONAL ELEMENTS


For j=1 to 2*nline
K= adjl(j)
Ypq(j) = - yline(k)
End //end of jth loop
Print out ypp(i) and ypq(j) vectors
4. Load Flow Study by Gauss-Seidel Method

AIM : To perform load flow analysis using Gauss-Seidel method.


Apparatus Required : A computer with MATLAB Software installed is required.

Theory : In Gauss seidel method we take initial guess voltage which are assumed.

Ep k = pth complex bus voltage at kth iteration.

In Gauss-approach we calculate Epk+1 voltage but do not update till all buses are completed.
Seidel observed and suggested to obtain E pk+1 immediately and use the updated values in
subsequent calculations.

At (k+1)th iteration

1 2 3 ………….(p-1) p p+1, p+2………………N


E1 E2k+1
k+1
E3k+1 Ep-1k+1 E NK

Updated values We are calculating Previous iteration values


Epk+1

Epk+1 = 1/ypp [ (Pp-jQp)/Epk – k+1


Ypq – ]

∆Epk = Change in pth bus Voltage


= Epk+1 -Epk

α-acceleration factor is used in GS method to improve the rate of convergence and the best range is
fixed by experimentation,of different systems studies & is found to be 1.4-1.7.

Epk+1= Epk +α∆Epk

For load bus or PQ bus above calculations are sufficient but for PV bus we have to convert Q-
limits into injection based.

Qmininj = Qmin –Qload


Qmaxinj = Qmax – Qload

Now for Qcal to have Vsp


Q-adjustment case at PV bus

Let Epk = epk + jfpk

∆new = tan-1( fpk/epk)


enew = VspCos(∆new)
fnew =Vsp Sin(∆new)

Enew = enew + jf new

k+1 k
Inew = YppEnew + +

Qnew = Imag( Enew *Inew*)


If
Qnew< Qmininj
Qp = Qmin inj Epk = Epk

If Qnew > Qmaxinj

Qp= Qmaxinj Epk = Epk

If Qmininj < Qnew < Qmaxinj

Ep* = Enew

Now its calculation are alone same as PQ bus.

ALGORITHM :
Step 1 : Read system data:
a) Read n,nline,nslack,itermax,epsilon,alpha
b) Read lp(k), lq(k), r(k), x(k), ycp(k), ycq(k),tap(k) for k=1 to
nline
c) Read yshunt(i) for i=1to n
d) Read Pgen(i),Qgen(i),Pload(i),Qload(i) for i=1 to n
e) Read ITYPE(i), Vsp(i), Qmin(i),Qmax(i) for i=1 to n
f) Read E(i) for i=1 to n
Step 2: Verify the input data
Step 3: Form the sparsity vectors ITAGF,ITAGTO,ADJL,ADJQ
vectors
Step 4: Form Ybus using sparsity vectors.
Step 5: Calculate Pshed(i)=Pgen(i)-Pload(i)
Qshed(i)=Qgen(i)-Qload(i) for i=1 to n
Step 6: //Modify Q-limits as Qinjections
for i=l to n
Qmininj(i)=qrnin(i) - qload(i)
Q maxinj(i)=qmax(i) – qload(i)
end //end of ith loop
for i=l to n
E(i)=complex(e(i),f(i) ) //initialize the initial bus voltage to flat
Eold(i)=e(i) //voltage profile except slack bus
end //end of ith loop
Set iter=0

Step7: set |delEmax|=0

Step 8: Set i=1 //bus count

If i=nslack then go to step 10 //go to next bus


If ITYPE(i)=1 then go to 9 //PQ bus
Else
e=real(e(i)) //PV bus calculations
f=imag(f(i))
delnew=tan-1(f/e)
enew=Vsp(i)*cos(delnew)
fnew=Vsp(i)*sin(delnew)
Enew=complex(enew,fnew)

//Calculate Inew and Qnew


Inew=Ypp(i)*Enew
jstart=ITAGF(i)
jstop=ITAGTO(i)
for j=jstart to jstop
q=ADJQ(j)
Inew=Inew+Ypq(j)*E(q)
end //end of jth loop
Qnew=imag(Enew* conj (Inew))
Set Qshed(i)=Qnew
if Qnew<Qmininj(i)
then Qshed(i)=Qmininj(i)

//pv bus is converted in to pq-bus


if Qnew>Qmaxinj(i)
. Qshed(i)=Qmaxinj(i)

//pv converted into pq bus


if Qshed(i)=Qnew(i)

//pv bus status is retained


E(i):Enew

//pv bus treatment is over


Step 9: Sum1=complex((Pshed(i)-Qshed(i))/conj (E( i))
jstart=ITAGF(i)
jstop=ITAGTO(i)
for j=jstart to jstop
q=ADJQ(j)
sum1=sum1-Ypq(j)*E(q)
//end of jth loop
E(i)=suml/Ypp(i) //one bus solution is over
delE(i)=E(i)-Eold(i)
If (|realdelE(i)|>|delEmax|)
Set delEmax=|realdelE(i)|
If (|imagdelE(i)|>delEmax)
Set delEmax=|imagdelE(i)|
/ / calculate accelerated voltage
E(i)=Eold(i)+alpha*delE(i)
Eold(i)=E(i)
Step 10: //advance bus count
i=i+1
if i<=n then go to step 8
Step 11: Calculations for all buses are over one iteration is complete, check
for convergence.
If |delEmax|<=epsilon //For converging case
Goto step 12
iter=iter+1
Check if iter>itermax
Goto step 13 //Problem did not converge
Else go to step 7
Step 12: Calculate line flow, line losses, slack bus power and print all
of them along with converged voltages and then stop.
Step 13: Problem not converged in itermax iterations hence print the
available voltages and then stop.
5. Load Flow Study by Newton-Raphson (Polar) Method (Q-unadjusted case)
Aim : To perform the Load flow studies using Newton-Raphson method.

Apparatus Required : A computer system with MATLAB software installed in it.

Theory : Due to the slow convergence of Gauss seidel and complexity of power system NR
method is used. N.R is based on Taylor’s series expansion.

NR Load flow method in polar version as well as in rectangular version----

Mismatch Jacobian Correction Vector


vector
Tinny Peterson (1963) has proposed N.R Technique---

Modified NR with ∆V replaced by ∆v/V to reduce cpu time. Now look at NR-Polar version---

H,N,M,L---are sub matrics of the Jacobian matrix.


Basic equn.

[Ibus] =[ybus] [Ebus] -----1)


Ip = --------2)
Ip = )(Vq

Pp+jQp = Ep Ip*
=( Vp )[ ]*

Pp=

Qp =

Pp = YppVp2Cos(δ pp-øpp)+

Qp = YppVp2Sin(δ pp-øpp)+

Ypp = Ypp∠ϕpp = YppCosϕpp +j YppSinϕpp

Pp = GppVp2+

Qp = -BppVp2+

Hpp = =-(Qp +BppVp2)

Hpq = =VpVqYpq Sin(δp- δq-ϕpq)

Lpp = = [ -2BppVp + VqYpqSin(δp- δq-ϕpq)]


= -2BppVp2 + VpVqYpq Sin(δpq –ϕpq)

Lpp =Qp-BppVp2

Lpq=
= [ Vp.Ypqsin (δpq-ϕpq)]Vq

Lpq = VpVq Ypq Sin(δpq – ϕpq)

Lpq =Qp+BppVp2

Npp =
=[ 2GppVp + VqYpq Cos(δpq – ϕpq)]Vp
=2GppVp2 +VpVqYpqCos(δpq – ϕpq)

Npp =Pp +GppVp2

Npq = = [VpYpqCos(δpq – ϕpq)]Vq


=VpVqYpqCos(δpq – ϕpq)

Npq = Pp-GppVp2

Mpp = = VpVqYpq Sin (δpq - ϕpq)

Mpp = Pp –GppVp2

Mpq = = -VpVqYpq Cos(δpq- ϕpq)

Algorithm
Step 1: a)read n, nline,nslack, epsilon, itermax //system size
b)read lp(k),lq(k),r(k),x(k),ycp(k),ycq(k),tap(k) for k=1 to nline
c)read yshunt(i) for i=1 to n
d)read pgen(i),qgen(i),pload(i),qload(i) for i=1 to n
e)read itype(i),vsp(i),qmin(i),qmax(i) for i=1 to n
f)read vmag(i),del(i),e(i),f(i) for i=1 to n
Step 2: form sparsity vectors ITAGF,ITAGTO,ADJL,ADJQ vectors.
Step 3: form Ybus using sparsity technique.
Step 4: calculate pshed(i)=pgen(i)-pload(i).
Qshed(i)=qgen(i)-qload(i) for i=1 to n.
Step 5: //as we are attempting NR Q-unadjusted polar load flow,
set voltage magnitude of pv buses as V specified .
also take epv=vsp+j0 form
for i=1 to n
if (itype(i)=2)
set vmag(i)=vsp(i)
E(i)=complex(vsp(i),0)
//end of ith loop
Step 6: set iter=0
Step 7: set |delpmax|=0 and |delqmax|=0
Step 8: //Now calculate pcal(i),qcal(i) as below
for i=1 to n
sum=ypp(i)*E(i)
jstart=ITAGF(i)
jstop=ITAGTO(i)
for j=jstart to jstop
q=ADJQ(j)
sum=sum+ypq(j)*E(q)
//end of jth loop
S=E(i) * conj(sum)
pcal(i)=real(S)
qcal(i)=imag(S)
//end of ith loop
for i=1 to n
delp(i)=pshed(i)-pcal(i)
delq(i)=qshed(i)-qcal(i)
delp(nslack)=0
delq(nslack)=0
if(ITYPE(i)==2)
set delq(i)=0
//as pv bus is maintaining its vsp
if(abs(delp(i)>|delpmax|)
set |delpmax|=abs(delp(i))
if(abs(delq(i)>|delqmax|)
set |delqmax|=abs(delq(i))
//1 bus calculations are over
//end of loop i
Step 9: //check for convergence
if(|delpmax|<=epsilon and |delqmax|<=epsilon)
go to step 16
usually epsilon=0.0001
Step 10: //now form the jacobian matrix
first form the diagonals
Hpp=-BppVp2 - Qp
Lpp=-BppVp2 + Qp
Npp=GppVp2 + Pp
Mpp=-GppVp2 + Pp
for i=1 to n
A(i,i)=A(i,i) -Qcal(i)-imag(Ypp(i)*vmag(i)*vmag(i))
A(i+n,i+n)=A(i+n,i+n) +Qcal(i))-imag(Ypp(i)*vmag(i)*vmag(i))
A(i+n,i)=A(i+n,i) +Pcal(i)-real (Ypp(i)*vmag(i)*vmag(i))
A(i,i+n)=A(i,i+n) +Pcal(i)+real(Ypp(i)*vmag(i)*vmag(i))
//end of loop i
//diagonals over
set A(nslack,nslack)=10^20 //for phase angle correction of
slack bus=0
set A(nslack+n,nslack+n)=10^20 //for voltage magnitude correction of slack
bus=0
//formation of off diagonals
Hpq=Gpq(fpeq-fqep)-Bpq(epeq+fpfq)
Lpq=Hpq
Npq=Bpq(fpeq-fqep)+Gpq(epeq+fpfq)
Mpq=Npq
for k=1 to nline
p=lp(k)
q=lq(k)
A(p,q)=Hpq’s expression
A(p+n,q+n)=Lpq’s expression
A(p,q+n)=Npq’s expression
A(n+p,q)=A(p,n+q)
//end of loop k
//formation of jacobian is over
//form mismatch vector
for i=1 to n
delpq(i)=delp(i)
delpq(i+n)=delq(i)
//end of loop i
Step 11: //use Gauss elimination AX=B form where
A=jacobian matrix
B=delpq vector
X=correction vector(delx)
delx=delpq
solve it by gauss elimination
Step 12: //now update the voltage phase angles and magnitude
for i=1 to n
delta(i)=delta(i)+delx(i)
vmag(i)=vmag(i)+delx(i+n)*vmag(i)
e(i)=vmag(i)*cos(delta(i))
f(i)=vmag(i)*sin(delta(i))
E(i)=complex(e(i),f(i))
end of loop i
//one iteration is over
Step 13: iter=iter+1
Step 14: if iter<itermax then go to step 7
Where |delpmax|,|delqmax| are zero
Step 15: problem not converged in itermax iterations
Stop
Step 16: problem converged in ‘iter’ iterations
Calculate line flows, line losses, slack bus power and stop.
5 b. Load Flow Study by Newton-Raphson (Polar) Method (Q-Adjusted case)
Step 1 : Read system data :
a) Read n,nline,nslack,epsilon,itermax
b) Read lp(k), lq(k), r(k), x(k), ycp(k), ycq(k),tap(k) for k=1 to
nline
c) Read yshunt(i) for i=1to n
d) Read Pgen(i),Qgen(i),Pload(i),Qload(i) for i=1 to n
e) Read ITYPE(i), Vsp(i), Qmin(i),Qmax(i) for i=1 to n
f) Read E(i) for i=1 to n
Step 2: Verify the input data
Step 3: Form the sparsity vectors ITAGF,ITAGTO,ADJL,ADJQ
vectors
Step 4: Form Ybus using sparsity vectors.
Step 5: Calculate Pshed(i)=Pgen(i)-Pload(i)
Qshed(i)=Qgen(i)-Qload(i) for i=1 to n
Step 6: //Modify Q-limits as Qinjections
for i=l to n
Qmininj(i)=qmin(i) - qload(i)
Q maxinj(i)=qmax(i) – qload(i)
end //end of ith loop
for i=l to n
E(i)=complex(e(i),f(i) ) //initialize E(i) to flat voltage profile
Eold(i)=e(i) //for all buses except slack bus
end //end of ith loop
Step6: Set iter=0
Step7: set |delPmax|=0 and |delQmax|=0
Set i=1 //bus count
Step 8: If i=nslack then go to step 10
If ITYPE(i)=1 then go to 8(a)
Else
e=real(e(i)) //PV bus calculations
f=imag(f(i))
delnew=tan-1(f/e)
enew=Vsp(i)*cos(delnew)
fnew=Vsp(i)*sin(delnew)
Enew=complex(enew,fnew)
//Calculate Inew and Qnew
Inew=Ypp(i)*Enew
jstart=ITAGF(i)
jstop=ITAGTO(i)
for j=jstart to jstop
q=ADJQ(j)
Inew=Inew+Ypq(j)*E(q)
end //end of jth loop
Pnew=real(Enew*conj(Inew)) //Pnew=Pcal
Qnew=imag(Enew*conj(Inew)) //Qnew=Qcal
Qnew=imag(Enew* conj (sum))
Set Qshed(i)=Qnew
if Qnew<Qmininj(i)
then Qshed(i)=Qmininj(i)
E(i)=Eold(i) //guess voltage

//pv bus is converted in to pq-bus


if Qnew>Qmaxinj(i)
. Qshed(i)=Qmaxinj(i)
E(i)=Eold(i) //guess voltage

//pv converted into pq bus


if Qshed(i)=Qnew(i)

//pv bus status is retained


E(i)=Enew

//for pv bus it is vsp


Step 8(a): for i=1 to n
sum=Ypp(i)*E(i)
jstart=ITAGF(i)
jstop=ITAGTO(i)
for j=jstart:jstop
q=ADJQ(j)
sum=sum+Ypq(j)*E(q)
S=E(i)*conj(sum)
Pcal=real(S)
Qcal=imag(S)
delp(i)=p(i)-pcal(i)
delq(i)=q(i)-qcal(i)
//end of ith loop //one bus calculations are over
delp(nslack)=0
delq(nslack)=0
find |delpmax| and |delqmax| within all n buses
Step 9: //check for convergence
if(|delpmax|<=epsilon and |delqmax|<=epsilon)
go to step 16
usually epsilon=0.0001
Step 10: //now form the jacobian matrix
first form the diagonals
Hpp=-BppVp2 - Qp
Lpp=-BppVp2 + Qp
Npp=GppVp2 + Pp
Mpp=-GppVp2 + Pp
for i=1 to n
A(i,i)=A(i,i) -Qcal(i)-imag(Ypp(i)*vmag(i)*vmag(i))
A(i+n,i+n)=A(i+n,i+n) +Qcal(i))-imag(Ypp(i)*vmag(i)*vmag(i))
A(i+n,i)=A(i+n,i) +Pcal(i)-real (Ypp(i)*vmag(i)*vmag(i))
A(i,i+n)=A(i,i+n) +Pcal(i)+real(Ypp(i)*vmag(i)*vmag(i))
//end of loop i
//diagonals over
set A(nslack,nslack)=10^20 //for phase angle correction of
slack bus=0
set A(nslack+n,nslack+n)=10^20 //for voltage magnitude correction of slack
bus=0
//formation of off diagonals
Hpq=Gpq(fpeq-fqep)-Bpq(epeq+fpfq)
Lpq=Hpq
Npq=Bpq(fpeq-fqep)+Gpq(epeq+fpfq)
Mpq=Npq
for k=1 to nline
p=lp(k)
q=lq(k)
A(p,q)=Hpq’s expression
A(p+n,q+n)=Lpq’s expression
A(p,q+n)=Npq’s expression
A(n+p,q)=A(p,n+q)
//end of loop k
//formation of jacobian is over
//form mismatch vector
for i=1 to n
delpq(i)=delp(i)
delpq(i+n)=delq(i)
//end of loop i
Step 11: //use Gauss elimination AX=B form where
A=jacobian matrix
B=delpq vector
X=correction vector(delx)
delx=delpq
solve it by gauss elimination
Step 12: //now update the voltage phase angles and magnitude
for i=1 to n
delta(i)=delta(i)+delx(i)
vmag(i)=vmag(i)+delx(i+n)*vmag(i)
e(i)=vmag(i)*cos(delta(i))
f(i)=vmag(i)*sin(delta(i))
E(i)=complex(e(i),f(i))
end of loop i
//one iteration is over
Step 13: iter=iter+1
Step 14: if iter<itermax then go to step 7
Where |delpmax|,|delqmax| are zero
Step 15: problem not converged in itermax iterations
Stop
Step 16: problem converged in ‘iter’ iterations
Calculate line flows, line losses, slack bus power and stop.
6. Load Flow Study by Fast-Decoupled Method (Q-Unadjusted case)

Aim : To perform load flow study using Fast Decoupled Technique .

Apparatus Required :

A computer system with MATLAB software installed in it.

Theory:

NR –Polar version :

[∆P] = [H][∆δ]
[∆Q] =[L][∆V/V] ------------------ NDC equations

a) [Qp] <<[ BppVp2]

Neglect Qp in equn of HPP & LPP


Hpp = -BppVp2
Lpp = -BppVp2

b)δpq =δp-δq=0
cosδpq =1
sinδpq 0

Hpq = VpVqYpqSin(δpq-ϕpq)=VpVqYpq sinθpq=-VpqBpq


Lpq = VpVqYpq Sin(δpq–ϕpq)=Hpq

[∆P] =[H][ ∆δ]


Hpp= -BppVp2 = Vp(-Bpp)Vp
Hpq = VpVq(-Bpq) = Vp(-Bpq)Vq

[∆P] = [Vp(-Bpq)Vq] [Δδ] //(since Vq=0)//

[∆Pp/Vp] =[-Bpq][∆δ]
[∆P/Vp] =[B1][∆δ]

It is a slope matrix which is dependend on [Ybus] elements


B1 is a constant slope matrix needs to be calculated only once before the iteration process
Now,

[∆Q] =[Vp(-Bpq)Vq][∆Vq/Vq]

[∆Q/Vq] =[-Bpq][(∆Vq/Vq) . Vq]


[∆Qp/Vp] = [-Bpq][∆Vq]
[∆Q/V] =[B2][∆V]
Thus B1 B”

[ B1pq= -Bpq [ B2pq= -Bpq


B1pp= - Bpp ] B2pp= -Bpp ]

B1 & B2 are having same elements and slope matrix


B1 Couples ∆P &∆δ

B2 couples ∆Q & ∆V

Algorithm:
Step 1: Read the input data
Step 2: Form Ybus by sparsity technique
Step 3: calculate for k=1 to nline
bline(k)=1/x(k)
//end of loop i
Step 4: initialize B1(i,j) and B2(i,j) matrices to zero for i=1 to n and
for j=1 to n
Step 5: form B1 and B2 matrices
//formation of B1 matrix
for i=1:n
for j=1:n
B1(i,j)=0
B2(i,j)=0
end of ith loop
end of jth loop
for k=1:nline
p=lp(k)
q=lq(k)
temp=bline(k)
B1(p,q)=B1(p,q)-temp;
B1(q,p)=B1(p,q);
B1(p,p)=B1(p,p)+temp;
B1(q,q)=B1(q,q)+temp;
end of kth loop
B1(nslack,nslack)=10^20
//formation of B1 matrix is over
//formation of B2 matrix
for i=1:n %diagonal elements
B2(i,i)= -imag(ypp(i));
//end of ith loop
for i=1:n
jstart=itagf(i);
jstop=itagto(i);
for j=jstart:jstop
q=adjq(j);
k=adjl(j);
B2(i,q)=B2(i,q)+imag(yline(k)); %off diagonal elements
//or B2(i,q)=B2(i,q)-imag(Ypq(j)) since Ypq= -yline(k)
//end of jth loop
//end of ith loop
for i=1:n
if(itype(i)=2)
B2(i,i)=10^20; //pv bus
//end of loop i
B2(nslack,nslack)=10^20;
Step 6: Apply cholesky decomposition for B1 and B2 matrices
Step 7: calculate pshed(i) and qshed(i) for i=1 to n
delp(i)=pshed(i)-pcal(i)
delq(i)=qshed(i)-qcal(i)
Step 8: set iter=0
Step 9: set |depmax|=0 and |delqmax|=0
Step 10: //now calculate pcal(i),qcal(i) as below
for i=1 to n
sum=ypp(i)*E(i)
jstart=ITAGF(i)
jstop=ITAGTO(i)
for j= jstart to jstop
q=ADJQ(j)
sum=sum+ypq(j)*E(q)
//end of jth loop
S=E(i)*conj(sum)
pcal(i)= real(S)
qcal(i)= imag(S)
//end of loop i
for i=1 to n
delp(i)=pshed(i)-pcal(i)
delq(i)=qshed-qcal(i)
if(ITYPE(i)==2)
set delq(i)=0 //as pv bus is maintains its Vsp in Q-unadjusted case
//end of loop i
delp(nslack)=0;
delq(nslack)=0;
for i=1:n
if(abs(delp(i))>|delpmax|)
set |delpmax|=abs(delp(i))
if(abs(delq(i)>|delqmax|)
set |delqmax|=abs(delq(i))
//end of loop i
Step 11: //check for convergence
if(|delpmax|<=epsilon and |delqmax|<=epsilon)
go to step 23 //problem is converged
usually epsilon=0.0001
Step 12: calculate [delp(i)/v(i)] vector for i=1:n
then solve [delp/v] =[B1][deldelta]
using forward and backward substitution on components of B1 matrix
Step 13: update phase angles and bus voltages
for i=1 to n
delta(i)=delta(i)+deldelta(i)
E(i)=complex(v(i)cos(delta(i)),v(i)sin(delta(i)))
Step 14: set iter=iter+0.5
Step 15: calculate pcal(i),qcal(i) for i=1 to n
also calculate delp(i),delq(i) for i=1 to n
set delp(nslack,nslack)=0;
delq(nslack,nslack)=0;
also set delq(pv bus)=0;
Step 16: determine |delpmax| and |delqmax|
Step 17: //check for convergence
if(|delpmax|<=epsilon and |delqmax|<=epsilon)
go to step 23 //problem is converged
usually epsilon=0.0001;
Step 18: calculate [delq(i)/v(i)] vector for i=1 to n
Step 19: then solve [delq/v]=[B2][delv]
using forward and backward substitution on components of B2 matrix
Step 20: update voltage magnitudes and recompute complex bus voltages
for i=1 to n
Delv(i)=v(i)+delv(i)
E(i)=complex(v(i)cos(delta(i)),v(i)sin(delta(i)))
Step 21: set iter =iter+0.5
if iter<itermax
go to step 10
Step 22: problem not converged in itermax iterations,stop
Step 23: problem converged in ‘iter’ iterations.
Calculate line flows, line losses and slack bus power. stop.
6b. Load Flow Study by Fast-Decoupled Method (Q-Adjusted case)
Step 1: Read the input data
Step 2: Form Ybus by sparsity technique
Step 3: Form B1 and B2 as in FDC unadjusted studies
Decompose them using cholesky method
Step 4: Calculate pshed(i) and qshed(i) for i=1:n //psehd(i)=Pgen(i)-Pload(i)
For i=1:n //qshed(i)=Qgen(i)-Qload(i)
Qmininj(i)=qmin(i)-qload(i)
Qmaxinj(i)=qmax(i)-qload(i)
//q limits enforcement is to be done after first iteration//i.e first iteration is unadjusted
Step 5: Set iter=0
Step 6: Set |delpmax|=0 and |delqmax|=0
Step 7: //Now calculate pcal(i),qcal(i) as below
for i=1:n
sum=ypp(i)*E(i)
jstart=ITAGF(i)
jstop=ITAGTO(i)
for j=jstart to jstop
q=ADJQ(j)
sum=sum+ypq(j)*E(q)
//end of jth loop
sum=E(i)*conj(sum)
pcal(i)=real(sum)
qcal(i)=imag(sum)
//end of ith loop
Step 8: if(iter>=1)
//then enforce Q-limits.
//else go to step 9 (Q-unadjusted case)
for i=1:n
ipv(i)=itype(i)//end of ith loop
this vector indicates which pv bus is violating Q-limits
for i=1:n
if(ITYPE(i)=2)
then calculate,
deltanew=tan-1(f(i)/e(i))
enew=vsp(i)*cos(deltanew)
fnew=vsp(i)*sin(deltanew)
Enew=complex(enew,fnew)
sum=ypp(i)*E(i)
jstart=ITAGF(i)
jstop=ITAGTO(i)
for j=jstart to jstop
q=ADJQ(j)
sum=sum+ypq(j)*E(q)
//end of jth loop
Sum=E(i)*conj(sum)
qnew=imag(sum)
set qshed(i)=qnew
if qnew<qmininj(i)
then qshed(i)=qmininj(i)
//pv bus is converted in to PQ bus
ipv(i)=1
//this additional vector is required in Q-adjusted NR load flow
if qnew>qmaxinj(i)
qshed(i)=qmaxinj(i)
//PV bus is converted into PQ bus
ipv(i)=1
if(qshed(i)=qnew(i))
E(i)=Enew
ipv(i)=2
//PV bus treatment is over
//end of ith loop
Step 9: a)//now calculate for i=1to n
delp(i)=pshed(i)-pcal(i)
delq(i)=qshed(i)-qcal(i)
//end of loop i
delp(nslack)=0
delq(nslack)=0
b)if iter<=1 then for i=1to n
if(ITYPE(i)=2)
set delq(i)=0
//unadjusted study,where itype(i)=2 is a PV bus
c)if iter>1
then for i=1to n
if(ipv(i)=2)
set delq(i)=0
//end of loop i
//with Q-enforcement we look at ipv-vector
Step 10: determine delpmax,delqmax
//check for convergence
if(|delpmax|<=epsilon and |delqmax|<=epsilon)
go to step 21
usually epsilon=0.0001
Step 11: calculate [delp(i)/v(i)] vector for i=1:n
then solve [delp/v]=[B1][deldelta]
//using forward and backward substitution on components of B1 matrix
update phase angles and bus voltages
delta(i)=delta(i)+deldelta(i)
E(i)=complex(v(i)cos(delta(i)),v(i)sin(delta(i)))
half iteration is over
Step 12: iter=iter+0.5
Step 13: if(iter<itermax) then
Set |delpmax|=0 and |delqmax|=0
Step 14: calculate pcal(i),qcal(i) for i=1:n
//pv bus treatment then repeat above statements starting from step 8 to step 9c
Step 15: determine delpmax and delqmax
//check for convergence as in step(10)
Step 16: cal [delq(i)/v(i)] vector for i=1:n
if(iter>1)
then reform the B2 matrix and modify its B2(pv,pv)=10^20 if pv bus falls within Q-limits
then redecompose B2 matrix using cholesky decomposition technique.
Step 17: solve [delq/v]=[B2][deltav]
update voltage magnitudes and recalculate their complex voltages
Step 18: iter=iter+0.5
Step 19: if(iter<itermax) go to step 6
Step 20: problem not converged in itermax iterations and stop
Step 21: problem converged in ‘iter’ iterations. Calculate line flows, line losses,
slack bus power and stop.

You might also like