32
EE2404 POWER SYSTEM SIMULATION LABORATORY LAB MANUAL NAME : REG. NO. : BRANCH : YEAR/SEMESTER :

EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

Embed Size (px)

Citation preview

Page 1: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

EE2404 POWER SYSTEM SIMULATION

LABORATORY

LAB MANUAL

NAME :

REG. NO. :

BRANCH :

YEAR/SEMESTER :

Page 2: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

FORMATION OF Y-BUS MATRIX

PROGRAM:

%EX1 - Formation of Y Bus Matrixclcclear alldisp('');b = input('Enter no. of buses: ');s = input('Enter no. of impedences: ');

for i=1:ssb(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:sk1 = 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);

endybus

www.eeecube.com

www.eeecube.com

Page 3: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

OUTPUT:

Enter no. of buses: 4Enter no. of impedances: 5

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

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

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

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

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

ybus =

0.8824 - 3.4994i -0.2941 + 1.1765i -0.5882 + 2.3529i 0-0.2941 + 1.1765i 0.8627 - 3.0276i -0.3333 + 1.0000i -0.2353 + 0.9412i-0.5882 + 2.3529i -0.3333 + 1.0000i 1.2157 - 4.4694i -0.2941 + 1.1765i

0 -0.2353 + 0.9412i -0.2941 + 1.1765i 0.5294 - 2.0576i

www.eeecube.com

www.eeecube.com

Page 4: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

FORMATION OF Y-BUS MATRIX USING BUS BUILDINGALGORITHM

PROGRAM:

%EX2 - Formation of Y-Bus Matrix usign bus building algorithmclcclear all

y10 = 1/0.6j;y12 = 1/0.2j;y23 = 1/0.1j;y13 = 1/0.3j;y34 = 1/0.4j;y30 = 1/0.8j;

Y11 = y10+y12+y13;Y12 = -y12;Y13 = -y13;Y14 = 0;

Y21 = -y12;Y22 = y12+y23;Y23 = -y23;Y24 = 0;

Y31 = -y13;Y32 = -y23;Y33 = y30+y13+y23+y34;Y34 = -y34;

Y41 = 0;Y42 = 0;Y43 = -y34;Y44 = y34;

Y = [Y11 Y12 Y13 Y14; Y21 Y22 Y23 Y24; Y31 Y32 Y33 Y34; Y41Y42 Y43 Y44]

OUTPUT:Y =0 -10.0000i 0 + 5.0000i 0 + 3.3333i 00 + 5.0000i 0 -15.0000i 0 +10.0000i 00 + 3.3333i 0 +10.0000i 0 -17.0833i 0 + 2.5000i0 0 0 + 2.5000i 0 - 2.5000i

www.eeecube.com

www.eeecube.com

Page 5: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

FORMATION OF Z-BUS MATRIX USING BUS BUILDING ALGORITHM

PROGRAM:

%Formation of Z-Bus matrix using bus building algorithmclcclear 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 newnode(3)')zBus2 = [zBus1(1,1) zBus1(1,1);

zBus1(1,1) zBus1(1,1)+z13]

disp('STEP3: Add an element between existing node(3) andreference node')zBus3 = [zBus2(1,1) zBus2(1,2) zBus2(1,2);

zBus2(2,1) zBus2(2,2) zBus2(2,2);zBus2(2,1) 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

Page 6: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

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.2000i0 + 0.2000i 0 + 0.6000i

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

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

Using Krons reduction method

RESULT:zBus =

0 + 0.1500i 0 + 0.0500i0 + 0.0500i 0 + 0.1500i

www.eeecube.com

www.eeecube.com

Page 7: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

FORMATION OF Z-BUS MATRIX USING BUS BUILDINGALGORITHM

PROGRAM:

%Formation of Z-Bus matrix using bus building algorithmclcclear all

z10 = 1.25j;z12 = 0.25j;z23 = 0.4j;z24 = 0.125j;z30 = 1.25j;z34 = 0.2j;

disp('STEP1: Add an element between reference node(0) andnode(1)')zBus1 = [z10]

disp('STEP2: Add an element between existing node(1) and newnode(2)')zBus2 = [zBus1(1,1) zBus1(1,1);

zBus1(1,1) zBus1(1,1)+z12]

disp('STEP3: Add an element between existing node(2) and newnode(3)')zBus3 = [zBus2(1,1) zBus2(1,2) zBus2(1,2);

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

disp('STEP4: Add an element between existing node(3) andreference node(0)')zBus4 = [zBus3(1,1) zBus3(1,2) zBus3(1,3) zBus3(1,3) ;

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

www.eeecube.com

www.eeecube.com

Page 8: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

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

zBus5 = [zz11 zz12 zz13;zz21 zz22 zz23;zz31 zz32 zz33]

disp('STEP5: Add an element between existing node(3) and newnode(4)')zBus6 = [zBus5(1,1) zBus5(1,2) zBus5(1,3) zBus5(1,3);

zBus5(2,1) zBus5(2,2) zBus5(2,3) zBus5(2,3);zBus5(3,1) zBus5(3,2) zBus5(3,3) zBus5(3,3);zBus5(3,1) zBus5(3,2) 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)) / zBus7(5,5));zzz12 = zBus7(1,2) - ((zBus7(1,5) * zBus7(5,2)) / zBus7(5,5));zzz13 = zBus7(1,3) - ((zBus7(1,5) * zBus7(5,3)) / zBus7(5,5));zzz14 = zBus7(1,4) - ((zBus7(1,5) * zBus7(5,4)) / zBus7(5,5));zzz21 = zzz12;zzz22 = zBus7(2,2) - ((zBus7(2,5) * zBus7(5,2)) / zBus7(5,5));zzz23 = zBus7(2,3) - ((zBus7(2,5) * zBus7(5,3)) / zBus7(5,5));zzz24 = zBus7(2,4) - ((zBus7(2,5) * zBus7(5,4)) / zBus7(5,5));zzz31 = zzz13;zzz32 = zzz23;zzz33 = zBus7(3,3) - ((zBus7(3,5) * zBus7(5,3)) / zBus7(5,5));zzz34 = zBus7(3,4) - ((zBus7(3,5) * zBus7(5,4)) / zBus7(5,5));

www.eeecube.com

www.eeecube.com

Page 9: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

zzz41 = zzz14;zzz42 = zzz24;zzz43 = zzz34;zzz44 = zBus7(4,4) - ((zBus7(4,5) * zBus7(5,4)) / zBus7(5,5));

disp('RESULT:')zBus = [zzz11 zzz12 zzz13 zzz14;

zzz21 zzz22 zzz23 zzz24;zzz31 zzz32 zzz33 zzz34;zzz41 zzz42 zzz43 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.2500i0 + 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.2500i0 + 1.2500i 0 + 1.5000i 0 + 1.5000i0 + 1.2500i 0 + 1.5000i 0 + 1.9000i

STEP4: Add an element between existing node(3) and referencenode(0)zBus4 =0 + 1.2500i 0 + 1.2500i 0 + 1.2500i 0 + 1.2500i0 + 1.2500i 0 + 1.5000i 0 + 1.5000i 0 + 1.5000i0 + 1.2500i 0 + 1.5000i 0 + 1.9000i 0 + 1.9000i0 + 1.2500i 0 + 1.5000i 0 + 1.9000i 0 + 3.1500i

Fictitious node(0) can be eliminatedzBus5 =

0 + 0.7540i 0 + 0.6548i 0 + 0.4960i0 + 0.6548i 0 + 0.7857i 0 + 0.5952i0 + 0.4960i 0 + 0.5952i 0 + 0.7540i

www.eeecube.com

www.eeecube.com

Page 10: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

STEP5: Add an element between existing node(3) and new node(4)zBus6 =0 + 0.7540i 0 + 0.6548i 0 + 0.4960i 0 + 0.4960i0 + 0.6548i 0 + 0.7857i 0 + 0.5952i 0 + 0.5952i0 + 0.4960i 0 + 0.5952i 0 + 0.7540i 0 + 0.7540i0 + 0.4960i 0 + 0.5952i 0 + 0.7540i 0 + 0.9540i

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

Columns 1 through 40 + 0.7540i 0 + 0.6548i 0 + 0.4960i 0 + 0.4960i0 + 0.6548i 0 + 0.7857i 0 + 0.5952i 0 + 0.5952i0 + 0.4960i 0 + 0.5952i 0 + 0.7540i 0 + 0.7540i0 + 0.4960i 0 + 0.5952i 0 + 0.7540i 0 + 0.9540i0 + 0.1587i 0 + 0.1905i 0 - 0.1587i 0 - 0.3587i

Column 50 + 0.1587i0 + 0.1905i0 - 0.1587i0 - 0.3587i0 + 0.6742i

Fictitious node(0) can be eliminated

RESULT:zBus =

0 + 0.7166i 0 + 0.6099i 0 + 0.5334i 0 + 0.5805i0 + 0.6099i 0 + 0.7319i 0 + 0.6401i 0 + 0.6966i0 + 0.5334i 0 + 0.6401i 0 + 0.7166i 0 + 0.6695i0 + 0.5805i 0 + 0.6966i 0 + 0.6695i 0 + 0.7631i

www.eeecube.com

www.eeecube.com

Page 11: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

LOAD FLOW ANALYSIS BY GAUSS-SEIDAL METHOD

PROGRAM:

%Gauss Seidal Methodclcclear 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 Y42Y43 Y44]

disp('STEP2: Initialize bus voltages')v1 = 1.04;v2 = 1.04;v3 =1.0;v4 = 1.0;

www.eeecube.com

www.eeecube.com

Page 12: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

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.6660+2.0000i 3.6660-11.0000i -2.0000+6.0000i

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

STEP2: Initialize bus voltages

STEP3: Calculate Q2 value for PV BusQ2 =

0.0693 - 0.2080i

Q2cal =0.2080

STEP4: Calculate V2 valueV2 =

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

Page 13: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

NEWTON RAPHSON LOAD FLOW METHOD USING MATLAB

PROGRAM:

%Newton Raphson Methodclcclear 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 = abs(Y11);Y12m = abs(Y12);Y21m = abs(Y21);Y22m = abs(Y22);Y11a = angle(Y11);Y12a = angle(Y12);Y21a = angle(Y21);Y22a = angle(Y22);

disp('STEP2: Initialize bus voltages')v1 = 1.05v2 = 1.0d1 = 0d2 = 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.3dP2 = 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.1dQ2 = 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

Page 14: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

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*pqdelta2 = dX(1,1);dV2 = dX(2,1);Xnew = X0+dXv2new = v2+dV2Delta2new = d2+delta2

OUTPUT:

STEP1: Formulate Y-Bus matrixyBus =

0.3043 - 1.8165i -0.3043 + 1.8801i-0.3043 + 1.8801i 0.3043 - 1.8165i

STEP2: Initialize bus voltagesv1 =

1.0500v2 =

1d1 =

0d2 =

0X0 =

01

STEP3: Calculate P2cal, Q2cal, dP2, dQ2P2cal =

-0.0152P2spec =

-0.3000dP2 =

-0.2848Q2cal =

-0.1576

www.eeecube.com

www.eeecube.com

Page 15: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

Check for q limitQ2cal < Q2minQ2spec =

-0.1000dQ2 =

0.0576

STEP4: Form Jacobian matrixJmatrix =

1.9741 0.2891-0.3196 1.6589

Jinv =0.4927 -0.08590.0949 0.5863

STEP5: Compute dXdX =

-0.14520.0067

Xnew =-0.14521.0067

v2new =1.0067

Delta2new =-0.1452

www.eeecube.com

www.eeecube.com

Page 16: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

FAST DECOUPLED POWER FLOW MODEL USING MATLAB

PROGRAM:

%Fast decoupled power flow methodclcclear 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 = abs(Y11);Y12m = abs(Y12);Y21m = abs(Y21);Y22m = abs(Y22);Y11a = angle(Y11);Y12a = angle(Y12);Y21a = angle(Y21);Y22a = angle(Y22);

disp('STEP 2: Initialize bus voltages')v1 = 1.05v2 = 1.02d1 = 0d2 = 0

disp('STEP 3: Check for Q-limit violation')Q2cal = -((v2*v1*Y21m*sin(Y21a-d2+d1))+(v2*v2*Y22m*sin(Y22a)))Q2min = 10/100Q2spec= 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/100dP2 = P2spec-P2caldQ2 = 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

Page 17: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

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

OUTPUT:STEP 1: Form Y-Bus matrixybus =

0.3043 - 1.8165i -0.3043 + 1.8801i-0.3043 + 1.8801i 0.3043 - 1.8165i

STEP 2: Initialize bus voltagesv1 = 1.0500v2 = 1.0200d1 = 0d2 = 0

STEP 3: Check for Q-limit violationQ2cal = -0.1237Q2min = 0.1000

Q2cal < Q2min, therefore Q2cal is with in the limitBus 2 act as pv bus

STEP 4: Calculate dP2 and dQ2P2cal = -0.0152P2spec = 0.6000dP2 = 0.6152dQ2 = 0.2237

STEP 5: Bus susceptance matrixB1 = -1.8170B1_inv = -0.5504B2 = -1.8170B2_inv = -0.5504

STEP 6: calculate d2new and V2newd2new = 0.3386V2new = 1.1231

www.eeecube.com

www.eeecube.com

Page 18: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

LOAD FREQUENCY CONTROL OF SINGLE AREA SYSTEM

Turbine System

1

0.3s+1

Speed Governor System

1

0.08s+1

Power Generation System

333.333

120s+1

Del Pd(S)

500/3000

Del F(S)

-1/R

-1/1.5

www.eeecube.com

www.eeecube.com

Page 19: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

INTEGRAL CONTROL OF LOAD FREQUENCY CONTROL FOR SINGLE AREA SYSTEM

Turbine System

1

0.3s+1

Speed Governer System

1

0.08s+1

Power Generator System

100

20s+1

Integral Control

-0.325

s

Del Pd(S)

Del F(S)

1/R1/2

www.eeecube.com

www.eeecube.com

Page 20: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

LOAD FREQUENCY CONTROL OF DYNAMIC RESPONSE OF TWO AREA SYSTEM

Dek F1(s)

Del Ptie2(s)Del Ptie1(s)

Turbine System 2

1

0.3s+1

Turbine System 1

1

0.3s+1

Tie Line Constant0.5441

s

Speed GovernorSystem 2

1

0.08s+1

Speed GovernorSystem 1

1

0.08s+1

Scope

GeneratorSystem 2

333.333

120s+1

GeneratorSystem 1

333.33

120s+1

Gani

-1/1.5Gain 2

-1/1.5

Del Pd2(s)500/3000Del Pd1(s)500/3000

Alpha 12

-1

Del F2(s)

www.eeecube.com

www.eeecube.com

Page 21: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

ECONOMIC DISPATCH CONTROL WITH LOSS

PROGRAM:

%Economic dispatch control with lossclcclear 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

Page 22: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

OUTPUT:

Economic dispatch problem with loss

Pg1 = 50Pg2 = 100

Iteration - 1Pg11 = 50Pg21 = 51.1364

Iteration - 2Pg12 = 41.8561Pg22 = 51.1364

Iteration - 3Pg13 = 41.8561Pg23 = 50.2109

Iteration - 4Pg14 = 41.7018Pg24 = 50.2109

Iteration - 5Pg15 = 41.7018Pg25 = 50.1934

Iteration - 6Pg16 = 41.6989Pg26 = 50.1934

Total GenerationPgt = 91.8923

Power LossPL = 5.6923

Power demandPD = 86.2000

Note: All Values are in MW

www.eeecube.com

www.eeecube.com

Page 23: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

ECONOMIC DISPATCH CONTROL WITHOUT LOSS

PROGRAM:

%Economic dispatch control without lossclcclear 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-Pg2lamda1 = (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 = Pg2Pg3new = (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+F3disp('All values are in RS/hr')

OUTPUT:

www.eeecube.com

www.eeecube.com

Page 24: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

Economic dispatch without loss

lamda = 8.6149Pg1 = 379.4361Pg2 = 367.4040Pg3 = 178.1598

Here Pg2 Power value is not within the limitPg2>Pg2max then Pg2 = Pg2max

Pg2 = 350Pdnew = 575lamda1 = 8.7147Pg1new = 390.5242Pg2new = 350Pg3new = 184.4758

All values are in MWFitness Function

F1 = 3.2970e+003F2 = 2901F3 = 2.1588e+003Ft = 8.3568e+003

All values are in RS/hr

www.eeecube.com

www.eeecube.com

Page 25: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

TRANSIENT STABILITY ANALYSIS OF SINGLE MACHINE TOINFINITE BUS SYSTEM

PROGRAM:

%TRANSIENT STABILITY ANALYSISclcclear all

%Program%Data entryf = 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 InertiaM = (G*H)/(180*f);fprintf('The value of inertia constant H = %g s2/elec.deg \n',M);

%Pre faultX1 = 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 faultXt1 = 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

Page 26: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

X3 = Xd+Xt;pmax3 = (V*E)/X3;fprintf('pmax3=%.2g\n',pmax3);

%Graph looppn = 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));

endif(tinitial==tc)

pn = pt-(pmax2*sin(del_r));pp = pt-(pmax3*sin(del_r));p = (pn+pp)/2;

endif(tinitial>tc)

p = pt-(pmax3*sin(del_r));enddeldel = 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;

endplot(time,angle,'ko-');grid on;

OUTPUT:

www.eeecube.com

www.eeecube.com

Page 27: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

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

GRAPH:

www.eeecube.com

www.eeecube.com

Page 28: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

www.eeecube.com

www.eeecube.com

Page 29: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

SHORT CIRCUIT FAULT ANALYSIS

PROGRAM:

%Short circuit fault analysisclcclear alldisp('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:4zbus(i,j) = zbus(i,j)-

((zbus(i,n)*zbus(n,j))/zbus(n,n));end

enddisp('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

Page 30: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

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:4zbus(i,j) = zbus(i,j)-

((zbus(i,n)*zbus(n,j))/zbus(n,n));end

endzbus(:,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

Page 31: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

OUTPUT:

Short circuit fault analysisSTEP 1Enter the Z1 value: 1.5j

zbus1 =0 + 1.5000i

STEP 2Enter the z2 value: 0.2j

zbus =0 + 1.5000i 0 + 1.5000i0 + 1.5000i 0 + 1.7000i

STEP 3Enter the z3 value: 0.15j

zbus =0 + 1.5000i 0 + 1.5000i 0 + 1.5000i0 + 1.5000i 0 + 1.7000i 0 + 1.7000i0 + 1.5000i 0 + 1.7000i 0 + 1.8500i

STEP 4Enter the z4 value: 1.5j

zbus =0 + 1.5000i 0 + 1.5000i 0 + 1.5000i 0 + 1.5000i0 + 1.5000i 0 + 1.7000i 0 + 1.7000i 0 + 1.7000i0 + 1.5000i 0 + 1.7000i 0 + 1.8500i 0 + 1.8500i0 + 1.5000i 0 + 1.7000i 0 + 1.8500i 0 + 3.3500i

After Elimination:

zbus =0 + 0.8284i 0 + 0.7388i 0 + 0.6716i0 + 0.7388i 0 + 0.8373i 0 + 0.7612i0 + 0.6716i 0 + 0.7612i 0 + 0.8284i

www.eeecube.com

www.eeecube.com

Page 32: EE2404 POWER SYSTEM SIMULATION · PDF fileee2404 power system simulation laboratory lab manual ... ybus = diag(0,b-1); end ... formation of z-bus matrix using bus building algorithm

STEP 5Enter the next value: 0.3j

zbus =0 + 0.8284i 0 + 0.7388i 0 + 0.6716i 0 + 0.1567i0 + 0.7388i 0 + 0.8373i 0 + 0.7612i 0 - 0.0224i0 + 0.6716i 0 + 0.7612i 0 + 0.8284i 0 - 0.1567i0 + 0.1567i 0 - 0.0224i 0 - 0.1567i 0 + 0.6134i

Final Result:zbus =

0 + 0.7883i 0 + 0.7445i 0 + 0.7117i0 + 0.7445i 0 + 0.8365i 0 + 0.7555i0 + 0.7117i 0 + 0.7555i 0 + 0.7883i

Enter the voltage value: 1

Fault at Bus 2Fault current:If = 0 - 1.1955i

Post fault Bus voltages:

v1f = 0.1099v2f = 0v3f = 0.0969

Line Flows:I13f = 0.0436

Fault at Bus 3Fault Current:If = 0 - 1.2685i

Post fault Voltages:v1f = 0.0972v2f = 0.0417v3f = 0

Line Flows:I13f = 0.3241

www.eeecube.com

www.eeecube.com