PSS LM - Opt

You might also like

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

EE2404 POWER SYSTEM SIMULATION

LABORATORY

LAB MANUAL

NAME

REG. NO.

BRANCH

YEAR/SEMESTER

www.eeecube.com
FORMATION OF Y-BUS MATRIX
PROGRAM:
%EX1 - Formation of Y Bus Matrix
clc
clear all
disp('');
b = input('Enter no. of buses: ');
s = input('Enter no. of impedences: ');
for i=1:s
sb(i) = input('Enter starting bus no. ');
rb(i) = input('Enter receiving bus no. ');
imp(i) = input('Enter impedance of bus: ');
lc(i) = input('Enter line charging admittance: ');
ybus = diag(0,b-1);
end
for i=1:s
k1 = sb(i);
k2 = rb(i);
adm(i) = 1/imp(i);
ybus(k1,k1) = ybus(k1,k1) + adm(i) + lc(i);
ybus(k2,k2) = ybus(k2,k2) + adm(i) + lc(i);
ybus(k1,k2) = -adm(i);
ybus(k2,k1) = ybus(k1,k2);
end
ybus

www.eeecube.com

www.eeecube.com
OUTPUT:
Enter no. of buses: 4
Enter no. of impedances: 5
Enter
Enter
Enter
Enter

starting bus no. 1


receiving bus no. 2
impedance of bus: 0.2+0.8j
line charging admittance: 0.02j

Enter
Enter
Enter
Enter

starting bus no. 2


receiving bus no. 3
impedance of bus: 0.3+0.9j
line charging admittance: 0.03j

Enter
Enter
Enter
Enter

starting bus no. 2


receiving bus no. 4
impedance of bus: 0.25+1j
line charging admittance: 0.04j

Enter
Enter
Enter
Enter

starting bus no. 3


receiving bus no. 4
impedance of bus: 0.2+0.8j
line charging admittance: 0.02j

Enter
Enter
Enter
Enter

starting bus no. 1


receiving bus no. 3
impedance of bus: 0.1+0.4j
line charging admittance: 0.01j

ybus =
0.8824 - 3.4994i

-0.2941 + 1.1765i

-0.5882 + 2.3529i

-0.5882 + 2.3529i

-0.3333 + 1.0000i

1.2157 - 4.4694i

-0.2941 + 1.1765i
0

www.eeecube.com

0.8627 - 3.0276i

-0.2353 + 0.9412i

-0.3333 + 1.0000i

-0.2353 + 0.9412i

-0.2941 + 1.1765i

0.5294 - 2.0576i

-0.2941 + 1.1765i

www.eeecube.com
FORMATION OF Y-BUS MATRIX USING BUS BUILDING
ALGORITHM
PROGRAM:
%EX2 - Formation of Y-Bus Matrix usign bus building algorithm
clc
clear all
y10
y12
y23
y13
y34
y30

=
=
=
=
=
=

1/0.6j;
1/0.2j;
1/0.1j;
1/0.3j;
1/0.4j;
1/0.8j;

Y11
Y12
Y13
Y14

=
=
=
=

y10+y12+y13;
-y12;
-y13;
0;

Y21
Y22
Y23
Y24

=
=
=
=

-y12;
y12+y23;
-y23;
0;

Y31
Y32
Y33
Y34

=
=
=
=

-y13;
-y23;
y30+y13+y23+y34;
-y34;

Y41
Y42
Y43
Y44

=
=
=
=

0;
0;
-y34;
y34;

Y = [Y11 Y12 Y13 Y14; Y21 Y22 Y23 Y24; Y31 Y32 Y33 Y34; Y41
Y42 Y43 Y44]
OUTPUT:
Y =

0 -10.0000i

0 + 5.0000i

0 + 3.3333i

0 +10.0000i

0 + 5.0000i
0

www.eeecube.com

0 + 3.3333i

0 -15.0000i

0 +10.0000i

0 + 2.5000i

0 -17.0833i

0 + 2.5000i
0 - 2.5000i

www.eeecube.com
FORMATION OF Z-BUS MATRIX USING BUS BUILDING ALGORITHM
PROGRAM:
%Formation of Z-Bus matrix using bus building algorithm
clc
clear all
z12 = 0.2j;
z13 = 0.4j;
z23 = 0.2j;
disp('STEP1: Add an element between reference node and node(1)')
zBus1 = [z12]
disp('STEP2: Add an element between existing node(1) and new
node(3)')
zBus2 = [zBus1(1,1) zBus1(1,1);
zBus1(1,1) zBus1(1,1)+z13]
disp('STEP3: Add an
reference node')
zBus3 = [zBus2(1,1)
zBus2(2,1)
zBus2(2,1)

element between existing node(3) and


zBus2(1,2) zBus2(1,2);
zBus2(2,2) zBus2(2,2);
zBus2(2,2) zBus2(2,2)+z23]

disp('Using Krons reduction method')


zz11 = zBus3(1,1) - ((zBus3(1,3) * zBus3(3,1)) / zBus3(3,3));
zz12 = zBus3(1,2)- ((zBus3(1,3) * zBus3(3,2)) / zBus3(3,3));
zz21 = zz12;
zz22 = zBus3(2,2)- ((zBus3(2,3) * zBus3(3,2)) / zBus3(3,3));
disp('RESULT:')
zBus = [zz11 zz12;
zz21 zz22]

www.eeecube.com

www.eeecube.com
OUTPUT:
STEP1: Add an element between reference node and node(1)
zBus1 =
0 + 0.2000i
STEP2: Add an element between existing node(1) and new node(3)
zBus2 =
0 + 0.2000i
0 + 0.2000i

0 + 0.2000i
0 + 0.6000i

STEP3: Add an element between existing node(3) and reference


node
zBus3 =
0 + 0.2000i
0 + 0.2000i
0 + 0.2000i

0 + 0.2000i
0 + 0.6000i
0 + 0.6000i

Using Krons reduction method


RESULT:
zBus =
0 + 0.1500i
0 + 0.0500i

www.eeecube.com

0 + 0.0500i
0 + 0.1500i

0 + 0.2000i
0 + 0.6000i
0 + 0.8000i

www.eeecube.com
FORMATION OF Z-BUS MATRIX USING BUS BUILDING
ALGORITHM
PROGRAM:
%Formation of Z-Bus matrix using bus building algorithm
clc
clear all
z10
z12
z23
z24
z30
z34

=
=
=
=
=
=

1.25j;
0.25j;
0.4j;
0.125j;
1.25j;
0.2j;

disp('STEP1: Add an element between reference node(0) and


node(1)')
zBus1 = [z10]
disp('STEP2: Add an element between existing node(1) and new
node(2)')
zBus2 = [zBus1(1,1) zBus1(1,1);
zBus1(1,1) zBus1(1,1)+z12]
disp('STEP3: Add an
node(3)')
zBus3 = [zBus2(1,1)
zBus2(2,1)
zBus2(2,1)
disp('STEP4: Add an
reference node(0)')
zBus4 = [zBus3(1,1)
zBus3(2,1)
zBus3(3,1)
zBus3(3,1)

www.eeecube.com

element between existing node(2) and new


zBus2(1,2) zBus2(1,2);
zBus2(2,2) zBus2(2,2);
zBus2(2,2) zBus2(2,2)+z23]
element between existing node(3) and
zBus3(1,2)
zBus3(2,2)
zBus3(3,2)
zBus3(3,2)

zBus3(1,3)
zBus3(2,3)
zBus3(3,3)
zBus3(3,3)

zBus3(1,3) ;
zBus3(2,3);
zBus3(3,3);
zBus3(3,3)+z30]

www.eeecube.com
disp('Fictitious node(0) can be eliminated')
zz11 = zBus4(1,1) - ((zBus4(1,4) * zBus4(4,1))
zz12 = zBus4(1,2) - ((zBus4(1,4) * zBus4(4,2))
zz13 = zBus4(1,3) - ((zBus4(1,4) * zBus4(4,3))
zz21 = zz12;
zz22 = zBus4(2,2) - ((zBus4(2,4) * zBus4(4,2))
zz23 = zBus4(2,3) - ((zBus4(2,4) * zBus4(4,3))
zz31 = zz13;
zz32 = zz23;
zz33 = zBus4(3,3) - ((zBus4(3,4) * zBus4(4,3))

/ zBus4(4,4));
/ zBus4(4,4));
/ zBus4(4,4));
/ zBus4(4,4));
/ zBus4(4,4));
/ zBus4(4,4));

zBus5 = [zz11 zz12 zz13;


zz21 zz22 zz23;
zz31 zz32 zz33]
disp('STEP5: Add an
node(4)')
zBus6 = [zBus5(1,1)
zBus5(2,1)
zBus5(3,1)
zBus5(3,1)

element between existing node(3) and new


zBus5(1,2)
zBus5(2,2)
zBus5(3,2)
zBus5(3,2)

zBus5(1,3)
zBus5(2,3)
zBus5(3,3)
zBus5(3,3)

zBus5(1,3);
zBus5(2,3);
zBus5(3,3);
zBus5(3,3)+z34]

disp('STEP6: Add an element between existing nodes (2) and


(4)')

zBus7 =
[zBus6(1,1) zBus6(1,2) zBus6(1,3) zBus6(1,4) zBus6(1,2)-zBus6(1,4);
zBus6(2,1) zBus6(2,2) zBus6(2,3) zBus6(2,4) zBus6(2,2)-zBus6(2,4);
zBus6(3,1) zBus6(3,2) zBus6(3,3) zBus6(3,4) zBus6(3,2)-zBus6(3,4);
zBus6(4,1) zBus6(4,2) zBus6(4,3) zBus6(4,4) zBus6(4,2)-zBus6(4,4);
zBus6(2,1)-zBus6(4,1) zBus6(2,2)-zBus6(4,2) zBus6(2,3)-zBus6(4,3)
zBus6(2,4)-zBus6(4,4) z24+zBus6(2,2)+zBus6(4,4)-2*zBus6(2,4)]

disp('Fictitious node(0) can be eliminated')


zzz11 = zBus7(1,1) - ((zBus7(1,5) * zBus7(5,1))
zzz12 = zBus7(1,2) - ((zBus7(1,5) * zBus7(5,2))
zzz13 = zBus7(1,3) - ((zBus7(1,5) * zBus7(5,3))
zzz14 = zBus7(1,4) - ((zBus7(1,5) * zBus7(5,4))
zzz21 = zzz12;
zzz22 = zBus7(2,2) - ((zBus7(2,5) * zBus7(5,2))
zzz23 = zBus7(2,3) - ((zBus7(2,5) * zBus7(5,3))
zzz24 = zBus7(2,4) - ((zBus7(2,5) * zBus7(5,4))
zzz31 = zzz13;
zzz32 = zzz23;
zzz33 = zBus7(3,3) - ((zBus7(3,5) * zBus7(5,3))
zzz34 = zBus7(3,4) - ((zBus7(3,5) * zBus7(5,4))

www.eeecube.com

/
/
/
/

zBus7(5,5));
zBus7(5,5));
zBus7(5,5));
zBus7(5,5));

/ zBus7(5,5));
/ zBus7(5,5));
/ zBus7(5,5));
/ zBus7(5,5));
/ zBus7(5,5));

www.eeecube.com
zzz41
zzz42
zzz43
zzz44

=
=
=
=

zzz14;
zzz24;
zzz34;
zBus7(4,4) - ((zBus7(4,5) * zBus7(5,4)) / zBus7(5,5));

disp('RESULT:')
zBus = [zzz11 zzz12
zzz21 zzz22
zzz31 zzz32
zzz41 zzz42

zzz13
zzz23
zzz33
zzz43

zzz14;
zzz24;
zzz34;
zzz44]

OUTPUT:
STEP1: Add an element between reference node(0) and node(1)
zBus1 =
0 + 1.2500i
STEP2: Add an element between existing node(1) and new node(2)
zBus2 =
0 + 1.2500i
0 + 1.2500i
0 + 1.2500i
0 + 1.5000i
STEP3: Add an element between existing node(2) and new node(3)
zBus3 =
0 + 1.2500i
0 + 1.2500i
0 + 1.2500i
0 + 1.2500i
0 + 1.5000i
0 + 1.5000i
0 + 1.2500i
0 + 1.5000i
0 + 1.9000i
STEP4: Add an
node(0)
zBus4 =
0 + 1.2500i
0 + 1.2500i
0 + 1.2500i
0 + 1.2500i

element between existing node(3) and reference


0
0
0
0

+
+
+
+

1.2500i
1.5000i
1.5000i
1.5000i

0
0
0
0

+
+
+
+

1.2500i
1.5000i
1.9000i
1.9000i

Fictitious node(0) can be eliminated


zBus5 =
0 + 0.7540i
0 + 0.6548i
0 + 0.6548i
0 + 0.7857i
0 + 0.4960i
0 + 0.5952i

www.eeecube.com

0
0
0
0

+
+
+
+

1.2500i
1.5000i
1.9000i
3.1500i

0 + 0.4960i
0 + 0.5952i
0 + 0.7540i

www.eeecube.com
STEP5: Add an
zBus6 =
0 + 0.7540i
0 + 0.6548i
0 + 0.4960i
0 + 0.4960i

element between existing node(3) and new node(4)


0
0
0
0

+
+
+
+

0.6548i
0.7857i
0.5952i
0.5952i

0
0
0
0

+
+
+
+

0.4960i
0.5952i
0.7540i
0.7540i

0
0
0
0

+
+
+
+

0.4960i
0.5952i
0.7540i
0.9540i

STEP6: Add an element between existing nodes (2) and (4)


zBus7 =
0
0
0
0
0

Columns 1 through 4
+ 0.7540i
0 + 0.6548i
+ 0.6548i
0 + 0.7857i
+ 0.4960i
0 + 0.5952i
+ 0.4960i
0 + 0.5952i
+ 0.1587i
0 + 0.1905i

0
0
0
0
0

Column 5
+ 0.1587i
+ 0.1905i
- 0.1587i
- 0.3587i
+ 0.6742i

0
0
0
0
0

+
+
+
+
-

0.4960i
0.5952i
0.7540i
0.7540i
0.1587i

0
0
0
0
0

+
+
+
+
-

0.4960i
0.5952i
0.7540i
0.9540i
0.3587i

0
0
0
0

+
+
+
+

0.5805i
0.6966i
0.6695i
0.7631i

Fictitious node(0) can be eliminated


RESULT:
zBus =
0
0
0
0

+
+
+
+

0.7166i
0.6099i
0.5334i
0.5805i

www.eeecube.com

0
0
0
0

+
+
+
+

0.6099i
0.7319i
0.6401i
0.6966i

0
0
0
0

+
+
+
+

0.5334i
0.6401i
0.7166i
0.6695i

www.eeecube.com
LOAD FLOW ANALYSIS BY GAUSS-SEIDAL METHOD
PROGRAM:
%Gauss Seidal Method
clc
clear all
y12 = 2-6j;
y13 = 1-3j;
y23 = 0.666-2j;
y24 = 1-3j;
y34 = 2-6j;
p2 = 0.5;
p3 = -1.0;
p4 = 0.3;
q3 = 0.5;
q4 = -0.1;
disp('STEP1: Formulate Y-Bus Matrix')
Y11 = y12+y13;
Y12 = -y12;
Y13 = -y13;
Y14 = 0;
Y21 = -y12;
Y22 = y12+y23+y24;
Y23 = -y23;
Y24 = -y24;
Y31 = -y13;
Y32 = -y23;
Y33 = y13+y23+y34;
Y34 = -y34;
Y41 = 0;
Y42 = -y24;
Y43 = -y34;
Y44 = y24+y34;
yBus = [Y11 Y12 Y13 Y14; Y21 Y22 Y23 Y24; Y31 Y32 Y33 Y34; Y41 Y42
Y43 Y44]
disp('STEP2: Initialize bus voltages')
v1 = 1.04;
v2 = 1.04;
v3 =1.0;
v4 = 1.0;

www.eeecube.com

www.eeecube.com
disp('STEP3: Calculate Q2 value for PV Bus')
Q2 = v2*[(Y21*v1)+(Y22*v2)+(Y23*v3)+(Y24*v4)]
Q2cal = -imag(Q2)
disp('STEP4: Calculate V2 value')
V2 = (1/Y22)*[((p2-(Q2cal*j))/v2)-(Y21*v1)-(Y23*v3)-(Y24*v4)]
delta2 = angle(V2)
V2new = v2*(cos(delta2)+j*sin(delta2))
V3 = (1/Y33)*[((p3-(q3*j))/v3)-(Y31*v1)-(Y32*V2new)-(Y34*v4)]
V4 = (1/Y44)*[((p4-(q4*j))/v4)-(Y41*v1)-(Y42*V2new)-(Y43*V3)]
OUTPUT:
STEP1: Formulate Y-Bus Matrix
yBus =

3.0000-9.0000i
-2.0000+6.0000i
-1.0000+3.0000i
0

-2.0000+6.0000i
3.6660-11.0000i
-0.6660+2.0000i
-1.0000+3.0000i

-1.0000+3.0000i
0
-0.6660+2.0000i
-1.0000+3.0000i
3.6660-11.0000i -2.0000+6.0000i
-2.0000 + 6.0000i 3.0000-9.0000i

STEP2: Initialize bus voltages


STEP3: Calculate Q2 value for PV Bus
Q2 =
0.0693 - 0.2080i
Q2cal =
0.2080
STEP4: Calculate V2 value
V2 =
1.0513 + 0.0339i
delta2 =
0.0322
V2new =
1.0395 + 0.0335i
V3 =
1.0317 - 0.0894i
V4 =
1.0343 - 0.0151i

www.eeecube.com

www.eeecube.com
NEWTON RAPHSON LOAD FLOW METHOD USING MATLAB

PROGRAM:
%Newton Raphson Method
clc
clear all
y12 = 0.0839+0.5183j;
hlc = 0.0636j;
disp('STEP1: Formulate Y-Bus matrix')
Y11 = 1/y12 + hlc;
Y12 = -1/y12;
Y21 = -1/y12;
Y22 = 1/y12 + hlc;
yBus = [Y11 Y12;
Y21 Y22]
Y11m
Y12m
Y21m
Y22m
Y11a
Y12a
Y21a
Y22a

=
=
=
=
=
=
=
=

abs(Y11);
abs(Y12);
abs(Y21);
abs(Y22);
angle(Y11);
angle(Y12);
angle(Y21);
angle(Y22);

disp('STEP2: Initialize bus voltages')


v1 = 1.05
v2 = 1.0
d1 = 0
d2 = 0
X0 = [d2;
v2]
disp('STEP3: Calculate P2cal, Q2cal, dP2, dQ2')
P2cal = v2*((v1*Y21m*cos(Y12a+d2-d1))+(v2*Y22m*cos(Y22a+d2-d1)))
P2spec = -0.3
dP2 = P2spec-P2cal
Q2cal = -v2*((v1*Y21m*sin(Y12a+d1-d2))+(v2*Y22m*sin(Y22a+d2-d1)))
disp('Check for q limit')
disp('Q2cal < Q2min')
Q2spec = -0.1
dQ2 = Q2spec-Q2cal
disp('STEP4: Form Jacobian matrix')
J11 = (v2*v1*Y21m*sin(Y12a+d1-d2))+(v2*v2*Y22m*0);
J12 = (v1*Y21m*cos(Y12a+d1-d2))+(2*v2*Y22m*cos(Y22a));
J21 = (v2*v1*Y21m*cos(Y12a+d1-d2))-(v2*v2*Y22m*0);

www.eeecube.com

www.eeecube.com
J22 = (-v1*Y21m*sin(Y12a+d1-d2))-(2*v2*Y22m*sin(Y22a));
Jmatrix = [J11 J12;
J21 J22]
Jinv = inv(Jmatrix)
disp('STEP5: Compute dX')
pq = [dP2;
dQ2];
dX = Jinv*pq
delta2 = dX(1,1);
dV2 = dX(2,1);
Xnew = X0+dX
v2new = v2+dV2
Delta2new = d2+delta2

OUTPUT:
STEP1: Formulate Y-Bus matrix
yBus =
0.3043 - 1.8165i -0.3043 + 1.8801i
-0.3043 + 1.8801i
0.3043 - 1.8165i
STEP2: Initialize bus voltages
v1 =
1.0500
v2 =
1
d1 =
0
d2 =
0
X0 =
0
1
STEP3: Calculate P2cal, Q2cal, dP2, dQ2
P2cal =
-0.0152
P2spec =
-0.3000
dP2 =
-0.2848
Q2cal =
-0.1576

www.eeecube.com

www.eeecube.com
Check for q limit
Q2cal < Q2min
Q2spec =
-0.1000
dQ2 =
0.0576
STEP4: Form Jacobian matrix
Jmatrix =
1.9741
0.2891
-0.3196
1.6589
Jinv =
0.4927
0.0949

-0.0859
0.5863

STEP5: Compute dX
dX =
-0.1452
0.0067
Xnew =
-0.1452
1.0067
v2new =
1.0067
Delta2new =
-0.1452

www.eeecube.com

www.eeecube.com
FAST DECOUPLED POWER FLOW MODEL USING MATLAB

PROGRAM:
%Fast decoupled power flow method
clc
clear all
y11 = 0.0839+0.5183j;
hlc = 0.0636*j;
disp('STEP 1: Form Y-Bus matrix')
Y11 = (1/y11)+hlc;
Y12 = -(1/y11);
Y21 = -(1/y11);
Y22 = (1/y11)+hlc;
ybus= [Y11 Y12;
Y21 Y22]
Y11m
Y12m
Y21m
Y22m
Y11a
Y12a
Y21a
Y22a

=
=
=
=
=
=
=
=

abs(Y11);
abs(Y12);
abs(Y21);
abs(Y22);
angle(Y11);
angle(Y12);
angle(Y21);
angle(Y22);

disp('STEP 2: Initialize bus voltages')


v1 = 1.05
v2 = 1.02
d1 = 0
d2 = 0
disp('STEP 3: Check for Q-limit violation')
Q2cal = -((v2*v1*Y21m*sin(Y21a-d2+d1))+(v2*v2*Y22m*sin(Y22a)))
Q2min = 10/100
Q2spec= 0.1;
disp('Q2cal < Q2min, therefore Q2cal is with in the limit')
disp('Bus 2 act as pv bus')
v2 = 1;
disp('STEP 4: Calculate dP2 and dQ2')
P2cal = ((v2*v1*Y21m*cos(Y21a-d2+d1))+(v2*v2*Y22m*cos(Y22a)))
P2spec= 60/100
dP2
= P2spec-P2cal
dQ2
= Q2spec-Q2cal
disp('STEP 5: Bus susceptance matrix')
B1
= [-1.817]
B1_inv = inv(B1)
B2
= [-1.817]
B2_inv = inv(B1)

www.eeecube.com

www.eeecube.com
disp('STEP 6: calculate d2new and V2new')
del
= -B1_inv*(dP2/v2);
d2new = d2+del
dV2
= -B2_inv*(dQ2/v2);
V2new = v2+dV2

OUTPUT:
STEP 1: Form Y-Bus matrix
ybus =
0.3043 - 1.8165i -0.3043 + 1.8801i
-0.3043 + 1.8801i
0.3043 - 1.8165i
STEP 2: Initialize bus voltages
v1 =
1.0500
v2 =
1.0200
d1 =
0
d2 =
0
STEP 3: Check for Q-limit violation
Q2cal =
-0.1237
Q2min =
0.1000
Q2cal < Q2min, therefore Q2cal is with in the limit
Bus 2 act as pv bus
STEP 4: Calculate dP2 and dQ2
P2cal =
-0.0152
P2spec =
0.6000
dP2 =
0.6152
dQ2 =
0.2237
STEP 5: Bus susceptance matrix
B1 =
-1.8170
B1_inv =
-0.5504
B2 =
-1.8170
B2_inv =
-0.5504
STEP 6: calculate d2new and V2new
d2new =
0.3386
V2new =
1.1231

www.eeecube.com

www.eeecube.com

LOAD FREQUENCY CONTROL OF SINGLE AREA SYSTEM

333.333
500/3000

120s+1
Power Generation System

Del Pd(S)

www.eeecube.com

0.08s+1

0.3s+1

Speed Governor System

Turbine System

Del F(S)

-1/1.5
-1/R

www.eeecube.com

INTEGRAL CONTROL OF LOAD FREQUENCY CONTROL FOR SINGLE AREA SYSTEM

-0.325

100

0.08s+1

0.3s+1

20s+1

Integral Control

Speed Governer System

Turbine System

Power Generator System

Del Pd(S)

1/2

www.eeecube.com

1/R

Del F(S)

www.eeecube.com

LOAD FREQUENCY CONTROL OF DYNAMIC RESPONSE OF TWO AREA SYSTEM


-1
Alpha 12

0.5441

Tie Line Constant

s
Del Ptie2(s)

Del Ptie1(s)

333.33

333.333

0.08s+1

0.3s+1

120s+1

120s+1

0.3s+1

0.08s+1

Speed Governor
System 1

Turbine System 1

Generator
System 1

Generator
System 2

Turbine System 2

Speed Governor
System 2

500/3000 Del Pd2(s)

500/3000 Del Pd1(s)

Gani
Gain 2
-1/1.5

Dek F1(s)

Del F2(s)

-1/1.5
Scope

www.eeecube.com

www.eeecube.com
ECONOMIC DISPATCH CONTROL WITH LOSS

PROGRAM:
%Economic dispatch control with loss
clc
clear all
disp('Economic dispatch problem with loss')
B = [0.001
-0.0005
-0.0005 0.0024];
a = [0.04 0.04];
b = [16 12];
lda = 20;
Pg1 = (lda - b(1,1))/(2*a(1,1))
Pg2 = (lda - b(1,2))/(2*a(1,2))
disp('Iteration - 1')
Pg11 = (lda-b(1,1)-(2*lda*B(1,2)*Pg2))/((2*(a(1,1)+lda*B(1,1))))
Pg21 =(lda-b(1,2)-(2*lda*B(2,1)*Pg1))/((2*(a(1,2)+lda*B(2,2))))
disp('Iteration - 2')
Pg12 = (lda-b(1,1)-(2*lda*B(1,2)*Pg21))/((2*(a(1,1)+lda*B(1,1))))
Pg22 =(lda-b(1,2)-(2*lda*B(2,1)*Pg11))/((2*(a(1,2)+lda*B(2,2))))
disp('Iteration - 3')
Pg13 = (lda-b(1,1)-(2*lda*B(1,2)*Pg22))/((2*(a(1,1)+lda*B(1,1))))
Pg23 =(lda-b(1,2)-(2*lda*B(2,1)*Pg12))/((2*(a(1,2)+lda*B(2,2))))
disp('Iteration - 4')
Pg14 = (lda-b(1,1)-(2*lda*B(1,2)*Pg23))/((2*(a(1,1)+lda*B(1,1))))
Pg24 =(lda-b(1,2)-(2*lda*B(2,1)*Pg13))/((2*(a(1,2)+lda*B(2,2))))
disp('Iteration - 5')
Pg15 = (lda-b(1,1)-(2*lda*B(1,2)*Pg24))/((2*(a(1,1)+lda*B(1,1))))
Pg25 =(lda-b(1,2)-(2*lda*B(2,1)*Pg14))/((2*(a(1,2)+lda*B(2,2))))
disp('Iteration - 6')
Pg16 = (lda-b(1,1)-(2*lda*B(1,2)*Pg25))/((2*(a(1,1)+lda*B(1,1))))
Pg26 =(lda-b(1,2)-(2*lda*B(2,1)*Pg15))/((2*(a(1,2)+lda*B(2,2))))
disp('Total Generation')
Pgt = (Pg16+Pg26)
disp('Power Loss')
PL = (B(1,1)*Pg16*Pg16)+(2*B(1,2)*Pg16*Pg26)+(B(2,2)*Pg26*Pg26)
disp('Power demand')
PD = Pg16+Pg26-PL
disp('Note: All Values are in MW')

www.eeecube.com

www.eeecube.com
OUTPUT:
Economic dispatch problem with loss
Pg1 =
Pg2 =

50
100

Iteration - 1
Pg11 =
50
Pg21 =
51.1364
Iteration - 2
Pg12 =
41.8561
Pg22 =
51.1364
Iteration - 3
Pg13 =
41.8561
Pg23 =
50.2109
Iteration - 4
Pg14 =
41.7018
Pg24 =
50.2109
Iteration - 5
Pg15 =
41.7018
Pg25 =
50.1934
Iteration - 6
Pg16 =
41.6989
Pg26 =
50.1934
Total Generation
Pgt =
91.8923
Power Loss
PL =
5.6923
Power demand
PD =
86.2000
Note: All Values are in MW

www.eeecube.com

www.eeecube.com
ECONOMIC DISPATCH CONTROL WITHOUT LOSS

PROGRAM:
%Economic dispatch control without loss
clc
clear all
disp('Economic dispatch without loss')
Pgmin = [250 200 125];
a = [0.0045 0.0056 0.0079];
b = [5.2 4.5 5.8];
c = [580 640 820];
Pd = 925;
Pgmax = [450 350 225];
lamda =
(Pd+(b(1,1)/(2*a(1,1)))+(b(1,2)/(2*a(1,2)))+(b(1,3)/(2*a(1,3))))/
((1/(2*a(1,1)))+(1/(2*a(1,2)))+(1/(2*a(1,3))))
Pg1 = (lamda - b(1,1))/(2*a(1,1))
Pg2 = (lamda - b(1,2))/(2*a(1,2))
Pg3 = (lamda - b(1,3))/(2*a(1,3))
disp('Here Pg2 Power value is not within the limit')
disp('Pg2>Pg2max then Pg2 = Pg2max')
Pg2 = Pgmax(1,2)
Pdnew = Pd-Pg2
lamda1 = (Pdnew+(b(1,1)/(2*a(1,1)))+(b(1,3)/(2*a(1,3))))/
((1/(2*a(1,1)))+(1/(2*a(1,3))))
Pg1new = (lamda1 - b(1,1))/(2*a(1,1))
Pg2new = Pg2
Pg3new = (lamda1 - b(1,3))/(2*a(1,3))
disp('All values are in MW')
disp('Fitness Function')
F1 = (a(1,1)*(Pg1new*Pg1new))+(b(1,1)*Pg1new)+c(1,1)
F2 = (a(1,2)*(Pg2new*Pg2new))+(b(1,2)*Pg2new)+c(1,2)
F3 = (a(1,3)*(Pg3new*Pg3new))+(b(1,3)*Pg3new)+c(1,3)
Ft = F1+F2+F3
disp('All values are in RS/hr')

OUTPUT:

www.eeecube.com

www.eeecube.com

Economic dispatch without loss


lamda =
8.6149
Pg1 = 379.4361
Pg2 = 367.4040
Pg3 = 178.1598
Here Pg2 Power value is not within the limit
Pg2>Pg2max then Pg2 = Pg2max
Pg2 =
350
Pdnew =
575
lamda1 =
8.7147
Pg1new = 390.5242
Pg2new =
350
Pg3new = 184.4758
All values are in MW
Fitness Function
F1
F2
F3
Ft

=
=
=
=

3.2970e+003
2901
2.1588e+003
8.3568e+003

All values are in RS/hr

www.eeecube.com

www.eeecube.com
TRANSIENT STABILITY ANALYSIS OF SINGLE MACHINE TO
INFINITE BUS SYSTEM

PROGRAM:
%TRANSIENT STABILITY ANALYSIS
clc
clear all
%Program
%Data entry
f = input('Enter the frequency, f: ');
pb = input('Enter base MVA of generator, pd: ');
pd = input('Enter the power delivered by generator, pd: ');
H = input ('Enter the kinetic energy, H: ');
G = input('Enter the base value, G: ');
Xd = input('Enter transient reactance of generator, Xd: ');
Xt = input('Enter transmission line reactance, Xt: ');
E = input('Enter generator voltage, E(p.u): ');
V = input('Enter infinite bus voltage, V(p.u): ');
tinitial = input('Enter initial time, tinitial: ');
tfinal = input('Enter final time, tfinal: ');
tstep = input('Enter time interval, tstep: ');
c = input('Enter no. of cycles, c: ');
tc=c/f;
fprintf('Time to clear fault in %g cycles is %g \n',c,tc);
%Moment of Inertia
M = (G*H)/(180*f);
fprintf('The value of inertia constant H = %g s2/elec.deg \n',M);
%Pre fault
X1 = Xd+(Xt/2);
pmax1 = (E*V)/X1;
pt = pd/pb;
del_d = (asin(pt/pmax1))*(180/pi);
del_r = (del_d*pi)/180;
fprintf('pmax1 = %.2g\n',pmax1);
fprintf('Pre-fault power trasfer, pt = %g\n',pt);
fprintf('Initial power angle, del = %g\n',del_d);
%During fault
Xt1 = Xt/2;
X2 = ((Xd*Xt1)+(Xt*Xt1)+(Xd*Xt)/Xt1);
pmax2 = (V*E)/X2;
fprintf('pmax2 = %.2g\n',pmax2);
%Post fault

www.eeecube.com

www.eeecube.com
X3 = Xd+Xt;
pmax3 = (V*E)/X3;
fprintf('pmax3=%.2g\n',pmax3);
%Graph loop
pn = pt-(pmax1*sin(del_r));
pp = pt-(pmax2*sin(del_r));
p = (pn+pp)/2;
deldel = (tstep*tstep*p)/M;
del_r = del_r+(deldel*pi/180);
time(1) = tinitial;
angle(1) = del_d;
tinitial = tinitial+tstep;
i = 2;
while(tinitial<tfinal)
if(tinitial<tc)
pn = pt-(pmax1*sin(del_r));
end
if(tinitial==tc)
pn = pt-(pmax2*sin(del_r));
pp = pt-(pmax3*sin(del_r));
p = (pn+pp)/2;
end
if(tinitial>tc)
p = pt-(pmax3*sin(del_r));
end
deldel = deldel+(tstep*tstep*p)/M;
del_r = del_r+(deldel*pi/180);
del_d = del_r*(180/pi);
time(i) = tinitial;
angle(i) = del_d;
tinitial = tinitial+tstep;
i = i+1;
end
plot(time,angle,'ko-');
grid on;

OUTPUT:

www.eeecube.com

www.eeecube.com
Enter the frequency, f: 50
Enter base MVA of generator, pd: 20
Enter the power delivered by generator, pd: 18
Enter the kinetic energy, H: 2.52
Enter the base value, G: 1
Enter transient reactance of generator, Xd: 0.35
Enter transmission line reactance, Xt: 0.2
Enter generator voltage, E(p.u): 1.1
Enter infinite bus voltage, V(p.u): 1.0
Enter initial time, tinitial: 0.0
Enter final time, tfinal: 0.5
Enter time interval, tstep: 0.05
Enter no. of cycles, c: 2.5
Time to clear fault in 2.5 cycles is 0.05
The value of inertia constant H = 0.00028 s2/elec.deg
pmax1 = 2.4
Pre-fault power trasfer, pt = 0.9
Initial power angle, del = 21.6035
pmax2 = 1.5
pmax3=2

GRAPH:

www.eeecube.com

www.eeecube.com

www.eeecube.com

www.eeecube.com
SHORT CIRCUIT FAULT ANALYSIS

PROGRAM:
%Short circuit fault analysis
clc
clear all
disp('Short circuit fault analysis');
disp('STEP 1');
z1 = input('Enter the Z1 value: ');
zbus1 = [z1]
disp('STEP 2');
z2 = input('Enter the z2 value: ');
z3 = z1+z2;
zbus = [z1 z1;
z1 z3]
disp('STEP 3');
z4 = input('Enter the z3 value: ');
z5 = z3+z4;
zbus = [z1 z1 z1;
z1 z3 z3;
z1 z3 z5]
disp('STEP 4');
z6 = input('Enter the z4 value: ');
z7 = z5+z6;
zbus = [z1 z1 z1 z1;
z1 z3 z3 z3;
z1 z3 z5 z5;
z1 z3 z5 z7]
n=4;
for i=1:4
for j=1:4
zbus(i,j) = zbus(i,j)((zbus(i,n)*zbus(n,j))/zbus(n,n));
end
end
disp('After Elimination:');
zbus(:,4)=[];zbus(4,:)=[]
disp('STEP 5');
z8 = input('Enter the next value: ');
z44 = z8 + zbus(1,1)+zbus(3,3)-2*zbus(1,3);
z41 = zbus(1,1)-zbus(1,3);
z42 = zbus(1,2)-zbus(2,3);
z43 = zbus(1,3)-zbus(3,3);
z14 = z41;

www.eeecube.com

www.eeecube.com
z24 = z42;
z34 = z43;
zbus = [zbus(1,1) zbus(1,2) zbus(1,3) z14;
zbus(2,1) zbus(2,2) zbus(2,3) z24;
zbus(3,1) zbus(3,2) zbus(3,3) z34;
z41 z42 z43 z44]
n=4;
for i=1:4
for j=1:4
zbus(i,j) = zbus(i,j)((zbus(i,n)*zbus(n,j))/zbus(n,n));
end
end
zbus(:,4)=[];
disp('Final Result:');
zbus(4,:)=[]
v = input('Enter the voltage value: ');
disp('Fault at Bus 2');
disp('Fault current:');
If = v/zbus(2,2)
disp('Post fault Bus voltages:');
v1f = v-(zbus(1,2)*If)
v2f = v-(zbus(2,2)*If)
v3f = v-(zbus(3,2)*If)
disp('Line Flows:');
I13f = (v1f-v3f)/abs(z8)
disp('Fault at Bus 3');
disp('Fault Current:');
If = v/zbus(3,3)
disp('Post fault Voltages:');
v1f = v-(zbus(1,3)*If)
v2f = v-(zbus(2,3)*If)
v3f = v-(zbus(3,3)*If)
disp('Line Flows:');
I13f = (v1f-v3f)/abs(z8)

www.eeecube.com

www.eeecube.com
OUTPUT:
Short circuit fault analysis
STEP 1
Enter the Z1 value: 1.5j
zbus1 =

0 + 1.5000i

STEP 2
Enter the z2 value: 0.2j
zbus =

0 + 1.5000i
0 + 1.5000i

0 + 1.5000i
0 + 1.7000i

STEP 3
Enter the z3 value: 0.15j
zbus =

0 + 1.5000i
0 + 1.5000i
0 + 1.5000i

0 + 1.5000i
0 + 1.7000i
0 + 1.7000i

0 + 1.5000i
0 + 1.7000i
0 + 1.8500i

STEP 4
Enter the z4 value: 1.5j
zbus =
0
0
0
0

+
+
+
+

1.5000i
1.5000i
1.5000i
1.5000i

0
0
0
0

+
+
+
+

1.5000i
1.7000i
1.7000i
1.7000i

0
0
0
0

+
+
+
+

1.5000i
1.7000i
1.8500i
1.8500i

0
0
0
0

+
+
+
+

1.5000i
1.7000i
1.8500i
3.3500i

After Elimination:
zbus =

0 + 0.8284i
0 + 0.7388i
0 + 0.6716i

www.eeecube.com

0 + 0.7388i
0 + 0.8373i
0 + 0.7612i

0 + 0.6716i
0 + 0.7612i
0 + 0.8284i

www.eeecube.com
STEP 5
Enter the next value: 0.3j
zbus =
0
0
0
0

+
+
+
+

0.8284i
0.7388i
0.6716i
0.1567i

0
0
0
0

+
+
+
-

0.7388i
0.8373i
0.7612i
0.0224i

Final Result:
zbus =
0 + 0.7883i
0 + 0.7445i
0 + 0.7117i
Enter the voltage value: 1
Fault at Bus 2
Fault current:
If =
0 - 1.1955i
Post fault Bus voltages:
v1f =
v2f =
v3f =

0.1099
0
0.0969

Line Flows:
I13f =
0.0436
Fault at Bus 3
Fault Current:
If =
0 - 1.2685i
Post fault Voltages:
v1f =
0.0972
v2f =
0.0417
v3f =
0
Line Flows:
I13f =
0.3241

www.eeecube.com

0
0
0
0

+
+
+
-

0 + 0.7445i
0 + 0.8365i
0 + 0.7555i

0.6716i
0.7612i
0.8284i
0.1567i

0
0
0
0

+
+

0.1567i
0.0224i
0.1567i
0.6134i

0 + 0.7117i
0 + 0.7555i
0 + 0.7883i

You might also like