Modern Power System Analysis - D. P. Kothari and I. J. Nagrath
Modern Power System Analysis - D. P. Kothari and I. J. Nagrath
Created by
Brahmesh Jain S D
B.E
Electrical Engineering
Sri Jayachamarajendra College Of Engineering
College Teacher
Prof. R S Anandamurthy
Cross-Checked by
TechPassion
Edition: 3
Year: 2003
ISBN: 0070494894
1
Scilab numbering policy used in this document and the relation to the
above book.
For example, Exa 3.51 means solved example 3.51 of this book. Sec 2.3 means
a scilab code whose theory is explained in Section 2.3 of the book.
2
Contents
1 Introduction 6
3
17 Voltage Stability 183
4
List of Scilab Codes
5
Exa 6.1 Ybus using singular transformation . . . . . . . . . . . 48
Exa 6.2 Ybus of a sample system . . . . . . . . . . . . . . . . 49
Exa 6.3 Approximate load flow solution . . . . . . . . . . . . . 51
Exa 6.4 Bus voltages using GS iterations . . . . . . . . . . . . 53
Exa 6.5 Reactive power injected using GS iterations . . . . . . 55
Exa 6.6 Load flow solution using the NR method . . . . . . . . 58
Exa 6.7 Ybus after including regulating transformer . . . . . . 63
Exa 6.8 Decoupled NR method and FDLF method . . . . . . . 64
Exa 7.1 Incremental cost and load sharing . . . . . . . . . . . 70
Exa 7.2 Savings by optimal scheduling . . . . . . . . . . . . . . 73
Exa 7.3 Economical operation . . . . . . . . . . . . . . . . . . 75
Exa 7.4 Generation and losses incurred . . . . . . . . . . . . . 76
Exa 7.5 Savings on coordination of losses . . . . . . . . . . . . 78
Exa 7.6 Loss formula coefficients calculation . . . . . . . . . . 81
Exa 7.7 Optimal generation schedule for hydrothermal system 83
Exa 8.1 Frequency change Calculation . . . . . . . . . . . . . . 87
Exa 8.2 Load sharing and System Frequency . . . . . . . . . . 88
Exa 9.1 Fault Current Calculation . . . . . . . . . . . . . . . . 89
Exa 9.2 Subtransient and Momentary current Calculation . . . 91
Exa 9.3 Subtransient Current Calculation . . . . . . . . . . . . 94
Exa 9.4 Maximum MVA Calculation . . . . . . . . . . . . . . . 96
Exa 9.5 Short Circuit Solution . . . . . . . . . . . . . . . . . . 100
Exa 9.6 Short Circuit Solution using Algorithm . . . . . . . . . 101
Exa 9.7 Current Injection Method . . . . . . . . . . . . . . . . 104
Exa 9.8 Zbus matrix building using Algorithm . . . . . . . . . 105
Exa 9.9 PostFault Currents and Voltages Calculation . . . . . 108
Exa 10.1 Symmetrical components of line currents Calculation . 110
Exa 10.2 Sequence Network of the System . . . . . . . . . . . . 113
Exa 10.3 Zero sequence Network . . . . . . . . . . . . . . . . . 114
Exa 10.4 Zero Sequence Network . . . . . . . . . . . . . . . . . 115
Exa 11.1 LG and 3Phase faults Comparision . . . . . . . . . . . 117
Exa 11.2 Grounding Resistor voltage and Fault Current . . . . . 118
Exa 11.3 Fault and subtransient currents of the system . . . . . 120
Exa 11.4 LL Fault Current . . . . . . . . . . . . . . . . . . . . . 124
Exa 11.5 Double line to ground Fault . . . . . . . . . . . . . . . 126
Exa 11.6 Bus Voltages and Currents Calculations . . . . . . . . 129
Exa 11.7 Short Circuit Current Calculations . . . . . . . . . . . 133
6
Exa 12.1 Calculation of stored kinetic energy and rotor accelera-
tion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Exa 12.2 steady state power limit . . . . . . . . . . . . . . . . . 137
Exa 12.3 Maximum Power Transferred . . . . . . . . . . . . . . 139
Exa 12.4 Acceleration and Rotor angle . . . . . . . . . . . . . . 141
Exa 12.5 Frequency Of Natural Oscilations . . . . . . . . . . . . 142
Exa 12.6 Steady State Power Limit 2 . . . . . . . . . . . . . . . 144
Exa 12.7 Critcal Clearing Angle . . . . . . . . . . . . . . . . . . 145
Exa 12.8 Critcal Clearing Angle 2 . . . . . . . . . . . . . . . . . 146
Exa 12.9 Critcal Clearing Angle 3 . . . . . . . . . . . . . . . . . 149
Exa 12.10 Swing Curves For Sustained Fault and Cleared Fault at
the Specified Time . . . . . . . . . . . . . . . . . . . . 151
Exa 12.11 Swing Curves For Multimachines . . . . . . . . . . . . 157
Exa 12.12 Swing Curves For Three Pole and Single Pole Switching 164
Exa 13.1 Generation Shift Factors and Line Outage Distribution
Factors . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Exa 14.1 Estimation of random variables . . . . . . . . . . . . . 179
Exa 14.2 Estimation of random variables using WLSE . . . . . 180
Exa 14.3 Estimation of random variables using WLSE 2 . . . . 181
Exa 17.1 Reactive power sensitivity . . . . . . . . . . . . . . . . 183
Exa 17.2 Capacity of static VAR compensator . . . . . . . . . . 183
7
List of Figures
8
Chapter 1
Introduction
Example 1
1 // C h a p t e r 1
2 // Example 1 . 1
3 // p a g e 5
4 clear ; clc ;
5 fl =760 e3 ;
6 pf =0.8;
7 lsg =0.05;
8 csg =60;
9 depre =0.12;
10 hpw =48;
11 lv =32;
12 hv =30;
13 pkwhr =0.10;
14
15 md = fl / pf ;
16 printf ( Maximum Demand= %. 1 f kVA \n\n , md /1000) ;
17
18 // c a l c u l a t i o n f o r t a r i f f (b)
19
9
20 printf ( L o s s i n s w i t c h g e a r=%. 2 f %% \n\n , lsg *100) ;
21 input_demand = md /(1 - lsg ) ;
22 input_demand = input_demand /1000;
23 cost_sw_ge = input_demand *60;
24 depreciation = depre * cost_sw_ge ;
25 fixed_charges = hv * input_demand ;
26 running_cost = input_demand * pf * hpw *52* pkwhr ; // 52 w e e k s
per year
27 total_b = depreciation + fixed_charges + running_cost ;
28 printf ( I n p u t Demand= %. 1 f kVA \n\n , input_demand ) ;
29 printf ( C o s t o f s w i t c h g e a r=Rs %d\n\n , cost_sw_ge ) ;
30 printf ( Annual c h a r g e s on d e p r e c i a t i o n=Rs %d \n\n ,
depreciation ) ;
31 printf ( Annual f i x e d c h a r g e s due t o maximum demand
c o r r e s p o n d i n g t o t r i f f ( b )=Rs %d \n\n ,
fixed_charges ) ;
32 printf ( Annual r u n n i n g c o s t due t o kWh consumed=Rs
%d \n\n , running_cost ) ;
33 printf ( T o t a l c h a r g e s /annum f o r t a r i f f ( b ) = Rs %d\n\
n , total_b )
34
35 // c a l c u l a t i o n f o r t a r i f f ( a )
36 input_demand = md ;
37 input_demand = input_demand /1000;
38 fixed_charges = lv * input_demand ;
39 running_cost = input_demand * pf * hpw *52* pkwhr ;
40 total_a = fixed_charges + running_cost ;
41 printf ( maximum demand c o r r e s p o n d i n g t o t a r i f f ( a ) =
%. f kVA \n\n , input_demand ) ;
42 printf ( Annual f i x e d c h a r g e s=Rs %d \n\n ,
fixed_charges ) ;
43 printf ( Annual r u n n i n g c h a r g e s f o r kWh consumed = Rs
%d \n\n , running_cost ) ;
44 printf ( T o t a l c h a r g e s /annum f o r t a r i f f ( a ) = Rs %d \n
\n , total_a ) ;
45 if ( total_a > total_b )
46 printf ( T h e r e f o r e , t a r i f f ( b ) i s e c o n o m i c a l \n\n\n
);
10
47 else
48 printf ( T h e r e f o r e , t a r i f f ( a ) i s e c o n o m i c a l \n\n\n
);
Example 3
1 // C h a p t e r 1
2 // Example 1 . 3
3 // p a g e 7
4 clear ; clc ;
5 md =25;
6 lf =0.6;
7 pcf =0.5;
8 puf =0.72;
9
10 avg_demand = lf * md ;
11 installed_capacity = avg_demand / pcf ;
12 reserve = installed_capacity - md ;
13 daily_ener = avg_demand *24;
14 ener_inst_capa = installed_capacity *24;
15 max_energy = daily_ener / puf ;
16
17 printf ( A v e r a g e Demand= %. 2 f MW \n\n , avg_demand ) ;
18 printf ( I n s t a l l e d c a p a c i t y= %. 2 f MW \n\n\ ,
installed_capacity ) ;
19 printf ( R e s e r v e c a p a c i t y o f t h e p l a n t= %. 2 f MW \n\n
, reserve ) ;
20 printf ( D a i l y e n e r g y p r o d u c e d= %d MWh \n\n ,
daily_ener ) ;
21 printf ( Energy c o r r e s p o n d i n g t o i n s t a l l e d c a p a c i t y
p e r day= %d MWh \n\n , ener_inst_capa ) ;
11
22 printf ( Maximum e n e r g y t h a t c o u l d be p r o d u c e d = %d
MWh/ day \n\n , max_energy ) ;
Example 4
1 // C h a p t e r 1
2 // Example 1 . 2
3 // p a g e 6
4 clear ; clc ;
5 md =20 e3 ;
6 unit_1 =14 e3 ;
7 unit_2 =10 e3 ;
8 ener_1 =1 e8 ;
9 ener_2 =7.5 e6 ;
10 unit1_time =1;
11 unit2_time =0.45;
12
13 annual_lf_unit1 = ener_1 /( unit_1 *24*365) ;
14 md_unit_2 = md - unit_1 ;
15 annual_lf_unit2 = ener_2 /( md_unit_2 *24*365) ;
16 lf_unit_2 = ener_2 /( md_unit_2 * unit2_time *24*365) ;
17 unit1_cf = annual_lf_unit1 ;
18 unit1_puf = unit1_cf ;
19 unit2_cf = ener_2 /( unit_2 *24*365) ;
20 unit2_puf = unit2_cf / unit2_time ;
21 annual_lf =( ener_1 + ener_2 ) /( md *24*365) ;
22
23
24 printf ( Annual l o a d f a c t o r f o r U n i t 1 = %. 2 f %% \n\n
, annual_lf_unit1 *100) ;
12
25 printf ( The maximum demand on U n i t 2 i s %d MW \n\n ,
md_unit_2 /1000) ;
26 printf ( Annual l o a d f a c t o r f o r U n i t 2 = %. 2 f %% \n\n
, annual_lf_unit2 *100) ;
27 printf ( Load f a c t o r o f U n i t 2 f o r t h e t i m e i t t a k e s
t h e l o a d= %. 2 f %% \n\n , lf_unit_2 *100) ;
28 printf ( P l a n t c a p a c i t y f a c t o r o f u n i t 1 = %. 2 f %% \n
\n , unit1_cf *100) ;
29 printf ( P l a n t u s e f a c t o r o f u n i t 1 = %. 2 f %% \n\n ,
unit1_puf *100) ;
30 printf ( Annual p l a n t c a p a c i t y f a c t o r o f u n i t 2 = %. 2
f %% \n\n , unit2_cf *100) ;
31 printf ( P l a n t u s e f a c t o r o f u n i t 2 = %. 2 f %% \n\n ,
unit2_puf *100) ;
32 printf ( The a n n u a l l o a d f a c t o r o f t h e t o t a l p l a n t =
%. 2 f %% \n\n , annual_lf *100) ;
Example 5
1 // C h a p t e r 1
2 // Example 1 . 2
3 // p a g e 6
4 clear ; clc ;
5
6 c1_md_6pm =5; c1_d_7pm =3; c1_lf =0.2;
7 c2_md_11am =5; c2_d_7pm =2; c2_avg_load =1.2;
8 c3_md_7pm =3; c3_avg_load =1;
9
10 md_system = c1_d_7pm + c2_d_7pm + c3_md_7pm ;
11 sum_mds = c1_md_6pm + c2_md_11am + c3_md_7pm ;
12 df = sum_mds / md_system ;
13
13
14 printf ( Maximum demand o f t h e s y s t e m i s %d kW a t 7 p .
m \n , md_system ) ;
15 printf ( Sum o f t h e i n d i v i d u a l maximum demands = %d
kW \n , sum_mds ) ;
16 printf ( D i v e r s i t y f a c t o r = %. 3 f \n\n , df ) ;
17
18 c1_avg_load = c1_md_6pm * c1_lf ;
19 c2_lf = c2_avg_load / c2_md_11am ;
20 c3_lf = c3_avg_load / c3_md_7pm ;
21
22 printf ( Consumer1 >\t A v g l o a d= %. 2 f kW \ t LF= %. 1
f %% \n , c1_avg_load , c1_lf *100) ;
23 printf ( Consumer2 >\t A v g l o a d= %. 2 f kW \ t LF= %. 1
f %% \n , c2_avg_load , c2_lf *100) ;
24 printf ( Consumer3 >\t A v g l o a d= %. 2 f kW \ t LF= %. 1
f %% \n\n , c3_avg_load , c3_lf *100) ;
25
26 avg_load = c1_avg_load + c2_avg_load + c3_avg_load ;
27 lf = avg_load / md_system ;
28
29 printf ( Combined a v e r a g e l o a d = %. 1 f kW \n , avg_load
);
30 printf ( Combined l o a d f a c t o r = %. 1 f %% \n\n , lf *100) ;
14
Chapter 2
1 // C h a p t e r 2
2 // Example 2 . 1
3 // p a g e 56
4 //To f i n d GMD o f t h e c o n d u c t o r
5 // From t h e g i v e n t h e t e x t book , l e a v i n g o u t t h e
f a c t o r o f r , we have t h e s e v e n p o s s i b l e
distances
6 clear ; clc ;
7 D1 =0.7788*2*2*(2* sqrt (3) ) *4*(2* sqrt (3) ) *2;
8 // s i n c e t h e r e a r e 7 i d e n t i c a l c o n d u c t o r s , t h e a b o v e
p r o d u c t s r e m a i n s same d o r a l l D s
9 D2 = D1 ;
10 D3 = D1 ;
11 D4 = D1 ;
12 D5 = D1 ;
13 D6 = D1 ;
14 D7 = D1 ;
15
15 Ds =( D1 * D2 * D3 * D4 * D5 * D6 * D7 ) ^(1/(7*7) ) ;
16 printf ( \n GMD o f t h e c o n d u c t o r i s %0 . 4 f r , Ds ) ;
1 // C h a p t e r 2
2 // Example 2 . 2
3 // p a g e 57
4 //To f i n d r e a c t a n c e o f t h e c o n d u c t o r
5 clear ; clc ;
6 f =50; // f r e q u e n c y
7 D =5.04; // d i a m e t e r o f t h e e n t i r e ACSR
8 d =1.68; // d i a m e t e r o f e a c h c o n d u c t o r
9 Dsteel =D -2* d ; // d i a m e t e r o f s t e e l s t r a n d
10 // As shown i n f i g
11 D12 = d ;
12 D13 =( sqrt (3) * d ) ;
13 D14 =2* d ;
14 D15 = D13 ;
15 D16 = D12 ;
16 // n e g l e c t i n g t h e c e n t r a l s t t e l c o n d u c t o r , we have t h e
6 possibilities
17 D1 =(0.7788* d ) * D12 * D13 * D14 * D15 * D16 ;
18 // we have t o t a l o f 6 c o n d u c t o r s , h e n c e
19 D2 = D1 ;
20 D3 = D1 ;
21 D4 = D1 ;
22 D5 = D1 ;
23 D6 = D1 ;
24 Ds =( D1 * D2 * D3 * D4 * D5 * D6 ) ^(1/(6*6) ) ; //GMR;
25 // s i n c e t h e s p a c i n g b e t w e e n l i n e s i s 1m=100cm
16
26 l =100;
27 L =0.461* log10 ( l / Ds ) ; // I n d u c t a n c e o f e a c h c o n d u c t o r
28 Ll =2* L ; // l o o p i n d u c t a n c e
29 Xl =2* %pi * f * Ll *10^( -3) ; // r e a c t a n c e o f t h e l i n e
30 printf ( \n\ n I n d u c t a n c e o f e a c h c o n d u c t o r=%0 . 4 f mH/km
\n\n ,L ) ;
31 printf ( Loop I n d u c t a n c e=%0 . 4 f mH/km\n\n , Ll ) ;
32 printf ( Loop R e a c t a n c e=%f ohms /km\n\n , Xl ) ;
1 // C h a p t e r 2
2 // Example 2 . 3
3 // p a g e 58
4 //To f i n d i n d u c t a n c e o f e a c h s i d e o f t h e l i n e and
that of the complete l i n e
5 clear ; clc ;
6 // t o f i n d mutual GMD
7 D14 = sqrt (8*8+2*2) ;
8 D15 = sqrt (8*8+6*6) ;
9 D24 = sqrt (8*8+2*2) ;
10 D25 = sqrt (8*8+2*2) ;
11 D34 = sqrt (8*8+6*6) ;
12 D35 = sqrt (8*8+2*2) ;
13 // s i x t h r o o t o f s i x mutual d i s t a n c e s
14 Dm =( D14 * D15 * D24 * D25 * D34 * D35 ) ^(1/6) ; // mutual GMD
between l i n e s
15
16 // t o f i n d GMR o f S i d e A c o n d u c t o r s
17 D11 =0.7788*2.5*10^( -3) ;
18 D22 = D11 ;
17
19 D33 = D11 ;
20 D12 =4;
21 D21 = D12 ;
22 D13 =8;
23 D31 =8;
24 D23 =4;
25 D32 = D23 ;
26 // n i n t h r o o t n i n e d i s t a n c e s i n S i d e A
27 Da =( D11 * D12 * D13 * D21 * D22 * D23 * D31 * D32 * D33 ) ^(1/9) ;
28
29 // t o f i n d GMR o f S i d e A c o n d u c t o r s
30 D44 =0.7788*5*10^( -3) ;
31 D45 =4;
32 D54 = D45 ;
33 D55 = D44 ;
34 // f o u r t h r o o t o f f o u r d i s t a n c e s i n S i d e B
35 Db =( D44 * D45 * D54 * D55 ) ^(1/4) ;
36
37 La =0.461* log10 ( Dm / Da ) ; // i n d u c t a n c e l i n e A
38 Lb =0.461* log10 ( Dm / Db ) ; // i n d u c t a n c e l i n e B
39
40 L = La + Lb ; // l o o p i n d u c t a n c e
41
42 printf ( \n\ nMutual GMD b e t w e e n l i n e s = %0 . 4 f m\n\n ,
Dm ) ;
43 printf ( GMR o f S i d e A c o n d u c t o r s = %0 . 4 f m\n\n , Da ) ;
44 printf ( GMR o f S i d e B c o n d u c t o r s = %0 . 4 f m\n\n , Db ) ;
45 printf ( I n d u c t a n c e o f l i n e A = %0 . 4 f mH/km\n\n , La ) ;
46 printf ( I n d u c t a n c e o f l i n e B = %0 . 4 f mH/km\n\n , Lb ) ;
47 printf ( Loop I n d u c t a n c e o f t h e l i n e s = %0 . 4 f mH/km\n
\n ,L ) ;
18
VoltageDrop and FluxLinkage Calculations
1 // C h a p t e r 2
2 // Example 2.5
3 // p a g e 63
4 //To f i n d f l u x l i n k a g e s w i t h n e u t r a l and v o l t a g e
induced in neutral
5 //To f i n d v o l t a g e d r o p i n e a c h o f t h r e e p h a s e w i r e s
6
7 clear ; clc ;
8 Ia = -30+ %i *50;
9 Ib = -25+ %i *55;
10 Ic = -( Ia + Ib ) ;
11
12 // ( a ) t o f i n d f l u x l i n k a g e s w i t h n e u t r a l and v o l t a g e
induce in i t
13 Dan =4.5;
14 Dbn =3; // from f i g u r e
15 Dcn =1.5;
16 Phi_n =2*10^( -7) *( Ia * log (1/ Dan ) + Ib * log (1/ Dbn ) + Ic * log
(1/ Dcn ) ) ;
17 Vn = %i *2* %pi *50* Phi_n *15000; // v o l t a g e i n d u c e d f o r 15
km l o n g TL
18 Vn = abs ( Vn ) ;
19 printf ( \ nFlux l i n k a g e s o f t h e n e u t r a l w i r e = %f Wb
T/m\n\n , Phi_n ) ;
20 printf ( V o l t a g e i n d u c e d i n t h e n e u t r a l = %d\n\n , Vn )
;
21
22 // ( b ) t o f i n d v o l t a g e d r o p i n e a c h p h a s e
23 Phi_a =2*10^( -7) *( Ia * log (1/(0.7788*0.005) ) + Ib * log
(1/1.5) + Ic * log (1/3) ) ;
24 Phi_b =2*10^( -7) *( Ib * log (1/(0.7788*0.005) ) + Ia * log
(1/1.5) + Ic * log (1/1.5) ) ;
25 Phi_c =2*10^( -7) *( Ic * log (1/(0.7788*0.005) ) + Ib * log
(1/1.5) + Ia * log (1/3) ) ;
26
19
27 delta_Va = %i *2* %pi *50* Phi_a *15000; // l i k e we d i d f o r
neutral voltage
28 delta_Vb = %i *2* %pi *50* Phi_b *15000;
29 delta_Vc = %i *2* %pi *50* Phi_c *15000;
30
31 printf ( The V o l t a g e d r o p o f p h a s e a ( i n v o l t s ) = ) ;
disp ( delta_Va ) ;
32 printf ( \n\ nThe V o l t a g e d r o p o f p h a s e b ( i n v o l t s ) =
) ; disp ( delta_Vb ) ;
33 printf ( \n\ nThe V o l t a g e d r o p o f p h a s e c ( i n v o l t s ) =
) ; disp ( delta_Vc ) ;
1 // C h a p t e r 2
2 // Example 2 . 6
3 // p a g e 65
4 //To f i n d mutual i n d u c t a n c e b e t w e e n power l i n e and
t e l e p h o n e l i n e and v o l t a g e i n d u c e d i n t e l e p h o n e
line
5
6 clear ; clc ;
7 D1 = sqrt (1.1*1.1+2*2) ; // from f i g u r e 2 . 1 4
8 D2 = sqrt (1.9*1.9+2*2) ; // from f i g u r e 2 . 1 4
9 Mpt =0.921* log10 ( D2 / D1 ) ; // mutual i n d u c t a n c e
10 Vt = abs ( %i *2* %pi *50* Mpt *10^( -3) *100) ; // when 100A i s
f l o w i n g i n t h e power l i n e s
11
12 printf ( \n\ nMutual i n d u c t a n c e b e t w e e n power l i n e and
t e l e p h o n e l i n e = %f mH/km\n\n , Mpt ) ;
13 printf ( \n\ n V o l t a g e i n d u c e d i n t h e t e l e p h o n e c i r c u i t
= %. 3 f V/km\n\n , Vt ) ;
20
Scilab code Exa 2.7 Bundled Conductor Three Phase Line
Bundled Conductor Three Phase Line
1 // C h a p t e r 2
2 // Example 2 . 7
3 // p a g e 69
4 //To f i n d i n d u c t i v e r e a c t a n c e o f f o r t h e t h r e e p h a s e
bundled conductors
5 clear ; clc ;
6 r =0.01725; // r a d i u s o f e a c h c o n d u c t o r
7 // from t h e f i g u r e we can d e c l a r e t h e d i s t a n c e s
8 d =7;
9 s =0.4;
10 // Mutual GMD b e t w e e n b u n d l e s o f p h a s e s a and b
11 Dab =( d *( d + s ) *( d - s ) * d ) ^(1/4) ;
12 // Mutual GMD b e t w e e n b u n d l e s o f p h a s e s b and c
13 Dbc = Dab ; // by symmetry
14 // Mutual GMD b e t w e e n b u n d l e s o f p h a s e s c and a
15 Dca =(2* d *(2* d + s ) *(2* d - s ) *2* d ) ^(1/4) ;
16 // E q u i v a l e n t GMD i s c a l c u l a t e d a s
17 Deq =( Dab * Dbc * Dca ) ^(1/3) ;
18 // s e l f GMD i s g i v e n by
19 Ds =(0.7788*1.725*10^( -2) *0.4*0.7788*1.725*10^( -2)
*0.4) ^(1/4) ;
20 // I n d u c t i v e r e a c t a n c e p e r p h a s e i s g i v e n by
21 Xl =2* %pi *50*10^( -3) *0.461* log10 ( Deq / Ds ) ; // 10( 3)
b e c a u s e p e r km i s a s k e d
22 printf ( \n\ nMutual GMD b e t w e e n b u n d l e s o f p h a s e s a
and b = %0 . 3 fm\n\n , Dab ) ;
23 printf ( Mutual GMD b e t w e e n b u n d l e s o f p h a s e s b and c
= %0 . 3 fm\n\n , Dbc ) ;
21
24 printf ( Mutual GMD b e t w e e n b u n d l e s o f p h a s e s c and a
= %0 . 3 fm\n\n , Dca ) ;
25 printf ( E q u i v a l e n t GMD = %0 . 3 fm\n\n , Deq ) ;
26 printf ( S e l f GMD o f t h e b u n d l e s = %0 . 3 fm\n\n , Ds ) ;
27 printf ( I n d u c t i v e r e a c t a n c e p e r p h a s e = %0 . 3 f ohms /
km\n\n , Xl ) ;
28
29 // now l e t u s compute r e a c t a n c e when c e n t e r t o
c e n t e r r d i s t a n c e s are used
30 Deq1 =( d * d *2* d ) ^(1/3) ;
31 Xl1 =2* %pi *50*0.461*10^( -3) * log10 ( Deq1 / Ds ) ;
32 printf ( \n When r a d i u s o f c o n d u c t o r s a r e n e g l e c t e d
and o n l y d i s t a n c e b e t w e e n c o n d u c t o r s a r e used , we
g e t b e l o w r e s u l t s : \ n\n ) ;
33 printf ( E q u i v a l e n t mean d i s t a n c e i s = %f\n\n , Deq1 ) ;
34 printf ( I n d u c t i v e r e a c t a n c e p e r p h a s e = %0 . 3 f ohms /
km\n\n , Xl1 ) ;
35
36 // when b u n d l e o f c o n d u c t o r s a r e r e p l a c e d by an
equivalent s i n g l e conductor
37 cond_dia = sqrt (2) *1.725*10^( -3) ; // c o n d u c t o r d i a m e t e r
f o r same c r o s s s e c t i o n a l a r e a
38 Xl2 =2* %pi *50*0.461*10^( -3) * log10 ( Deq1 / cond_dia ) ;
39 printf ( \nWhen b u n d l e o f c o n d u c t o r s a r e r e p l a c e d by
an e q u i v a l e n t s i n g l e c o n d u c t o r : \ n\n ) ;
40 printf ( I n d u c t i v e r e a c t a n c e p e r p h a s e = %0 . 3 f ohms /
km\n\n , Xl2 ) ;
41 percentage_increase =(( Xl2 - Xl1 ) / Xl1 ) *100;
42 printf ( T h i s i s %0 . 2 f h i g h e r t h a n c o r r e s p o n d i n g
value f o r a bundled conductor l i n e . ,
percentage_increase ) ;
22
Chapter 3
Capacitance of Transmission
Lines
1 // C h a p t e r 3
2 // Example 3 . 1
3 // p a g e 87
4 //To c a l c u l a t e t h e c a p a c i t a n c e t o n e u t r a l o f a
s i n g l e phase l i n e
5 clear ; clc ;
6 r =0.328; // r a d i u s o f t h e c o n d u c t o r s
7 D =300; // d i s t a n c e b e t w e e n t h e c o n d u c t o r s
8 h =750; // h e i g h t o f t h e c o n d u c t o r s
9
10 // c a l c u l a t i n g c a p a c i t a n c e n e g l e c t i n g t h e p r e s e n c e o f
ground
11 // u s i n g Eq ( 3 . 6 )
12 Cn =(0.0242/( log10 ( D / r ) ) ) ;
13 printf ( \ n C a p a c i t a n c e t o n e u t r a l /km o f t h e g i v e n
s i n g l e phase l i n e n e g l e c t i n g p r e s e n c e of the
e a r t h ( u s i n g Eq 3 . 6 ) i s = %0 . 5 f uF/km\n\n , Cn ) ;
23
14
15 // u s i n g Eq ( 3 . 7 )
16 Cn =(0.0242) / log10 (( D /(2* r ) ) +(( D ^2) /(4* r ^2) -1) ^0.5) ;
17 printf ( C a p a c i t a n c e t o n e u t r a l /km o f t h e g i v e n
s i n g l e phase l i n e n e g l e c t i n g p r e s e n c e of the
e a r t h ( u s i n g Eq 3 . 7 ) i s = %0 . 5 f uF/km\n\n , Cn ) ;
18
19 // C o n s u d e r i n g t h e e f f e c t o f e a r t h and n e g l e c t i n g t h e
non u n i f o r m i t y o f t h e c h a r g e
20 Cn =(0.0242) / log10 ( D /( r *(1+(( D ^2) /(4* h ^2) ) ) ^0.5) ) ;
21 printf ( C a p a c i t a n c e t o n e u t r a l /km o f t h e g i v e n
s i n g l e phase l i n e c o n s i d e r i n g the p r e s e n c e o f the
e a r t h and n e g l e c t i n g non u n i f o r m i t y o f c h a r g e
d i s t r i b u t i o n ( u s i n g Eq 3 . 2 6 b ) i s = %0 . 5 f uF/km\n\
n , Cn ) ;
1 // C h a p t e r 3
2 // Example 3 . 2
3 // p a g e 88
4 //To c l a c u l a t e t h e c a p a c i t a n c e t o n e u t r a l and
charging c u r r e n t o f a t h r e e phase t r a n s m i s s i o n
line
5 clear ; clc ;
6 d =350; // d i s t a n c e b e t w e e n a d j a c e n t l i n e s
7 r =1.05/2; // r a d i u s o f t h e c o n d u c t o r
8 v =110 e3 ; // l i n e v o l t a g e ;
9 f =50;
10
11 Deq =( d * d *2* d ) ^(1/3) ; //GMD o r e q u i v a l e n t
24
12
13 Cn =(0.0242/ log10 ( Deq / r ) ) ;
14
15 Xn =1/(2* %pi * f * Cn *10^( -6) ) ; // Cn i s i n uF h e n c e we
add 1 0 6 w h i l e p r i n t i n g
16
17 Ic =( v / sqrt (3) ) / Xn ;
18
19 printf ( \ n C a p a c i t a n c e t o n e u t r a l i s = %f uF/km\n\n ,
Cn ) ;
20 printf ( C a p a c i t i v e r e c t a n c e o f t h e l i n e i s = %f ohm/
km t o n e u t r a l \n\n , Xn ) ;
21 printf ( C h a r g i n g C u r r e n t = %0 . 2 f A/km\n\n , Ic ) ;
Scilab code Exa 3.3 Double circuit three phase transmission line
1 // C h a p t e r 3
2 // Example 3 . 3
3 // p a g e 88
4 //To c l a c u l a t e t h e c a p a c i t a n c e t o n e u t r a l and
charging c u r r e n t o f a double c i r c u i t t h r e e phase
transmission line
5 clear ; clc ;
6
7 // A f t e r d e r i v i n g t h e e q u a t i o n f o r Cn from t h e
t e x t b o o k and s t a r t i n g c a l c u l a t i o n from Eq 3 . 3 6
onwards
8
9 r =0.865*10^( -2) ; frequency =50; v =110 e3 ;
10 h =6; d =8; j =8; // R e f e r r i n g t o f i g g i v e n i n t h e
textbook
25
11
12 i =(( j /2) ^2+(( d - h ) /2) ^2) ^(1/2) ;
13 f =( j ^2+ h ^2) ^(1/2) ;
14 g =(7^2+4^2) ^(1/2) ;
15
16
17 Cn =4* %pi *8.85*10^( -12) /( log (((( i ^2) *( g ^2) * j * h ) /(( r
^3) *( f ^2* d ) ) ) ^(1/3) ) ) ;
18
19 Cn = Cn *1000 ; //Cn i s i n p e r m. t o c o n v e r t i t t o p e r
km , we m u l t i p l y by 1 0 0 0
20 WCn =2* %pi * frequency * Cn ;
21
22 Icp =( v / sqrt (3) ) * WCn ;
23
24 Icc = Icp /2;
25
26 printf ( \ n T o t a l c a p a c i t a n c e t o n e u t r a l f o r two
c o n d u c t o r s i n p a r a l l e l = %0 . 6 f uF/km \n\n , Cn
*10^(6) ) ;
27 printf ( C h a r g i n g c u r r e n t / p h a s e = %0 . 3 f A/km \n\n ,
Icp ) ;
28 printf ( C h a r g i n g c u r r e n t / c o n d u c t o r = %0 . 4 f A/km \n\n
, Icc ) ;
26
Chapter 4
Representation of Power
System Components
1 // C h a p t e r 4
2 // Example 4 . 1
3 // p a g e 103
4 // t o draw t h e p e r u n i t r e a c t a n c e d i a g r a m
5 clear ; clc ;
6 mvab =30; kvb =33; //MVA b a s e and KVA b a s e a r e
selected
7
8 gen1_mva =30; gen1_kv =10.5; gen1_x =1.6; // G e n e r a t o r
No . 1 d e t a i l s
9 gen2_mva =15; gen2_kv =6.6; gen2_x =1.2; // G e n e r a t o r
No . 2 d e t a i l s
10 gen3_mva =25; gen3_kv =6.6; gen3_x =0.56; // G e n e r a t o r
No . 3 d e t a i l s
11
12 t1_mva =15; t1_hv =33; t1_lv =11; t1_x =15.2; //
T r a n s f o r m e r T1 d e t a i l s
27
13 t2_mva =15; t2_hv =33; t2_lv =6.2; t2_x =16; //
T r a n s f o r m e r T1 d e t a i l s
14
15 tl_x =20.5; // T r a n s m i s s i o n l i n e r e c a t a n c e
16
17 // Loads a r e n e g l e c t e d a s s a i d i n t h e p r o b l e m
18
19 tl_pu =( tl_x * mvab ) / kvb ^2;
20 t1_pu =( t1_x * mvab ) / kvb ^2;
21 t2_pu =( t2_x * mvab ) / kvb ^2;
22 gen1_kv_base = t1_lv ;
23 gen1_pu =( gen1_x * mvab ) / gen1_kv_base ^2;
24 gen2_kv_base = t2_lv ;
25 gen2_pu =( gen2_x * mvab ) / gen2_kv_base ^2;
26 gen3_pu =( gen3_x * mvab ) / gen2_kv_base ^2;
27
28 // d i p l a y i n g t h e r e s u l t s on c o n s o l e
29
30 printf ( Per u n i t i m p e d a n c e o f t h e c o m p o n e n t s o f t h e
g i v e n power s y s t e m a r e a s f o l l o w s : \ n\n ) ;
31
32 printf ( T r a n s m i s s i o n l i n e : %0 . 3 f \n\n , tl_pu ) ;
33
34 printf ( T r a n s f o r m e r T1 : %0 . 3 f \n\n , t1_pu ) ;
35
36 printf ( T r a n s f o r m e r T2 : %0 . 3 f \n\n , t2_pu ) ;
37
38 printf ( G e n e r a t o r 1 : %0 . 3 f \n\n , gen1_pu ) ;
39
40 printf ( G e n e r a t o r 2 : %0 . 3 f \n\n , gen2_pu ) ;
41
42 printf ( G e n e r a t o r 3 : %0 . 3 f \n\n , gen3_pu ) ;
28
Scilab code Exa 4.2 Per Unit Calculation
1 // C h a p t e r 4
2 // Example 4 . 2
3 // p a g e 104
4 // To draw t h e p e r u n i t r e a c t a n c e d i a g r a m when pu
v a l u e s a r e s p e c i f i e d b a s e d on e u i p m e n t r a t i n g
5 clear ; clc ;
6 mvab =30; kvb =11; //MVA b a s e and KVA b a s e a r e
s e l e c t e d in the c i r c u i t of generator 1
7
8 gen1_mva =30; gen1_kv =10.5; gen1_x =0.435; //
G e n e r a t o r No . 1 d e t a i l s
9 gen2_mva =15; gen2_kv =6.6; gen2_x =0.413; // G e n e r a t o r
No . 2 d e t a i l s
10 gen3_mva =25; gen3_kv =6.6; gen3_x =0.3214; //
G e n e r a t o r No . 3 d e t a i l s
11
12 t1_mva =15; t1_hv =33; t1_lv =11; t1_x =0.209; //
T r a n s f o r m e r T1 d e t a i l s
13 t2_mva =15; t2_hv =33; t2_lv =6.2; t2_x =0.220; //
T r a n s f o r m e r T1 d e t a i l s
14
15 tl_x =20.5; // T r a n s m i s s i o n l i n e r e c a t a n c e
16
17 // Loads a r e n e g l e c t e d a s s a i d i n t h e p r o b l e m
18
19 tl_pu =( tl_x * mvab ) / t1_hv ^2;
20 t1_pu = t1_x *( mvab / t1_mva ) ;
21 t2_pu = t2_x *( mvab / t2_mva ) ;
22 gen1_pu = gen1_x *( mvab / gen1_mva ) *( gen1_kv / kvb ) ^2;
23 gen2_kv_base = t2_lv ;
24 gen2_pu = gen2_x *( mvab / gen2_mva ) *( gen2_kv / gen2_kv_base
) ^2;
25 gen3_kv_base = t2_lv ;
29
26 gen3_pu = gen3_x *( mvab / gen3_mva ) *( gen3_kv / gen3_kv_base
) ^2;
27
28 // d i p l a y i n g t h e r e s u l t s on c o n s o l e
29
30 printf ( Per u n i t i m p e d a n c e o f t h e c o m p o n e n t s o f t h e
g i v e n power s y s t e m a r e a s f o l l o w s : \ n\n ) ;
31
32 printf ( T r a n s m i s s i o n l i n e : %0 . 3 f \n\n , tl_pu ) ;
33
34 printf ( T r a n s f o r m e r T1 : %0 . 3 f \n\n , t1_pu ) ;
35
36 printf ( T r a n s f o r m e r T2 : %0 . 3 f \n\n , t2_pu ) ;
37
38 printf ( G e n e r a t o r 1 : %0 . 3 f \n\n , gen1_pu ) ;
39
40 printf ( G e n e r a t o r 2 : %0 . 3 f \n\n , gen2_pu ) ;
41
42 printf ( G e n e r a t o r 3 : %0 . 3 f \n\n , gen3_pu ) ;
Scilab code Exa 4.3 Excitation EMF and Reactive Power Calculation
30
10 // s i n c e t h e g e n e r a t o r i s o p e r a t i n g a t f u l l l o a d &
0.9 pf
11 pf_angle = acos (0.9) ;
12 Ia =1*( cos ( pf_angle ) - %i * sin ( pf_angle ) ) ; // l o a d
current
13 // t o f i n d e x c i t a t i o n emf
14 ef = vl + %i * xs * Ia ;
15 delta = atand ( imag ( ef ) / real ( ef ) ) ; // p o s i t i v e f o r
leading
16 ef = abs ( ef ) * kvb ; // pu t o a c t u a l u n i t c o n v e r s i o n
17 if ( delta >0) then lead_lag = l e a d i n g ;
18 else lead_lag = l a g g i n g ;
19 end
20 printf ( E x c i t a t i o n emf= %0 . 2 f kV a t an a n g l e %0 . 3 f (
%s ) \n\n ,ef , delta , lead_lag ) ;
21 // t o f i n d r e a c t i v e power drawn by l o a d
22 Q = vl * abs ( imag ( Ia ) ) ;
23 Q = Q * mvab ; // pu t o a c t u a l u n i t c o n v e r s i o n
24 printf ( R e a c t i v e power drawn by l a o d= %d MVAR ,Q ) ;
Scilab code Exa 4.4 Power Factor And Load Angle Calculation
31
10 // s i n c e t h e g e n e r a t o r i s o p e r a t i n g a t f u l l l o a d &
0.9 pf
11 pf_angle = acos (0.9) ;
12 Ia =1*( cos ( pf_angle ) - %i * sin ( pf_angle ) ) ; // l o a d
current
13 // t o f i n d e x c i t a t i o n emf
14 ef = vt + %i * xs * Ia ;
15 ef = abs ( ef ) ;
16 P =1*0.9; // a t F u l l l o a d
17
18 // / / / / / w r i t i n g an i n l i n e f u n c t i o n / / / / / / / / / / / / / / / / /
19 function [ pf , lead_lag , Q ]= excitation_change (P , ef , vt ,
xs )
20 sin_delta =( P * xs ) /( ef * vt ) ;
21 delta = asind ( sin_delta ) ;
22 ef0 = ef *( cosd ( delta ) +( %i * sind ( delta ) ) ) ;
23 Ia =( ef0 - vt ) /( %i * xs ) ;
24 Ia_mag = abs ( Ia ) ; Ia_ang = atand ( imag ( Ia ) / real ( Ia ) ) ; //
Magnitude and a n g l e o f I a
25 pf = cosd ( abs ( Ia_ang ) ) ;
26 if ( Ia_ang >0) then lead_lag = l e a d i n g ;
27 elseif ( Ia_ang ==0) then lead_lag = u n i t y p f
28 else lead_lag = l a g g i n g ;
29 end
30 Q = vt * Ia_mag * sind ( abs ( Ia_ang ) ) ;
31 Q = abs ( Q ) * mvab ;
32 endfunction
33 //
//////////////////////////////////////////////////////
34
35
36 // F i r s t Case when Ef i s i n c r e a s e d by 20% a t same
r e a l l o a d now
37 ef1 = ef *1.2;
38 [ pf1 , lead_lag1 , Q1 ]= excitation_change (P , ef1 , vt , xs ) ;
39 disp ( Case ( i ) : When Ef i s i n c r e a s e d by 20% ) ;
40 printf ( \n\ tPower f a c t o r p f= %0 . 2 f %s \n ,pf1 ,
32
lead_lag1 ) ;
41 printf ( \ t R e a c t i v e power drawn by t h e l o a d = %0 . 1 f
MVAR \n , Q1 ) ;
42
43 // S e c o n d Case when Ef i s d e c r e a s e d by 20% a t same
r e a l l o a d now
44 ef2 = ef *0.8;
45 [ pf2 , lead_lag2 , Q2 ]= excitation_change (P , ef2 , vt , xs ) ;
46 disp ( Case ( i i ) : When Ef i s d e c r e a s e d by 20% ) ;
47 printf ( \n\ tPower f a c t o r p f= %0 . 2 f %s \n ,pf2 ,
lead_lag2 ) ;
48 printf ( \ t R e a c t i v e power drawn by t h e l o a d = %0 . 1 f
MVAR \n , Q2 ) ;
49
50 disp ( The a n s w e r s g i v e n h e r e a r e e x a c t v a l u e s .
Textbook a n s w e r s h a s an a p p r o x i m a t i o n o f u p t o 2
d e c i m a l p l a c e s on Xs , Ia , p f . ) ;
33
Chapter 5
Characteristics and
Performance of Power
Transmission Lines
1 // C h a p t e r 5
2 // Example 5 . 1
3 // p a g e 132
4 //To f i n d s e n d i n g end v o l t a g e and v o l t a g e r e g u l a t i o n
5 clc ; clear ;
6
7 load1 =5000; //kW
8 pf =0.707;
9 Vr =10000; // r e c e i v i n g end v o l t a g e
10 R =0.0195*20;
11 X =2* %pi *50*0.63*10^ -3*20;
12
13 // t o f i n d s e n d i n g end v o l t a g e and v o l t a g e r e g u l a t i o n
14 I = load1 *1000/( Vr * pf ) ;
15 Vs = Vr + I *( R * pf + X * sin ( acos ( pf ) ) ) ;
34
16 voltage_regulation =( Vs - Vr ) *100/ Vr ;
17 printf ( \n\ n R e c e i v i n g c u r r e n t =I=%d A\n ,I ) ;
18 printf ( S e n d i n g end v o l t a g e =Vs=%d V\n , Vs ) ;
19 printf ( V o l t a g e R e g u l a t i o n=%0 . 2 f %% ,
voltage_regulation ) ;
20
21 // t o f i n d t h e v a l u e o f t h e c a p a c i t o r t o be c o n n e c t e d
in p a r a l l e l to the load
22 voltage_regulation_desi = voltage_regulation /2;
23 Vs =( voltage_regulation_desi /100) * Vr + Vr ;
24 // by s o l v i n g t h e e q u a t i o n s ( i ) and ( i i )
25 pf =0.911;
26 Ir =549;
27 Ic =( Ir *( pf - %i * sin ( acos ( pf ) ) ) ) -(707*(0.707 - %i *0.707) )
;
28 Xc =( Vr / imag ( Ic ) ) ;
29 c =(2* %pi *50* Xc ) ^ -1;
30 printf ( \n\ n C a p a c i t a n c e t o be c o n n e c t e d a c r o s s t h e
l o a d s o a s t o r e d u c e v o l t a g e r e g u l a t i o n by h a l f
o f t h e a b o v e v o l t a g e r e g u l a t i o n i s g i v e n by : \ n C
= %d uF\n ,c *10^6) ;
31
32 // t o f i n d e f f i c i e n c y i n b o t h t h e c a s e s
33 // c a s e ( i )
34 losses = I * I * R *10^ -3;
35 n =( load1 /( load1 + losses ) ) *100;
36 printf ( \n E f f i c i e n c y i n : \ nCase ( i ) \ t n=%0 . 1 f%% ,n
);
37 // c a a s e ( i i )
38 losses = Ir * Ir * R *10^ -3;
39 n =( load1 /( load1 + losses ) ) *100;
40 printf ( \ nCase ( i i ) \ t n=%0 . 1 f%% ,n ) ;
35
Scilab code Exa 5.2 Voltage at the power station end
Voltage at the power station end
1 // C h a p t e r 5
2 // Example 5 . 2
3 // p a g e 134
4 //To f i n d v o l t a g e a t t h e bus a t t h e power s t a t i o n
end
5 clc ; clear ;
6
7 base_MVA =5;
8 base_kV =33;
9 pf =0.85;
10 cable_impedance =(8+ %i *2.5) ;
11 cable_impedance = cable_impedance * base_MVA /( base_kV ^2)
;
12
13 transf_imp_star =(0.06+ %i *0.36) /3; // e q u i v a l e n t s t a r
impedance o f winding o f the t r a n s f o r m e r
14 Zt =( transf_imp_star *5/(6.6^2) ) +((0.5+ %i *3.75)
*5/(33^2) ) ;
15 total = cable_impedance +2* Zt ;
16
17 load_MVA =1;
18 load_voltage =6/6.6;
19 load_current =1/ load_voltage ;
20
21 Vs = load_voltage + load_current *( real ( total ) * pf + imag (
total ) * sin ( acos ( pf ) ) ) ;
22 Vs = Vs *6.6;
23 printf ( \n\ n C a b l e i m p e d a n c e= (%0 . 3 f+j%0 . 4 f ) pu \n ,
real ( cable_impedance ) , imag ( cable_impedance ) ) ;
24 printf ( \ n E q u i v a l e n t s t a r i m p e d a n c e o f 6 . 6 kV w i n d i n g
o f t h e t r a n s f o r m e r =(%0 . 2 f+j%0 . 2 f ) pu \n , real (
transf_imp_star ) , imag ( transf_imp_star ) ) ;
25 printf ( \ nPer u n i t t r a n s f o r m e r impedance , Zt =(%0 . 4 f+
j%0 . 3 f ) pu \n , real ( Zt ) , imag ( Zt ) ) ;
36
26 printf ( \ n T o t a l s e r i e s i m p e d a n c e =(%0 . 3 f+j%0 . 3 f ) pu \n
, real ( total ) , imag ( total ) ) ;
27 printf ( \ n S e n d i n g end V o l t a g e =| Vs |=%0 . 2 fkV ( l i n e to
l i n e ) , Vs ) ;
1 // C h a p t e r 5
2 // Example 5 . 3
3 // p a g e 135
4 // p r o b l e m w i t h mixed end c o n d i t i o n
5 clc ; clear ;
6 Vr =3000; // r e c e i v i n g end v o l t a g e
7 pfs =0.8; // s e n d i n g end power f a c t o r
8 Ps =2000*10^3; // s e n d i n g end a c t i v e power
9 z =0.4+ %i *0.4; // s e r i e s i m p e d a n c e
10 Ss = Ps / pfs ; // s e n d i n g end VA
11 Qs = Ss * sqrt (1 - pfs ^2) ; // s e n d i n g end r e a c i v e power
12
13 // by s u b s t i t u t i n g a l l t h e v a l u e s t o t h e e q u a t i o n (
iii )
14 deff ( [ y ]= f x ( I ) , y=(Vr 2 ) ( I 2 ) +2Vr ( I 2 ) ( r e a l ( z )
( ( Psr e a l ( z ) ( I 2 ) ) / Vr )+imag ( z ) ( ( Qsimag ( z ) ( I
2 ) ) / Vr ) ) +( a b s ( z ) ) 2 ( I 4 ) ( S s 2 ) ) ;
15 I = fsolve (100 , fx ) ;
16
17 pfR =( Ps - real ( z ) *( I ^2) ) /( Vr * I ) ; // Cos ( p h i r )
18 Pr = Vr * I * pfR ;
19 Vs =( Ps /( I * pfs ) ) ;
20
21 printf ( \ nLoad C u r r e n t | I |= %0 . 2 f A ,I ) ;
37
22 printf ( \ nLoad Pr=%d W , Pr ) ;
23 printf ( \ n R e c e i v i n g end power f a c t o r =%0 . 2 f , pfR ) ;
24 printf ( \ n S u p p l y V o l t a g e=%0 . 2 fV , Vs ) ;
1 // C h a p t e r 5
2 // Example 5 . 4
3 // p a g e 138
4 // t o f i n d s e n d i n g end v o l t a g e and v o l t a g e r e g u l a t i o n
o f a medium t r a n s m i s s i o n l i n e s y s t e m
5 clear ; clc ;
6 D =300;
7 r =0.8;
8 L =0.461* log10 ( D /(0.7788* r ) ) ;
9 C =0.0242/( log10 ( D / r ) ) ;
10 R =0.11*250;
11 X =2* %pi *50* L *0.001*250;
12 Z = R + %i * X ;
13 Y = %i *2* %pi *50* C *0.000001*250;
14 Ir =((25*1000) /(132* sqrt (3) ) ) *( cosd ( -36.9) + %i * sind
( -36.9) ) ;
15 Vr =(132/ sqrt (3) ) ;
16 A =(1+( Y * Z /2) ) ;
17 Vs = A * Vr + Z * Ir *10^( -3) ;
18 printf ( \n\ nVs ( p e r p h a s e ) =(%0 . 2 f+%0 . 2 f ) kV , real ( Vs ) ,
imag ( Vs ) ) ;
19 Vs = abs ( Vs ) * sqrt (3) ;
20 printf ( \n\n | Vs | ( l i n e )=%d kV , Vs ) ;
21 Vr0 = Vs / abs ( A ) ;
22 printf ( \n\n | Vr0 | ( l i n e no l o a d )=%0 . 1 fkV , Vr0 ) ;
38
23 Vol_regu =( Vr0 -132) /132;
24 printf ( \n\ n V o l t a g e R e g u l a t i o n=%0 . 1 f%%\n\n , Vol_regu
*100) ;
Scilab code Exa 5.5 Maximum permissible length and and Frequency
1 // C h a p t e r 5
2 // Example 5 . 5
3 // p a g e 147
4 // t o f i n d maximum p e r m i s s i b l e l e n g t h and and
frequency
5 clc ; clear ;
6 R =0.125*400;
7 X =0.4*400;
8 Y =2.8*(10^ -6) *400* %i ;
9 Z = R + X * %i ;
10
11 // ( i ) At nol o a d
12 A =1+( Y * Z /2) ;
13 C = Y *(1+ Y * Z /6) ;
14 VR_line =220000/ abs ( A ) ;
15 Is = abs ( C ) * VR_line / sqrt (3) ;
16 printf ( \n\n |VR| l i n e = %d kV , VR_line /1000) ;
17 printf ( \n | I s | = %d A , Is ) ;
18
19 // ( i i ) t o f i n d maximum p e r m i s s i b l e l e n g t h
20 //By s o l v i n g t h e e q u a t i o n s shown i n t h e book , we g e t
21 l = sqrt ((1 -0.936) /(0.56*10^( -6) ) ) ;
22 printf ( \n\n Maximum p e r m i s s i b l e l e n g t h o f t h e l i n e
= %d km ,l ) ;
23
39
24 // ( i i i ) t o f i n d maximum p e r m i s s i b l e f r e q u e n c y f o r
the case ( i )
25 //By s o l v i n g t h e e q u a t i o n s shown i n t h e book , we g e t
26 f = sqrt (((1 -0.88) *50*50) /(0.5*1.12*10^ -3*160) ) ;
27 printf ( \n\n Maximum p e r m i s s i b l e f r e q u e n c y = %0 . 1 f
Hz\n\n ,f ) ;
1 // C h a p t e r 5
2 // Example 5 . 6
3 // p a g e 149
4 // t o f i n d i n c i d e n t and r e f l e c t e d v o l t a g e s
5 clear ; clc ;
6
7 R =0.125;
8 X =0.4;
9 y = %i *2.8*10^( -6) ;
10 z = R + %i * X ;
11
12 r = sqrt ( y * z ) ; // p r o p o g a t i o n c o n s t a n t
13 a = real ( r ) ; // a t t e n u a t i o n c o n s t a n t
14 b = imag ( r ) ; // p h a s e c o n s t a n t
15
16 // ( a ) At t h e r e c e i v i n g end ;
17 Vr =220000;
18 Inci_vol = Vr /( sqrt (3) *2) ;
19 Refl_vol = Vr /( sqrt (3) *2) ;
20 printf ( \n\ n I n c i d e n t V v o l t a g e=%0 . 2 f kV , Inci_vol
/1000) ;
40
21 printf ( \ n R e f l e c t e d V v o l t a g e=%0 . 2 f kV , Refl_vol
/1000) ;
22
23 // ( b ) At 200km from t h e r e c e i v i n g end
24 x =200;
25 Inci_vol = Inci_vol * exp ( a * x ) * exp ( %i * b * x ) ;
26 Refl_vol = Refl_vol * exp ( - a * x ) * exp ( - %i * b * x ) ;
27 printf ( \n\ n I n c i d e n t v o l t a g e=%0 . 2 f @ %0 . 1 f deg kV ,
abs ( Inci_vol ) /1000 , atand ( imag ( Inci_vol ) / real (
Inci_vol ) ) ) ;
28 printf ( \ n R e f l e c t e d v o l t a g e=%0 . 2 f @ %0 . 1 f deg kV ,
abs ( Refl_vol ) /1000 , atand ( imag ( Refl_vol ) / real (
Refl_vol ) ) ) ;
29
30 // ( c ) R e s u l t a n t v o l t a g e a t 200km from t h e r e c e i v i n g
end
31 res = Inci_vol + Refl_vol ;
32 printf ( \n\ n R e s u l t a n t l i n e to l i n e v o l t a g e a t 200km
=%0 . 2 f kV , abs ( res ) * sqrt (3) /1000) ;
1 // C h a p t e r 5
2 // Example 5 . 7
3 // p a g e 138
4 // t o t a b u l a t e c h a r a c t e r i s t i c s o f a s y s t e m u s i n g
d i f f e r e n t methods
5 clear ; clc ;
6
7 Z =40+125* %i ;
8 Y = %i *10^( -3) ;
41
9 Ir =((50*10^6) /(220000*0.8* sqrt (3) ) ) *( cosd ( -36.9) + %i *
sind ( -36.9) ) ;
10 Vr =220000/ sqrt (3) ;
11
12 // ( a ) S h o r t l i n e a p p r o x i m a t i o n
13 Vs = Vr + Ir * Z ;
14 Vs_line1 = Vs * sqrt (3) ;
15 Is1 = Ir ;
16 pfs1 = cos ( atan ( imag ( Vs ) / real ( Vs ) ) + acos (0.8) ) ;
17 Ps1 = sqrt (3) * abs ( Vs_line1 ) * abs ( Is1 ) * pfs1 ;
18
19 // ( b ) Nominal p i method
20 A =1+ Y * Z /2;
21 D=A;
22 B=Z;
23 C = Y *(1+ Y * Z /4) ;
24 Vs = A * Vr + B * Ir ;
25 Is2 = C * Vr + D * Ir ;
26 Vs_line2 = sqrt (3) * Vs ;
27 pfs2 = cos ( atan ( imag ( Is2 ) / real ( Is2 ) ) - atan ( imag ( Vs ) /
real ( Vs ) ) ) ;
28 Ps2 = sqrt (3) * abs ( Vs_line2 ) * abs ( Is2 ) * pfs2 ;
29
30 // ( c ) Exact t r a n s m i s s i o n l i n e e q u a t i o n s
31 rl = sqrt ( Z * Y ) ; // p r o p o g a t i o n c o n s t a n t
32 Zc = sqrt ( Z / Y ) ; // c h a r a c t e r i s t i c i m p e d a n c e
33 A = cosh ( rl ) ;
34 B = Zc * sinh ( rl ) ;
35 C = sinh ( rl ) / Zc ;
36 D = cosh ( rl ) ;
37 Vs = A * Vr + B * Ir ;
38 Is3 = C * Vr + D * Ir ;
39 Vs_line3 = sqrt (3) * Vs ;
40 pfs3 = cos ( atan ( imag ( Is3 ) / real ( Is3 ) ) - atan ( imag ( Vs ) /
real ( Vs ) ) ) ;
41 Ps3 = sqrt (3) * abs ( Vs_line3 ) * abs ( Is3 ) * pfs3 ;
42
43 // ( d ) A p p r o x i m a t i o n
42
44 A =(1+ Y * Z /2) ;
45 B = Z *(1+ Y * Z /6) ;
46 C = Y *(1+ Y * Z /6) ;
47 D=A;
48 Vs = A * Vr + B * Ir ;
49 Is4 = C * Vr + D * Ir ;
50 Vs_line4 = sqrt (3) * Vs ;
51 pfs4 = cos ( atan ( imag ( Is4 ) / real ( Is4 ) ) - atan ( imag ( Vs ) /
real ( Vs ) ) ) ;
52 Ps4 = sqrt (3) * abs ( Vs_line4 ) * abs ( Is4 ) * pfs4 ;
53
54 // c o n v e r t i n g a l l t h e v a l u e s t o t h e i r s t a n d a r d form
b e f o r e w r i t i n g i t to t a b l e
55
56 // v o l t a g e t o kV
57 Vs_line1 = abs ( Vs_line1 ) /1000;
58 Vs_line2 = abs ( Vs_line2 ) /1000;
59 Vs_line3 = abs ( Vs_line3 ) /1000;
60 Vs_line4 = abs ( Vs_line4 ) /1000;
61
62 // C u r r e n t t o kA
63 Is1 = Is1 /1000;
64 Is2 = Is2 /1000;
65 Is3 = Is3 /1000;
66 Is4 = Is4 /1000;
67
68 // power t o MW5
69 Ps1 = Ps1 /1000000;
70 Ps2 = Ps2 /1000000;
71 Ps3 = Ps3 /1000000;
72 Ps4 = Ps4 /1000000;
73
74 // p r e p a r i n f t a b l e
75 printf ( \n\
n
);
76 printf ( \n \t\ tShort l i n e \t\t Nominal
Pi \ t \ t Exact \ t \ t Approximation );
43
77 printf ( \
n
);
78 printf ( \n | Vs | l i n e \ t \ t%0 . 2 fkV \ t \ t %0 . 2 fkV \ t \
t %0 . 2 fkV \ t \ t %0 . 2 fkV , Vs_line1 , Vs_line2 ,
Vs_line3 , Vs_line4 ) ;
79 printf ( \ n I s \ t \ t%0 . 3 f@%0 . 1 f d e g kA \ t \ t%0 . 2 f@%0
. 1 f d e g kA\ t \ t%0 . 4 f@%0 . 1 f d e g kA\ t%0 . 2 f@%0 . 1 f d e g kA
, abs ( Is1 ) , tand ( imag ( Is1 ) / real ( Is1 ) ) , abs ( Is2 ) ,
tand ( imag ( Is2 ) / real ( Is2 ) ) , abs ( Is3 ) , tand ( imag ( Is3 )
/ real ( Is3 ) ) , abs ( Is4 ) , tand ( imag ( Is4 ) / real ( Is4 ) ) ) ;
80 printf ( \ n p f s \ t \ t%0 . 3 f l a g g i n g \ t \ t%0 . 3 f
l e a d i n g \ t \ t%0 . 3 f l e a d i n g \ t \ t%0 . 3 f l e a d i n g , pfs1
, pfs2 , pfs3 , pfs4 ) ;
81 printf ( \ nPs \ t \ t%0 . 2 f MW \ t \ t%0 . 2 f MW
\ t \ t%0 . 2 f MW \ t \ t%0 . 2 f MW ,Ps1 , Ps2 , Ps3 , Ps4 ) ;
82 printf ( \
n
\n\n\n ) ;
1 // C h a p t e r 5
2 // Example 5 . 8
3 // p a g e 162
4 // t o e s t i m a t e t h e t o r q u e a n g l e and s t a t i o n
powerfactor
5 clear ; clc ;
6 Sd1 =15+ %i *5;
7 Sd2 =25+ %i *15;
8 // c a s e ( a ) c a b l e i m p e d a n c e=j 0 . 0 5 pu
44
9 r =0;
10 x = %i *0.05;
11 PG1 =20;
12 PG2 =20;
13 Ps =5; Pr =5;
14 V1 =1;
15 V2 =1;
16 d1 = asind ( Ps * abs ( x ) /( V1 * V2 ) ) ; // d e l t a 1
17 V1 = V1 *( cosd ( d1 ) + %i * sind ( d1 ) ) ;
18 Qs =(( abs ( V1 ) ^2) / abs ( x ) ) -(( abs ( V1 ) * abs ( V2 ) ) * cosd ( d1 )
/( abs ( x ) ) ) ;
19 Qr =((( abs ( V1 ) * abs ( V2 ) ) * cosd ( d1 ) /( abs ( x ) ) ) -( abs ( V1 )
^2) / abs ( x ) ) ;
20 Ql = Qs - Qr ;
21 Ss = Ps + %i * Qs ;
22 Sr = Pr + %i * Qr ;
23 Sg1 = Sd1 + Ss ;
24 Sg2 = Sd2 - Sr ;
25 pf1 = cos ( atan ( imag ( Sg1 ) / real ( Sg1 ) ) ) ;
26 pf2 = cos ( atan ( imag ( Sg2 ) / real ( Sg2 ) ) ) ;
27 printf ( \n\ nCase ( a ) \ n T o t a l l o a d on s t a t i o n 1=%d+j%0 . 3
f pu , real ( Sg1 ) , imag ( Sg1 ) ) ;
28 printf ( \ nPower f a c t o r o f s t a t i o n 1=%0 . 3 f pu l a g g i n g
, pf1 ) ;
29 printf ( \n\ T o t a l l o a d on s t a t i o n 2=%d+j%0 . 3 f pu , real
( Sg2 ) , imag ( Sg2 ) ) ;
30 printf ( \ nPower f a c t o r o f s t a t i o n 2=%0 . 3 f pu l a g g i n g
, pf2 ) ;
31 // c a s e ( b ) c a b l e i m p e d a n c e =0.005+ j 0 . 0 5 ;
32 r =0.005;
33 PG1 =20;
34 V1 =1; V2 =1;
35 Ps =5;
36 // from t h e eq ( i ) i n t h e t e x t b o o k , we can c a l c u l a t e d1
37 z=r+x;
38 theta = atand ( imag ( z ) / real ( z ) ) ;
39 z = abs ( z ) ;
40 d1 = acosd ( z *( V1 ^2* cosd ( theta ) /z - Ps ) /( V1 * V2 ) ) - theta ;
45
41 Qs =( V1 ^2* sind ( theta ) / z ) -( V1 * V2 * sind ( theta + d1 ) / z ) ;
42 Qg1 =5+ Qs ;
43 Pr =( V1 * V2 * cosd ( theta - d1 ) / z ) -( V1 ^2* cosd ( theta ) / z ) ;
44 Pg2 =25 - Pr ;
45 Qr =( V1 * V2 * sind ( theta - d1 ) / z ) -( V1 ^2* sind ( theta ) / z ) ;
46 Qg2 =15 - Qr ;
47 Ss = Ps + %i * Qs ;
48 Sr = Pr + %i * Qr ;
49 Sg1 = Sd1 + Ss ;
50 Sg2 = Sd2 - Sr ;
51 pf1 = cos ( atan ( imag ( Sg1 ) / real ( Sg1 ) ) ) ;
52 pf2 = cos ( atan ( imag ( Sg2 ) / real ( Sg2 ) ) ) ;
53 printf ( \n\ nCase ( b ) \ n T o t a l l o a d on s t a t i o n 1=%d+j%0 . 3
f pu , real ( Sg1 ) , imag ( Sg1 ) ) ;
54 printf ( \ nPower f a c t o r o f s t a t i o n 1=%0 . 3 f pu l a g g i n g
, pf1 ) ;
55 printf ( \n\ T o t a l l o a d on s t a t i o n 2=%d+j%0 . 3 f pu , real
( Sg2 ) , imag ( Sg2 ) ) ;
56 printf ( \ nPower f a c t o r o f s t a t i o n 2=%0 . 3 f pu l a g g i n g \
n\n , pf2 ) ;
Scilab code Exa 5.9 Power Voltage and Compensating equipment rating
1 // C h a p t e r 5
2 // Example 5 . 9
3 // p a g e 165
4 // t o d e t e r m i n e power , v o l t a g e , c o m p e n s a t i n g e q u i p m e n t
rating
5 clear ; clc ;
6 A =0.85;
7 B =200;
46
8
9 // c a s e ( a )
10 Vs =275000;
11 Vr =275000;
12 a =5; b =75; // a l p h a and b e t a
13 Qr =0;
14 // from e q u a t i o n 5 . 6 2
15 d =b - asind (( B /( Vs * Vr ) ) *( Qr +( A * Vr ^2* sind (b - a ) / B ) ) ) ; //
delta
16 Pr =( Vs * Vr * cosd (b - d ) / B ) -( A * Vr ^2* cosd (b - a ) / B ) ;
17 printf ( \n\ n c a s e ( a ) \ nPower a t u n i t y p o w e r f a c t o r t h a t
can be r e c e i v e d =%0 . 1 f MW , Pr /10^6) ;
18
19 // c a s e ( b )
20 Pr =150*10^6;
21 d =b - acosd (( B /( Vs * Vr ) ) *( Pr +( A * Vr ^2* cosd (b - a ) / B ) ) ) ; //
delta
22 Qr =( Vs * Vr * sind (b - d ) / B ) -( A * Vr ^2* sind (b - a ) / B ) ;
23 Qc = - Qr ;
24 printf ( \n\ n c a s e ( b ) \ n R a t i n g o f t h e c o m p e n s a t i n g
e q u i p m e n t = %0 . 2 f MVAR , Qc /10^6) ;
25 printf ( \ n i . e t h e c o m p e n s a t i n g e q u i p m e n t must f e e d
p o s i t i v e VARs i n t o t h e l i n e ) ;
26
27
28 // c a s e ( c )
29 Pr =150*10^6;
30 Vs =275000;
31 // by s o l v i n g t h e two c o n d i t i o n s g i v e n a s ( i ) and ( i i
) , we g e t
32 Vr =244.9*10^3;
33 printf ( \n\ n c a s e ( c ) \ n R e c e i v i n g end v o l t a g e = %0 . 1 f
kV , Vr /1000) ;
47
Scilab code Exa 5.10 MVA rating of the shunt reactor
MVA rating of the shunt reactor
1 // C h a p t e r 5
2 // Example 5 . 1 0
3 // p a g e 170
4 //To d e t e r m i n e t h e MVA r a t i n g o f t h e s h u n t r e a c t o r
5 clear ; clc ;
6 v =275;
7 l =400;
8 R =0.035* l ;
9 X =2* %pi *50*1.1* l *10^ -3;
10 Z = R + %i * X ;
11 Y =2* %pi *50*0.012*10^ -6* l * %i ;
12 A =1+( Y * Z /2) ;
13 B=Z;
14 Vs =275;
15 Vr =275;
16 r =( Vs * Vr ) / abs ( B ) ;
17 Ce = abs ( A / B ) * Vr ^2;
18 printf ( R a d i u s o f t h e r e c e i v i n g end c i r c l e =%0 . 1 f MVA
\n\n ,r ) ;
19 printf ( L o c a t i o n o f t h e c e n t e r o f r e c e i v i n g end
c i r c l e = %0 . 1 f MVA\n\n , Ce ) ;
20 printf ( From t h e graph , 55 MVA s h u n t r e a c t o r i s
r e q u i r e d \n\n ) ;
21 theta =180+82.5;
22 x = -75:0.01:450;
23 a = Ce * cosd ( theta ) ; // t o draw t h e c i r c l e
24 b = Ce * sind ( theta ) ;
25 y = sqrt ( r ^2 -( x - a ) ^2) + b ;
26 x1 = a :0.001:0;
27 y1 = tand ( theta ) * x1 ;
28 plot (x ,y , x1 , y1 ) ;
29 title ( C i r c l e d i a g r a m f o r e x a m p l e 5 . 1 0 ) ;
30 xlabel ( MW ) ;
31 ylabel ( MVAR ) ;
48
Figure 5.1: MVA rating of the shunt reactor
32 plot (a ,b , m a r k e r s i z e ,150) ;
33 xgrid (2)
34 set ( gca () , g r i d ,[0 ,0])
35 get ( c u r r e n t a x e s ) ;
36 xstring ( -75 ,25 , 55 MVAR ) ;
37 xstring ( -75 , -25 , 8 3 . 5 deg ) ;
38 xstring ( -20 , -300 , 4 8 7 . 6 MVA ) ;
39 xstring (300 , -100 , 5 4 4 . 3 MVA ) ;
49
Scilab code Exa 5.11 SendingEnd voltage and maximum power delivered
1 // C h a p t e r 5
2 // Example 5 . 1 1
3 // p a g e 172
4 //To d e t e r m i n e s e n d i n g end v o l t a g e . maximum power
delivered
5 clear ; clc ;
6
7 A =0.93*( cosd (1.5) + %i * sind (1.5) ) ;
8 B =115*( cosd (77) + %i * sind (77) ) ;
9 Vr =275;
10 Ce = abs ( A / B ) * Vr ^2;
11 printf ( C e n t r e o f t h e r e c e i v i n g end c i r c l e i s = %0 . 1
f MVA\n\n , Ce ) ;
12 CrP =850; Vs = CrP * abs ( B ) / Vr ;
13 printf ( ( a ) From t h e diagram , \ n\ tCrP=%d \n \ t S e n d i n g
end v o l t a g e | Vs |= %0 . 1 f kV\n\n ,CrP , Vs ) ;
14 Vs =295; // g i v e n
15 r =( Vs * Vr ) / abs ( B ) ;
16 Pr_m =556; // from t h e d i a g r a m
17 printf ( ( b ) R a d i u s o f t h e c i r c l e d i a g r a m = %0 . 1 f MVA
\n\ t PR max=%d MW\n\n ,r , Pr_m ) ;
18 Ps =295; // from t h e d i a g r a m ;
19 printf ( ( c ) A d d i t i o n a l MVA t o be drawn from t h e l i n e
i s = P S=%d MVAR\n\n , Ps ) ;
50
Chapter 6
1 // C h a p t e r 6
2 // Example 6 . 1
3 // p a g e 195
4 //To Ybus u s i n g s i n g u l a r t r a n s f o r m a t i o n
5
6 clear ; clc ;
7 printf ( L e t u s s o l v e t h i s p r o b l e m by g i v i n g v a l u e s
given in the t a b l e 6.1 instead of keeping i t in
v a r i a b l e s );
8
9 y10 =1; y20 =1; y30 =1; y40 =1;
10 y34 =2 - %i *6; y23 =0.666 - %i *2;
11 y12 =2 - %i *6; y24 =1 - %i *3;
12 y13 =1 - %i *3;
13
14 Y =[ y10 0 0 0 0 0 0 0 0;
15 0 y20 0 0 0 0 0 0 0;
16 0 0 y30 0 0 0 0 0 0;
17 0 0 0 y40 0 0 0 0 0;
51
18 0 0 0 0 y34 0 0 0 0;
19 0 0 0 0 0 y23 0 0 0;
20 0 0 0 0 0 0 y12 0 0;
21 0 0 0 0 0 0 0 y24 0;
22 0 0 0 0 0 0 0 0 y13 ];
23 A =[1 0 0 0;
24 0 1 0 0;
25 0 0 1 0;
26 0 0 0 1;
27 0 0 1 -1;
28 0 -1 1 0;
29 1 -1 0 0;
30 0 -1 0 1;
31 -1 0 1 0];
32 printf ( \n\n Ybus m a t r i x u s i n g singular
t r a n s f o r m a t i o n f o r t h e s y s t e m o f f i g . 6 . 2 i s \n
Ybus= ) ;
33 Y =A * Y * A ;
34 disp ( Y ) ;
35 // f o r v e r i f i c a t i o n l e t u s c a l c u l a t e a s g i v e n i n t h e
t e x t book
36 printf ( \n\n For v e r i f i c a t i o n , c a l c u l a t i n g Ybus
s u b s t i t u t i n g a s g i v e n i n t h e t e x t book \n Ybus (
v e r i f i a c t i o n )= ) ;
37 Yveri =[( y10 + y12 + y13 ) - y12 - y13 0; - y12 ( y20 + y12 + y23 +
y24 ) - y23 - y24 ; - y13 - y23 ( y30 + y13 + y23 + y34 ) - y34 ;0
- y24 - y34 ( y40 + y24 + y34 ) ];
38 disp ( Yveri ) ;
52
1 // C h a p t e r 6
2 // Example 6 . 2
3 // p a g e 195
4 //To Ybus o f s a m p l e s y s t e m
5 clear ; clc ;
6
7 y10 =1; y20 =1; y30 =1; y40 =1;
8 y34 =2 - %i *6; y23 =0.666 - %i *2;
9 y12 =2 - %i *6; y24 =1 - %i *3;
10 y13 =1 - %i *3;
11
12 // t o form Ybus m a t r i x
13 Y11 = y13 ; Y12 =0; Y13 = - y13 ; Y14 =0;
14 Y21 =0; Y22 = y23 + y24 ; Y23 = - y23 ; Y24 = - y24 ;
15 Y31 = - y13 ; Y32 = - y23 ; Y33 = y13 + y23 + y34 ; Y34 = - y34 ;
16 Y41 =0; Y42 = - y24 ; Y43 = - y34 ; Y44 = y34 + y24 ;
17
18 // c a s e ( i ) l i n e shown d o t t e d i s n o t c o n n e c t e d
19 Ybus =[ Y11 Y12 Y13 Y14 ;
20 Y21 Y22 Y23 Y24 ;
21 Y31 Y32 Y33 Y34 ;
22 Y41 Y42 Y43 Y44 ];
23 printf ( ( i ) Assuming t h a t t h e l i n e shown i s n o t
c o n n e c t e d \n Ybus= ) ; disp ( Ybus ) ;
24 // c a s e ( i i ) l i n e shown d o t t e d i s c o n n e c t e d
25 Y12 = Y12 - y12 ; Y21 = Y12 ;
26 Y11 = Y11 + y12 ;
27 Y22 = Y22 + y12 ;
28
29 Ybus =[ Y11 Y12 Y13 Y14 ;
30 Y21 Y22 Y23 Y24 ;
31 Y31 Y32 Y33 Y34 ;
32 Y41 Y42 Y43 Y44 ];
33 printf ( \n\n ( i i ) Assuming t h a t t h e l i n e shown i s
c o n n e c t e d \n Ybus= ) ; disp ( Ybus ) ;
53
Scilab code Exa 6.3 Approximate load flow solution
1 // C h a p t e r 6
2 // Example 6 . 3
3 // p a g e 201
4 //To f i n d an a p p r o x i m a t e l o a d f l o w s o l u t i o n
5 clear ; clc ;
6
7 //
//////////////////////////////////////////////////////////////////
54
20 6.667* %i 10* %i -16.667* %i 0;
21 10* %i 6.667* %i 0 -16.667* %i ];
22 printf ( Ybus m a t r i x o f t h e s y s t e m i s g i v e n by \ nYbus
= ) ; disp ( Ybus ) ;
23 // a s g i v e n i n t h e t e x t book u s i n g a p p r o x i m a t e l o a d
f l o w e q u a t i o n s and s i m p l i f y i n g ( i i ) , ( i i i ) , ( i v )
24 // d e l t a m a t r i x ( x ) i s o f t h e from A x=B
25 A =[ -5 21.667 -10 -6.667;
26 -6.667 -10 16.667 0;
27 -10 -6.667 0 16.667
28 1 0 0 0];
29
30 B =[3; -2; -2;0];
31
32 delta = inv ( A ) * B ; // s o l v i n g f o r d e l t a
33 printf ( \ n D e l t a o f t h e s y s t e m i s g i v e n by \ n d e l t a (
r a d )= ) ; disp ( delta ) ;
34
35 Q1 = -5* cos ( delta (2 ,1) ) -6.667* cos ( delta (3 ,1) ) -10* cos (
delta (4 ,1) ) +21.667;
36 Q2 = -5* cos ( delta (2 ,1) ) -10* cos ( delta (3 ,1) - delta (2 ,1) )
-6.667* cos ( delta (4 ,1) - delta (2 ,1) ) +21.667;
37 Q3 = -6.667* cos ( delta (3 ,1) ) -10* cos ( delta (3 ,1) - delta
(2 ,1) ) +16.667;
38 Q4 = -10* cos ( delta (4 ,1) ) -6.667* cos ( delta (4 ,1) - delta
(2 ,1) ) +16.667;
39
40 Q =[ Q1 ; Q2 ; Q3 ; Q4 ];
41 printf ( \ n I n j e c t e d r e a c t i v e power a t t h e b u s e s i s
g i v e n by \ nQi ( i n pu )= ) ; disp ( Q ) ;
42
43 Qg1 = Q1 + Qd1 ;
44 Qg2 = Q2 + Qd2 ;
45 Qg3 = Q3 + Qd3 ;
46 Qg4 = Q4 + Qd4 ;
47
48 Qg =[ Qg1 ; Qg2 ; Qg3 ; Qg4 ];
49 printf ( \n R e a c t i v e power g e n e r a t i o n a t t h e f o u r
55
b u s e s a r e \ nQgi ( i n pu )= ) ; disp ( Qg ) ;
50 Qd =[ Qd1 ; Qd2 ; Qd3 ; Qd4 ];
51 Ql = sum ( Qg ) - sum ( Qd ) ;
52 printf ( \ n R e a c t i v e power l o s s e s a r e QL=%0 . 5 f pu , Ql )
;
53
54 printf ( \n\ n L i n e Flows a r e g i v e n a s : \ n ) ;
55 P13 =( abs ( Ybus (1 ,3) ) ) * sin ( delta (1 ,1) - delta (3 ,1) ) ; P31
= - P13 ; printf ( \ nP13=P31=%0 . 3 f pu , P13 ) ;
56 P12 =( abs ( Ybus (1 ,2) ) ) * sin ( delta (1 ,1) - delta (2 ,1) ) ; P21
= - P12 ; printf ( \ nP12=P21=%0 . 3 f pu , P12 ) ;
57 P14 =( abs ( Ybus (1 ,4) ) ) * sin ( delta (1 ,1) - delta (4 ,1) ) ; P41
= - P14 ; printf ( \ nP14=P41=%0 . 3 f pu , P14 ) ;
58
59 Q13 = abs ( Ybus (1 ,3) ) -( abs ( Ybus (1 ,3) ) ) * cos ( delta (1 ,1) -
delta (3 ,1) ) ; Q31 = - Q13 ; printf ( \n\nQ13=Q31=%0 . 3 f
pu , Q13 ) ;
60 Q12 = abs ( Ybus (1 ,2) ) -( abs ( Ybus (1 ,2) ) ) * cos ( delta (1 ,1) -
delta (2 ,1) ) ; Q21 = - Q12 ; printf ( \nQ12=Q21=%0 . 3 f pu
, Q12 ) ;
61 Q14 = abs ( Ybus (1 ,4) ) -( abs ( Ybus (1 ,4) ) ) * cos ( delta (1 ,1) -
delta (4 ,1) ) ; Q41 = - Q14 ; printf ( \nQ14=Q41=%0 . 3 f pu
, Q14 ) ;
1 // C h a p t e r 6
2 // Example 6 . 4
3 // p a g e 209
4 //To f i n d bus v o l t a g e s u s i n g GS i t e r a t i o n s
5 clear ; clc ;
56
6
7 // Ybus m a t r i x from t h e n e t w o r k
8 Ybus =[3 -9* %i -2+6* %i -1+3* %i 0;
9 -2+6* %i 3.666 -11* %i -0.666+2* %i -1+3* %i
10 -1+3* %i -0.666+2* %i 3.666 -11* %i -2+6* %i
11 0 -1+3* %i -2+6* %i 3 -9* %i ]
12
13 //
////////////////////////////////////////////////////
14 // Pi Qi Vi Remarks Bus no
//
15 P1 =0; Q1 =0; V1 =1.04; // S l a c k bus 1
16 P2 =0.5; Q2 = -0.2; V2 =1; // PQbus 2
17 P3 = -1.0; Q3 =0.5; V3 =1; // PQbus 3
18 P4 =0.3; Q4 = -0.1; V4 =1; // PQbus 4
19 //
///////////////////////////////////////////////////
20
21 n =1;
22 for i =1: n
23 V2 =(1/ Ybus (2 ,2) ) *((( P2 - %i * Q2 ) / conj ( V2 ) ) - Ybus
(2 ,1) * V1 - Ybus (2 ,3) * V3 - Ybus (2 ,4) * V4 ) ;
24 V3 =(1/ Ybus (3 ,3) ) *((( P3 - %i * Q3 ) / conj ( V3 ) ) - Ybus
(3 ,1) * V1 - Ybus (3 ,2) * V2 - Ybus (3 ,4) * V4 ) ;
25 V4 =(1/ Ybus (4 ,4) ) *((( P4 - %i * Q4 ) / conj ( V4 ) ) - Ybus
(4 ,1) * V1 - Ybus (4 ,2) * V2 - Ybus (4 ,3) * V3 ) ;
26 end
27
28 printf ( \ nAt t h e end o f i t e r a t i o n %d t h e v o l t a g e s a t
t h e b u s e s a r e : \ n\nV1= ,n ) ; disp ( V1 ) ; printf ( pu ) ;
29 printf ( \n\n\nV2= ) ; disp ( V2 ) ; printf ( pu ) ;
30 printf ( \n\n\nV3= ) ; disp ( V3 ) ; printf ( pu ) ;
31 printf ( \n\n\nV4= ) ; disp ( V4 ) ; printf ( pu ) ;
57
Scilab code Exa 6.5 Reactive power injected using GS iterations
Reactive power injected using GS iterations
1 // C h a p t e r 6
2 // Example 6 . 5
3 // p a g e 210
4 //To f i n d bus v o l t a g e s and R e a c t i v e power i n j e c t e d
u s i n g GS i t e r a t i o n s
5 clear ; clc ;
6
7 // Ybus m a t r i x from t h e n e t w o r k
8 Ybus =[3 -9* %i -2+6* %i -1+3* %i 0;
9 -2+6* %i 3.666 -11* %i -0.666+2* %i -1+3* %i
10 -1+3* %i -0.666+2* %i 3.666 -11* %i -2+6* %i
11 0 -1+3* %i -2+6* %i 3 -9* %i ]
12
13 // Case ( i )
14
15 //
////////////////////////////////////////////////////
16 // Pi Qi Vi Remarks Bus no
//
17 P1 =0; Q1 =0; V1 =1.04; // S l a c k bus 1
18 P2 =0.5; Q2 =0.2; V2 =1.04; // PVbus 2
19 P3 = -1.0; Q3 =0.5; V3 =1; // PQbus 3
20 P4 =0.3; Q4 = -0.1; V4 =1; // PQbus 4
21 //
///////////////////////////////////////////////////
58
23 Q2min =0.2; Q2max =1;
24 n =1;
25
26 for i =1: n
27 if Q2 < Q2min then
28 Q2 = Q2min ;
29 V2 =(1/ Ybus (2 ,2) ) *((( P2 - %i * Q2 ) / conj ( V2 ) ) - Ybus
(2 ,1) * V1 - Ybus (2 ,3) * V3 - Ybus (2 ,4) * V4 ) ;
30 elseif Q2 > Q2max then
31 Q2 = Q2max ;
32 V2 =(1/ Ybus (2 ,2) ) *((( P2 - %i * Q2 ) / conj ( V2 ) ) -
Ybus (2 ,1) * V1 - Ybus (2 ,3) * V3 - Ybus (2 ,4) * V4 ) ;
33 else
34 Q2 = - imag ( conj ( V2 ) * Ybus (2 ,1) * V1 + conj ( V2 ) *(
Ybus (2 ,2) * V2 + Ybus (2 ,3) * V3 + Ybus (2 ,4) * V4 )
);
35 [ mag , delta2 ]= polar ((1/ Ybus (2 ,2) ) *((( P2 - %i *
Q2 ) /( conj ( V2 ) ) ) - Ybus (2 ,1) * V1 - Ybus (2 ,3) *
V3 - Ybus (2 ,4) * V4 ) ) ;
36 V2 = abs ( V2 ) *( cos ( delta2 ) + %i * sin ( delta2 ) ) ;
37 end
38 V3 =(1/ Ybus (3 ,3) ) *((( P3 - %i * Q3 ) / conj ( V3 ) ) - Ybus
(3 ,1) * V1 - Ybus (3 ,2) * V2 - Ybus (3 ,4) * V4 ) ;
39 V4 =(1/ Ybus (4 ,4) ) *((( P4 - %i * Q4 ) / conj ( V4 ) ) - Ybus
(4 ,1) * V1 - Ybus (4 ,2) * V2 - Ybus (4 ,3) * V3 ) ;
40 end
41
42 printf ( Q2= ) ; disp ( Q2 ) ; printf ( pu ) ;
43 printf ( \n\n\ n d e l t a 2= ) ; disp ( abs ( delta2 ) ) ; printf (
rad );
44 printf ( \n\n\nV1= ) ; disp ( V1 ) ; printf ( pu ) ;
45 printf ( \n\n\nV2= ) ; disp ( V2 ) ; printf ( pu ) ;
46 printf ( \n\n\nV3= ) ; disp ( V3 ) ; printf ( pu ) ;
47 printf ( \n\n\nV4= ) ; disp ( V4 ) ; printf ( pu ) ;
48
49
50 // c a s e ( i i )
51
59
52 printf ( \n\n\ nCase ( i i ) When 0.25 <Q2<1 pu and r u n n i n g
f o r 1 i t e r a t i o n , we g e t \n\n ) ;
53
54 //
////////////////////////////////////////////////////
55 // Pi Qi Vi Remarks Bus no
//
56 P1 =0; Q1 =0; V1 =1.04; // S l a c k bus 1
57 P2 =0.5; V2 =1.04; // PVbus 2
58 P3 = -1.0; Q3 =0.5; V3 =1; // PQbus 3
59 P4 =0.3; Q4 = -0.1; V4 =1; // PQbus 4
60 //
///////////////////////////////////////////////////
61
62 Q2min =0.25; Q2max =1;
63 n =1;
64
65 for i =1: n
66 if Q2 < Q2min then
67 Q2 = Q2min ;
68 V2 =(1/ Ybus (2 ,2) ) *((( P2 - %i * Q2 ) / conj ( V2 ) ) - Ybus
(2 ,1) * V1 - Ybus (2 ,3) * V3 - Ybus (2 ,4) * V4 ) ;
69 elseif Q2 > Q2max then
70 Q2 = Q2max ;
71 V2 =(1/ Ybus (2 ,2) ) *((( P2 - %i * Q2 ) / conj ( V2 ) ) -
Ybus (2 ,1) * V1 - Ybus (2 ,3) * V3 - Ybus (2 ,4) * V4 ) ;
72 else
73 Q2 = - imag ( conj ( V2 ) * Ybus (2 ,1) * V1 + conj ( V2 ) *(
Ybus (2 ,2) * V2 + Ybus (2 ,3) * V3 + Ybus (2 ,4) * V4 )
);
74 [ mag , delta2 ]= polar ((1/ Ybus (2 ,2) ) *((( P2 - %i *
Q2 ) /( conj ( V2 ) ) ) - Ybus (2 ,1) * V1 - Ybus (2 ,3) *
V3 - Ybus (2 ,4) * V4 ) ) ;
75 V2 = abs ( V2 ) *( cos ( delta2 ) + %i * sin ( delta2 ) ) ;
76 end
77 V3 =(1/ Ybus (3 ,3) ) *((( P3 - %i * Q3 ) / conj ( V3 ) ) - Ybus
60
(3 ,1) * V1 - Ybus (3 ,2) * V2 - Ybus (3 ,4) * V4 ) ;
78 V4 =(1/ Ybus (4 ,4) ) *((( P4 - %i * Q4 ) / conj ( V4 ) ) - Ybus
(4 ,1) * V1 - Ybus (4 ,2) * V2 - Ybus (4 ,3) * V3 ) ;
79 end
80
81 printf ( Q2= ) ; disp ( Q2 ) ; printf ( pu ) ;
82 printf ( \n\n\nV1= ) ; disp ( V1 ) ; printf ( pu ) ;
83 printf ( \n\n\nV2= ) ; disp ( V2 ) ; printf ( pu ) ;
84 printf ( \n\n\nV3= ) ; disp ( V3 ) ; printf ( pu ) ;
85 printf ( \n\n\nV4= ) ; disp ( V4 ) ; printf ( pu ) ;
Scilab code Exa 6.6 Load flow solution using the NR method
1 // C h a p t e r 6
2 // Example 6 . 6
3 // p a g e 218
4 //To f i n d l o a d f l o w s o l u t i o n u s i n g t h e NR method
5 clear ; clc ;
6
7 //
//////////////////////////////////////////////////////////////////
8 //Pd Qd Pg Qg V
Bus Type / / / / /
9 //
//////////////////////////////////////////////////////////////////
61
12 Pd3 =1.5; Qd3 =0.6; Pg3 =0.0; Qg3 =0; V3 =1.04;
// 3 PV bus
13 //
//////////////////////////////////////////////////////////////////
62
39 Q2 = - V2_mag * V1_mag * y_bus_mag_21 * sin ( y_bus_ang_21 +
V1_ang - V2_ang ) -( V2_mag ^2) * y_bus_mag_22 * sin (
y_bus_ang_22 ) - V2_mag * V3_mag * y_bus_mag_23 * sin (
y_bus_ang_23 + V3_ang - V2_ang ) ;
40
41 P2 = real ( P2 ) ;
42 P3 = real ( P3 ) ;
43 Q2 = real ( Q2 ) ;
44
45 delta_P2 =( Pg2 - Pd2 ) -( P2 ) ;
46 delta_P3 =( Pg3 - Pd3 ) -( P3 ) ;
47 delta_P2 =( Pg2 - Pd2 ) -( P2 ) ;
48 delta_Q2 =( Qg2 - Qd2 ) -( Q2 ) ;
49
50 // f o r m i n g j a c o b i a n m a t r i x by d i f f e r e n t i a t i n g
e x p r e s s i o n s o f P2 , P3 , Q2
51 j11 = V2_mag * V1_mag * y_bus_mag_21 * sin ( y_bus_ang_21 +
V1_ang - V2_ang ) + V2_mag * V3_mag * y_bus_mag_23 * sin (
y_bus_ang_23 + V3_ang - V2_ang ) ;
52 j12 = - V2_mag * V3_mag * y_bus_mag_23 * sin ( y_bus_ang_23 +
V3_ang - V2_ang ) ;
53 j13 = V1_mag * y_bus_mag_21 * cos ( y_bus_ang_21 + V1_ang -
V2_ang ) +( V2_mag *2) * y_bus_mag_22 * cos ( y_bus_ang_22 )
+ V3_mag * y_bus_mag_23 * cos ( y_bus_ang_23 + V3_ang -
V2_ang ) ;
54
55 j21 = - V2_mag * V3_mag * y_bus_mag_32 * sin ( y_bus_ang_32 +
V2_ang - V3_ang ) ;
56 j22 = V3_mag * V1_mag * y_bus_mag_31 * sin ( y_bus_ang_31 +
V1_ang - V3_ang ) + V2_mag * V3_mag * y_bus_mag_32 * sin (
y_bus_ang_32 + V2_ang - V3_ang ) ;
57 j23 = V3_mag * y_bus_mag_32 * cos ( y_bus_ang_32 + V2_ang -
V3_ang ) ;
58
59 j31 = V2_mag * V1_mag * y_bus_mag_21 * cos ( y_bus_ang_21 +
V1_ang - V2_ang ) + V2_mag * V3_mag * y_bus_mag_23 * cos (
y_bus_ang_23 + V3_ang - V2_ang ) ;
60 j32 = - V2_mag * V3_mag * y_bus_mag_23 * cos ( y_bus_ang_23 +
63
V3_ang - V2_ang ) ;
61 j33 = - V1_mag * y_bus_mag_21 * sin ( y_bus_ang_21 + V1_ang -
V2_ang ) -( V2_mag *2) * y_bus_mag_22 * sin ( y_bus_ang_22 )
- V3_mag * y_bus_mag_23 * sin ( y_bus_ang_23 + V3_ang -
V2_ang ) ;
62
63 J =[ j11 j12 j13 ; j21 j22 j23 ; j31 j32 j33 ];
64 J = real ( J ) ;
65
66 // power r e s i d u a l s
67 PR =[ delta_P2 ; delta_P3 ; delta_Q2 ];
68
69 // c h a n g e s i n v a r i a b l e s
70 ch_var = inv ( J ) * PR ;
71
72 V2_ang = V2_ang + ch_var (1 ,1) ;
73 V3_ang = V3_ang + ch_var (2 ,1) ;
74 V2_mag = V2_mag + ch_var (3 ,1) ;
75
76 P1 =( V1_mag ^2) * y_bus_mag_11 * cos ( y_bus_ang_11 ) + V1_mag *
V2_mag * y_bus_mag_21 * cos ( y_bus_ang_21 + V2_ang -
V1_ang ) + V1_mag * V3_mag * y_bus_mag_31 * cos (
y_bus_ang_31 + V3_ang - V1_ang ) ;
77 Q1 = - V1_mag ^2* y_bus_mag_11 * sin ( y_bus_ang_11 ) - V1_mag *
V2_mag * y_bus_mag_21 * sin ( y_bus_ang_21 + V2_ang -
V1_ang ) - V1_mag * V3_mag * y_bus_mag_31 * sin (
y_bus_ang_31 + V3_ang - V1_ang ) ;
78
79 Q3 = - V3_mag * V1_mag * y_bus_mag_31 * sin ( y_bus_ang_31 +
V1_ang - V3_ang ) -( V3_mag ^2) * y_bus_mag_33 * sin (
y_bus_ang_33 ) - V2_mag * V3_mag * y_bus_mag_32 * sin (
y_bus_ang_32 + V2_ang - V3_ang ) ;
80 Qg3 = Q3 + Qd3 ;
81
82 end
83
84 S1 = real ( P1 ) + %i * real ( Q1 ) ;
85 S2 = P2 + %i * Q2 ;
64
86 S3 = P3 + %i * Q3 ;
87
88 printf ( \ nThe f i n a l r e s u l t s a r e g i v e n b e l o w : \ n ) ;
89 printf ( V2=%0 . 3 f @ %0 . 3 f r a d \n , V2_mag , V2_ang ) ;
90 printf ( V3=%0 . 3 f @ %0 . 3 f r a d \n , V3_mag , V3_ang ) ;
91 printf ( Qg3=%0 . 2 f pu ( w i t h i n l i m i t s ) \n , Qg3 ) ;
92 printf ( \ nS1= ) ; disp ( S1 ) ; printf ( pu ) ;
93 printf ( \n\ nS2= ) ; disp ( S2 ) ; printf ( pu ) ;
94 printf ( \n\ nS3= ) ; disp ( S3 ) ; printf ( pu ) ;
95 printf ( \n\ n T r a n s m i s s i o n l o s s e s =%0 . 3 f pu \n ,( real ( P1
) + P2 + P3 ) ) ;
96
97 // L i n e Flows
98
99 // V mag =[ V1 mag V2 mag V3 mag ] ;
100 // V ang =[ V1 ang V2 ang V3 ang ] ;
101 v1 = V1_mag *( cos ( V1_ang ) + %i * sin ( V1_ang ) ) ;
102 v2 = V2_mag *( cos ( V2_ang ) + %i * sin ( V2_ang ) ) ;
103 v3 = V3_mag *( cos ( V3_ang ) + %i * sin ( V3_ang ) ) ;
104 V =[ v1 v2 v3 ];
105 for i =1:3
106 for j =1:3
107 s (i , j ) = conj ( V ( i ) ) *( V ( i ) -V ( j ) ) *(2.941 - %i
*11.764) + conj ( V ( i ) ) * V ( i ) *( %i *0.01) ;
108 s (j , i ) = conj ( V ( j ) ) *( V ( j ) -V ( i ) ) *(2.941 - %i
*11.764) + conj ( V ( j ) ) * V ( j ) *( %i *0.01) ;
109 end
110 end
111 P = real ( s ) ;
112 Q = - imag ( s ) ;
113 printf ( \ n L i n e Flows \ nThe f o l l o w i n g m a t r i x shows t h e
r e a l p a r t o f l i n e f l o w s ( i n pu ) ) ; disp ( P ) ;
114 printf ( \ nThe f o l l o w i n g m a t r i x shows t h e i m a g i n a r y
p a r t o f l i n e f l o w s ( i n pu ) ) ; disp ( Q ) ;
65
Scilab code Exa 6.7 Ybus after including regulating transformer
1 // C h a p t e r 6
2 // Example 6 . 7
3 // p a g e 234
4 //To f i n d m o d i f i e d Ybus a f t e r i n c l u d i n g r e g u l a t i n g
transformer
5 clear ; clc ;
6
7 y34 =2 - %i *6; y23 =0.666 - %i *2;
8 y12 =2 - %i *6; y24 =1 - %i *3;
9 y13 =1 - %i *3;
10
11 // c a s e ( i ) when a = 1 / 1 . 0 4 ;
12 a =1/1.04;
13 // t o form Ybus m a t r i x
14 Y11 = y13 + y12 ; Y12 = - y12 ; Y13 = - y13 ; Y14 =0;
15 Y21 = - y12 ; Y22 = y12 + y23 + y24 ; Y23 = - y23 ; Y24 = - y24 ;
16 Y31 = - y13 ; Y32 = - y23 ; Y33 =( a ^2) * y34 + y23 + y13 ; Y34 = -(a ) *
y34 ;
17 Y41 =0; Y42 = - y24 ; Y43 = -a * y34 ; Y44 = y34 + y24 ;
18
19
20 Ybus =[ Y11 Y12 Y13 Y14 ;
21 Y21 Y22 Y23 Y24 ;
22 Y31 Y32 Y33 Y34 ;
23 Y41 Y42 Y43 Y44 ];
24 printf ( Case ( i ) When a = 1 / 1 . 0 4 ) ;
25 printf ( \ nYbus= ) ; disp ( Ybus ) ;
66
26 printf ( \ n O b s e r v e t h e c h a n g e s i n e l e m e n t s b e t w e e n
bus 3&4 when compared w i t h t h e r e s u l t o f
example 6 . 2 );
27
28 // c a s e ( i i ) when a=e ( j 3 )
29
30 a = cosd (3) - %i * sind (3) ;
31 // t o form Ybus m a t r i x
32 Y11 = y13 + y12 ; Y12 = - y12 ; Y13 = - y13 ; Y14 =0;
33 Y21 = - y12 ; Y22 = y12 + y23 + y24 ; Y23 = - y23 ; Y24 = - y24 ;
34 Y31 = - y13 ; Y32 = - y23 ; Y33 =( abs ( a ) ^2) * y34 + y23 + y13 ; Y34 =( a
) *( - y34 ) ;
35 Y41 =0; Y42 = - y24 ; Y43 = a *( - y34 ) ; Y44 = y34 + y24 ;
36
37
38 Ybus =[ Y11 Y12 Y13 Y14 ;
39 Y21 Y22 Y23 Y24 ;
40 Y31 Y32 Y33 Y34 ;
41 Y41 Y42 Y43 Y44 ];
42 printf ( \n\ nCase ( i i ) When a=e ( j 3 ) ) ;
43 printf ( \ nYbus= ) ; disp ( Ybus ) ;
44 printf ( \ n O b s e r v e t h e c h a n g e s i n e l e m e n t s b e t w e e n
bus 3&4 when compared w i t h t h e r e s u l t o f
example 6 . 2 );
1 // C h a p t e r 6
2 // Example 6 . 8
3 // p a g e 226
67
4 //To f i n d l o a d f l o w s o l u t i o n u s i n g t h e d e c o u p l e d NR
method and FDLF method
5 clear ; clc ;
6
7 //
//////////////////////////////////////////////////////////////////
8 //Pd Qd Pg Qg V
Bus Type / / / / /
9 //
//////////////////////////////////////////////////////////////////
68
30 // c a s e ( a ) D e c o u p l e d NR method :
31 printf ( \ n c a s e ( a ) D e c o u p l e d NR method : \ n ) ;
32
33 H22 =0.96+23.508;
34 H23 = -1.04*11.764;
35 H33 =25.89;
36 L22 =1+23.508;
37 H =[ H22 H23 ; H23 H33 ];
38 delta_P =[0.73; -1.62];
39
40 delta_V_ang = inv ( H ) * delta_P ;
41 delta_V2_ang = delta_V_ang (1 ,1) ;
42 delta_V3_ang = delta_V_ang (2 ,1) ;
43 printf ( \ n d e l t a A n g l e V 2= ) ; disp ( real ( delta_V2_ang ) )
;
44 printf ( \ n d e l t a A n g l e V 3= ) ; disp ( real ( delta_V3_ang ) )
;
45 V2_ang = V2_ang - delta_V2_ang ;
46 V3_ang = V3_ang - delta_V3_ang ;
47
48 Q2 = - V2_mag * V1_mag * y_bus_mag_21 * sin ( y_bus_ang_21 +
V1_ang - V2_ang ) -( V2_mag ^2) * y_bus_mag_22 * sin (
y_bus_ang_22 ) - V2_mag * V3_mag * y_bus_mag_23 * sin (
y_bus_ang_23 - V3_ang + V2_ang ) ;
49
50 printf ( \nQ2= ) ; disp ( real ( Q2 ) ) ;
51 delta_Q2 =( Qg2 - Qd2 ) -( Q2 ) ;
52 printf ( \ n d e l t a Q 2= ) ; disp ( real ( delta_Q2 ) ) ;
53 L =[ L22 ];
54 delta_v = inv ( L ) * delta_Q2 ;
55 delta_V2 = delta_v * V2_mag ;
56
57 printf ( \ n d e l t a V 2=%0 . 3 f , delta_V2 ) ;
58 V2_mag = V2_mag + delta_V2 ;
59 printf ( \n\nV2=%0 . 3 f pu , V2_mag ) ;
60
61 Q3 = - V3_mag * V1_mag * y_bus_mag_31 * sin ( y_bus_ang_31 +
V1_ang - V3_ang ) -( V3_mag ^2) * y_bus_mag_33 * sin (
69
y_bus_ang_33 ) - V2_mag * V3_mag * y_bus_mag_32 * sin (
y_bus_ang_32 + V2_ang - V3_ang ) ;
62
63 printf ( \n\nQ3= ) ; disp ( real ( Q3 ) ) ;
64
65 // c a s e ( b ) FDLF method :
66
67 printf ( \n\n\ n c a s e ( b ) FDLF method : \ n ) ;
68
69 //
//////////////////////////////////////////////////////////////////
70 //Pd Qd Pg Qg V
Bus Type / / / / /
71 //
//////////////////////////////////////////////////////////////////
70
87 [ y_bus_mag_31 , y_bus_ang_31 ]= polar ( Ybus (3 ,1) ) ;
88 [ y_bus_mag_32 , y_bus_ang_32 ]= polar ( Ybus (3 ,2) ) ;
89 [ y_bus_mag_33 , y_bus_ang_33 ]= polar ( Ybus (3 ,3) ) ;
90 [ y_bus_mag_11 , y_bus_ang_11 ]= polar ( Ybus (1 ,1) ) ;
91
92 B22 = -23.508;
93 B23 =11.764;
94 B32 = B23 ;
95 B33 = B22 ;
96
97 B =[ - B22 - B23 ; - B32 - B33 ];
98
99 delta_P =[0.73; -1.557];
100
101 delta_V_ang = inv ( B ) * delta_P ;
102 delta_V2_ang = delta_V_ang (1 ,1) ;
103 delta_V3_ang = delta_V_ang (2 ,1) ;
104 printf ( \ n d e l t a A n g l e V 2= ) ; disp ( real ( delta_V2_ang ) )
;
105 printf ( \ n d e l t a A n g l e V 3= ) ; disp ( real ( delta_V3_ang ) )
;
106 V2_ang = V2_ang - delta_V2_ang ;
107 V3_ang = V3_ang - delta_V3_ang ;
108
109 Q2 = - V2_mag * V1_mag * y_bus_mag_21 * sin ( y_bus_ang_21 +
V1_ang - V2_ang ) -( V2_mag ^2) * y_bus_mag_22 * sin (
y_bus_ang_22 ) - V2_mag * V3_mag * y_bus_mag_23 * sin (
y_bus_ang_23 - V3_ang + V2_ang ) ;
110
111 delta_Q2 =( Qg2 - Qd2 ) -( Q2 ) ;
112
113 delta_v = inv ([ - B22 ]) * delta_Q2 ;
114 delta_V2 = delta_v * V2_mag ;
115
116 printf ( \ n d e l t a V 2=%0 . 3 f , delta_V2 ) ;
117 V2_mag = V2_mag + delta_V2 ;
118 printf ( \n\nV2=%0 . 3 f pu , V2_mag ) ;
119
71
120 Q3 = - V3_mag * V1_mag * y_bus_mag_31 * sin ( y_bus_ang_31 +
V1_ang - V3_ang ) -( V3_mag ^2) * y_bus_mag_33 * sin (
y_bus_ang_33 ) - V2_mag * V3_mag * y_bus_mag_32 * sin (
y_bus_ang_32 + V2_ang - V3_ang ) ;
121
122 printf ( \n\nQ3= ) ; disp ( real ( Q3 ) ) ;
72
Chapter 7
1 // C h a p t e r 7
2 // Example 7 . 1
3 // p a g e 246
4 //To f i n d i n c r e m e n t a l c o s t and l o a d s h a r i n g
5 clear ; clc ;
6
7 // / L e t u s u s e t h e program g i v e n i n t h e Appendix G i n
the textbook to write
8 // a f u n c t i o n t h a t r e t u r n s t h e v a l u e o f lamda and
Loading o f each g e n e r a t o r
9 // when t h e t o t a l l o a d on t h e p l a n t i s s e n t t o t h e
function
10
11 function [ lamdaprev , Pg ]= optimum ( Pd )
12 n =2; // number o f g e n e r a t o r s
13 Alpha =[0.2 0.25];
14 Beta =[40 30];
15 lamda =35; // i n i t i a l g u e s s f o r lambda
16 lamdaprev = lamda ;
73
17 eps =1; // t o l e r a n c e
18 deltalamda =0.25; // i n c r e m e n t i n lamda
19 Pgmax =[125 125];
20 Pgmin =[20 20];
21 Pg =100* ones (n ,1) ;
22 while abs ( sum ( Pg ) - Pd ) > eps
23 for i =1: n
24 Pg ( i ) =( lamda - Beta ( i ) ) / Alpha ( i ) ;
25 if Pg ( i ) > Pgmax ( i ) then
26 Pg ( i ) = Pgmax ( i ) ;
27 end
28 if Pg ( i ) < Pgmin ( i ) then
29 Pg ( i ) = Pgmin ( i ) ;
30 end
31 end
32 if ( sum ( Pg ) - Pd ) <0 then
33 lamdaprev = lamda ;
34 lamda = lamda + deltalamda ;
35 else
36 lamdaprev = lamda ;
37 lamda = lamda - deltalamda ;
38 end
39 end
40 endfunction
41
42
43 // t o draw t h e t a b l e 7 . 1
44 printf ( T a b l e 7 . 1 Output o f e a c h u n i t and p l a n t
o u t p u t f o r v a r i o u s v a l u e s o f lamda \n )
45 printf (
\
n );
46 printf ( P l a n t Lamda , Unit 1 Unit 2
P l a n t Output \n ) ;
47 printf ( Rs /MWh Pg1 ,MW Pg2 ,MW
( Pg1+Pg2 ) ,MW \n ) ;
48 printf (
\
74
n );
49
50 Pd_matrix =[40 76 130 150 175 220 231.25 250];
51 for i =1:8
52 [ lamda , Pg ]= optimum ( Pd_matrix ( i ) ) ;
53 printf ( %0 . 2 f %0 . 2 f %0 . 2 f
%0 . 2 f \n , lamda , Pg (1) , Pg (2) , Pg (1) + Pg
(2) ) ;
54 end
55 printf (
\
n );
56
57 //To draw t h e Graphs 7 . 3 and 7 . 4
58
59 Pd_test =40:3.75:250;
60 [ Pd_ro , Pd_co ]= size ( Pd_test )
61 for i =1: Pd_co
62 [ lamda , Pg ]= optimum ( Pd_test ( i ) ) ;
63 lamda_test ( i ) = lamda ;
64 Pg1_test ( i ) = Pg (1) ;
65 Pg2_test ( i ) = Pg (2) ;
66 end
67 Pg1_test = Pg1_test . ; // t r a n s p o s i n g w i t h o u t
conjugating
68 Pg2_test = Pg2_test . ;
69 lamda_test = lamda_test . ;
70
71 subplot (211)
72 plot ( Pd_test , lamda_test ) ;
73 title ( I n c r e m e n t a l F u e l c o s t v e r s u s p l a n t o u t p u t ) ;
74 xlabel ( P l a n t o u t p u t ,MW ) ;
75 ylabel ( I n c r e m e n t a l f u e l c o s t , Rs /MWh ) ;
76 set ( gca () , g r i d ,[0 ,0])
77 get ( c u r r e n t a x e s ) ;
78
79 subplot (212)
80 plot ( Pd_test , Pg1_test , Pd_test , Pg2_test ) ;
75
81 title ( Output o f e a c h u n i t v e r s u s p l a n t o u t p u t ) ;
82 xlabel ( P l a n t o u t p u t ,MW ) ;
83 ylabel ( U n i t o u t p u t ,MW ) ;
84 legend ([ U n i t 1 ; U n i t 2 ] ,[2]) ;
85 set ( gca () , g r i d ,[0 ,0])
86 get ( c u r r e n t a x e s ) ;
1 // C h a p t e r 7
2 // Example 7 . 2
3 // p a g e 248
4 //To f i n d t h e s a v i n g i n f u e l c o s t by o p t i m a l
scheduling
5 clear ; clc ;
6
7 // Example r e v e a l s t h a t f o r o p t i m a l l o a d s h a r i n g
u n i t s 1&2 h a s t o t a k e up 50MW and 80MW
respectively
8 // I f e a c h u n i t s u p p l i e s 65MW, i n c r e a s e i n c o s t f o r
u n i t s 1&2 a r e
9
10 Increase1 = integrate ( 0 . 2 Pg1+40 , Pg1 ,50 ,65) ;
11 Increase2 = integrate ( 0 . 2 5 Pg2+30 , Pg2 ,80 ,65) ;
12 printf ( \ n I n c r e a s e i n c o s t f o r u n i t 1 i s = %0 . 1 f Rs /
h r , Increase1 ) ;
13 printf ( \n\ n I n c r e a s e i n c o s t f o r u n i t 2 i s = %0 . 3 f
Rs / h r , Increase2 ) ;
76
Figure 7.1: Incremental cost and load sharing
77
14 printf ( \n\ nNet s a v i n g c a u s e d by optimum s c h e d u l i n g
i s = %0 . 3 f Rs / h r , Increase1 + Increase2 ) ;
15 printf ( \n\ n T o t a l y e a r l y s a v i n g a s s u m i n g c o n t i n u o u s
o p e r a t i o n= Rs %d ,( Increase1 + Increase2 ) *24*365) ;
Economical operation
1 // C h a p t e r 7
2 // Example 7 . 3
3 // p a g e 249
4 //To f i n d t h e e c o n o m i c a l o p e r a t i o n
5 clear ; clc ;
6
7 // from t h e t a b l e we g o t a s t h e o u t p u t i n t h e
example 7 1
8 // f o r optimum o p e r a t i o n o f l o a d 220MW, u n i t 1&2 must
be l o a d e d 100MW and 120MW r e s p w c t i v e l y
9 // and f o r a l o a d o f 76MW, u n i t 1&2 must be l o a d e d 20
MW and 56MW r e s p w c t i v e l y
10 start_up =400;
11 // c a s e ( i )
12 printf ( \ nCase ( i ) ) ;
13 // t o t a l f u e l c o s t f o r t h e l o a d o f 220MW d u r i n g 6AM
t o 6PM
14 Pg1 =100;
15 Pg2 =120;
16 C1 =0.1* Pg1 ^2+40* Pg1 +120;
17 C2 =0.125* Pg2 ^2+30* Pg2 +100;
18 total1 =( C1 + C2 ) *12;
19 printf ( \ n T o t a l f u e l c o s t f o r t h e l o a d o f 220MW
d u r i n g 6AM t o 6PM = Rs . %d , total1 ) ;
78
20
21 // t o t a l f u e l c o s t f o r t h e l o a d o f 76MW d u r i n g 6PM t o
6AM
22 Pg1 =20;
23 Pg2 =56;
24 C1 =0.1* Pg1 ^2+40* Pg1 +120;
25 C2 =0.125* Pg2 ^2+30* Pg2 +100;
26 total2 =( C1 + C2 ) *12;
27 printf ( \ n T o t a l f u e l c o s t f o r t h e l o a d o f 76MW
d u r i n g 6PM t o 6AM i f b o t h t h e u n i t s run = Rs . %d
, total2 ) ;
28
29 total = total1 + total2 ; // t o t a l f u e l c o s t f o r 24 h r s
30
31 printf ( \ n T o t a l f u e l c o s t f o r t h e l o a d d u r i n g 24 h r s
i f b o t h t h e u n i t s run = Rs . %d , total ) ;
32
33 // c a s e ( i i )
34 printf ( \n\ nCase ( i i ) ) ;
35 // I f d u r i n g l i g h t l o a d c o n d i t i o n u n i t 2 i s On and
Unit1 i s Off then
36 Pg2 =76;
37 C2 =0.125* Pg2 ^2+30* Pg2 +100;
38 total2 = C2 *12;
39 total_case2 = total1 + total2 + start_up ;
40
41 printf ( \ n T o t a l f u e l c o s t f o r t h e 24 h r s l a o d i f o n l y
u n i t 2 run d u r i n g l i g h t l o a d s i s = Rs . %d ,
total_case2 ) ;
79
1 // C h a p t e r 7
2 // Example 7 . 4
3 // p a g e 263
4 //To f i n d r e q u i r e d g e n e r a t i o n f o r e a c h p l a n t and
losses incurred
5 clear ; clc ;
6
7 // / L e t u s u s e t h e program g i v e n i n t h e Appendix G i n
t h e t e x t b o o k which i n c l u d e s p e n a l t y f a c t o r a l s o
to write
8 // a f u n c t i o n t h a t r e t u r n s t h e v a l u e o f lamda , L o a d i n g
o f e a c h g e n e r a t o r and l o s s e s
9 // when t h e t o t a l l o a d on t h e p l a n t i s s e n t t o t h e
function
10
11 function [ lamda , Pg , PL ]= optimum2 ( Pd )
12 n =2; // no o f g e n e r a t o r s
13 Alpha =[0.02 0.04];
14 Beta =[16 20];
15 lamda =20; // i n i t i a l v a l u e o f lamda
16 lamdaprev = lamda ;
17 eps =1; // t o l e r a n c e
18 deltalamda =0.1;
19 Pgmax =[200 200];
20 Pgmin =[0 0];
21 B =[0.001 0;0 0];
22 Pg = zeros (n ,1) ;
23 noofiter =0;
24 PL =0;
25 Pg = zeros (n ,1) ;
26 while abs ( sum ( Pg ) -Pd - PL ) > eps
27 for i =1: n
28 sigma = B (i ,:) * Pg - B (i , i ) * Pg ( i ) ;
29 Pg ( i ) =(1 -( Beta ( i ) / lamda ) -(2* sigma ) ) /( Alpha ( i
) / lamda +2* B (i , i ) ) ;
30 PL = Pg . * B * Pg ;
31 if Pg ( i ) > Pgmax ( i ) then
32 Pg ( i ) = Pgmax ( i ) ;
80
33 end
34 if Pg ( i ) < Pgmin ( i ) then
35 Pg ( i ) = Pgmin ( i ) ;
36 end
37 end
38 PL = Pg . * B * Pg ;
39 if ( sum ( Pg ) -Pd - PL ) <0 then
40 lamdaprev = lamda ;
41 lamda = lamda + deltalamda ;
42 else
43 lamdaprev = lamda ;
44 lamda = lamda - deltalamda ;
45 end
46 noofiter = noofiter +1;
47 Pg ;
48 end
49 endfunction
50
51 // I n t h i s e x a m p l e l e t u s t a k e t h e a n s w e r . i . e l o a d (
Pd ) = 2 3 7 . 0 4MW and c a l c u l a t e
52 // lamda s o t h a t we can u s e t h e a l g o r i t h m u s e d i n t h e
textbook
53 Pd =237.04
54 [ lamda_test , Pg_test , PL_test ]= optimum2 ( Pd ) ;
55 printf ( \ n L a g r a n g e s m u l t i p l i e r ( lamda ) i s \n Lamda
=%0 . 1 f , lamda_test ) ;
56 printf ( \n\ n R e q u i r e d g e n e r a t i o n f o r optimum l o a d i n g
a r e \n Pg1=%0 . 2 f MW \n Pg2=%d MW\n , Pg_test (1) ,
Pg_test (2) ) ;
57 printf ( \ nThe t r a n s m i s s i o n power l o s s i s \n PL=%0 . 2 f
MW , PL_test ) ;
58 printf ( \n\ nThe l o a d i s \n Pd=%0 . 2 f MW , Pd ) ;
81
Scilab code Exa 7.5 Savings on coordination of losses
Savings on coordination of losses
1 // C h a p t e r 7
2 // Example 7 . 5
3 // p a g e 264
4 //To f i n d s a v i n g s when l o s s e s a r e c o o r d i n a t e d
5 clear ; clc ;
6
7 function [ lamdaprev , Pg ]= optimum ( Pd )
8 n =2; // number o f g e n e r a t o r s
9 Alpha =[0.02 0.04];
10 Beta =[16 20];
11 lamda =20; // i n i t i a l g u e s s f o r lambda
12 lamdaprev = lamda ;
13 eps =1; // t o l e r a n c e
14 deltalamda =0.25; // i n c r e m e n t i n lamda
15 Pgmax =[200 200];
16 Pgmin =[0 0];
17 Pg =100* ones (n ,1) ;
18 while abs ( sum ( Pg ) - Pd ) > eps
19 for i =1: n
20 Pg ( i ) =( lamda - Beta ( i ) ) / Alpha ( i ) ;
21 if Pg ( i ) > Pgmax ( i ) then
22 Pg ( i ) = Pgmax ( i ) ;
23 end
24 if Pg ( i ) < Pgmin ( i ) then
25 Pg ( i ) = Pgmin ( i ) ;
26 end
27 end
28 if ( sum ( Pg ) - Pd ) <0 then
29 lamdaprev = lamda ;
30 lamda = lamda + deltalamda ;
31 else
32 lamdaprev = lamda ;
33 lamda = lamda - deltalamda ;
34 end
82
35 end
36 endfunction
37
38 // t h e a b o v e f u n c t i o n optimum doesn t c o o r d i n a t e
losses
39
40 // c a s e ( i ) when t h e l o s s e s a r e i n c l u d e d but n o t
coordinated
41 [ lamda_case1 , Pg_case1 ]= optimum (237.04) ;
42 // s i n c e Pg2 d o e s n o t s u p p l y t r a n s m i s s i o n l o s s e s and
t h e l o s s e s a r e s u p p l i e d o n l y by Pg1
43 Pg2_1 = Pg_case1 (2) ;
44 // t o g e t Pg1 we w i l l s o l v e Pg1+Pg2 = 0 . 0 0 1 Pg1
2+237.04
45 // t h e a b o v e e q u a t i o n can be w r i i t e n a s ( 0 . 0 0 1 Pg1 2 )
Pg1 +(237.04 Pg2 ) =0
46 p = poly ([0.001 -1 (237.04+ Pg2_1 ) ] , Pg1 ) ;
47 Pg1_1 = roots ( p ) ;
48 Pg1_1 = Pg1_1 (1) ;
49
50 printf ( \ n c a s e ( i ) when t h e l o s s e s a r e i n c l u d e d but
not c o o r d i n a t e d );
51 printf ( \ nPg1=%0 . 2 f MW Pg2=%0 . 2 f MW , Pg1_1 , Pg2_1 )
;
52
53 // c a s e ( i i ) when t h e l o s s e s a r e a l s o c o o r d i n a t e d
54 // we have t h e s o l u t i o n f o r c a s e ( i i ) from e x a m p l e 7 4
55 Pg1_2 =128.57; Pg2_2 =125; // c a s e ( i i )
56
57 printf ( \n\ n c a s e ( i i ) when t h e l o s s e s a r e c o o r d i n a t e d
);
58 printf ( \ nPg1=%0 . 2 f MW Pg2=%0 . 2 f MW , Pg1_2 , Pg2_2 )
;
59
60 // s a v i n g a t p l a n t 1 i s
61 saving1 = integrate ( 0 . 0 2 Pg1+16 , Pg1 , Pg1_2 , Pg1_1 ) ;
62 printf ( \n\ n S a v i n g a t p l a n t 1 due t o l o s s
c o o r d i n a t i o n i s = Rs %0 . 2 f / h r , saving1 ) ;
83
63
64 // s a v i n g a t p l a n t 2 i s
65 saving2 = integrate ( 0 . 0 4 Pg2+20 , Pg2 , Pg2_2 , Pg2_1 ) ;
66 printf ( \n\ n S a v i n g a t p l a n t 2 due t o l o s s
c o o r d i n a t i o n i s = Rs %0 . 2 f / h r , saving2 ) ;
67
68 // n e t s a v i n g s a c h i e v e d
69 printf ( \n\ nThe n e t s a v i n g a c h i e v e d by c o o r d i n a t i n g
l o s s e s while scheduling the r e c i e v e d load of
2 3 7 . 0 4MW i s Rs %0 . 2 f / h r , saving1 + saving2 ) ;
1 // C h a p t e r 7
2 // Example 7 . 6
3 // p a g e 268
4 //To c a l c u l a t e t h e l o s s f o r m u l a c o e f f i c i e n t s o f t h e
system
5 clear ; clc ;
6
7 Ia =2 - %i *0.5; Ic =1 - %i *0.25;
8 Ib =1.6 - %i *0.4; Id =3.6 - %i *0.9;
9 Za =0.015+ %i *0.06; Zc =0.01+ %i *0.04;
10 Zb =0.015+ %i *0.06; Zd =0.01+ %i *0.04;
11
12 ID = Id + Ic ; // t o t a l l o a d c u r r e n t
13
14 // c a l c u l a t i o n o f c u r r e n t d i s t r i b u t i o n f a c t o r s
15 printf ( \ n C u r r e n t d i s t r i b u t i o n f a c t o r s a r e : \ n )
16 Ma1 =( ID / ID ) ;
17 Ma2 =(0/ ID ) ;
84
18 Mb1 =( - Ic / ID ) ;
19 Mb2 =( Id / ID ) ;
20 Mc1 =( Ic / ID ) ;
21 Mc2 =( Ic / ID ) ;
22 Md1 =( Id / ID ) ;
23 Md2 =( Id / ID ) ;
24 printf ( Ma1=%d\tMb1=%0 . 4 f \ tMc1=%0 . 4 f \tMd1=%0 . 4 f \nMa2
=%d\tMb2=%0 . 4 f \ tMc2=%0 . 4 f \tMd2=%0 . 4 f ,Ma1 , Mb1 , Mc1
, Md1 , Ma2 , Mb2 , Mc2 , Md2 ) ;
25
26 // bus v o l t a g e c a l c u l t i o n
27 [ V1_mag , V1_ang ]= polar (1.0+ Ia * Za ) ;
28 [ V2_mag , V2_ang ]= polar (1+ Ib * Zb ) ;
29 V1_ang = real ( V1_ang ) *180/ %pi ;
30 V2_ang = real ( V2_ang ) *180/ %pi ;
31 printf ( \n\ nBus v o l t a g e s a r e g i v e n by \nV1=%0 . 3 f @
%0 . 2 f d e g PU\ tV2=%0 . 3 f @ %0 . 2 f d e g PU , V1_mag ,
V1_ang , V2_mag , V2_ang ) ;
32
33 // c u r r e n t p h a s e a n g l e s a t t h e p l a n t s
34 sigma1 = atand ( imag ( Ia ) / real ( Ia ) ) ;
35 sigma2 = atand ( imag ( Ib + Ic ) / real ( Ib + Ic ) ) ;
36 printf ( \n\ n C u r r e n t p h a s e a n g l e s a t t h e p l a n t s \
nSigma1=%ddeg \ t S i g m a 2=%ddeg , sigma1 , sigma2 ) ;
37
38 // p l a n t power f a c t o r s
39 pf1 = cosd ( V1_ang - sigma1 ) ;
40 pf2 = cosd ( V2_ang - sigma2 ) ;
41 printf ( \n\ nThe p l a n t power f a c t o r s a r e \ n p f 1=%0 . 4 f \
t p f 2=%0 . 4 f ,pf1 , pf2 ) ;
42
43 // c a l c u l a t i o n o f l o s s c o e f f i c i e n t s
44 B11 =( Ma1 * Ma1 * real ( Za ) + Mb1 * Mb1 * real ( Zb ) + Mc1 * Mc1 * real (
Zc ) + Md1 * Md1 * real ( Zd ) ) /( V1_mag * V1_mag * pf1 * pf1 ) ;
45 B22 =( Ma2 * Ma2 * real ( Za ) + Mb2 * Mb2 * real ( Zb ) + Mc2 * Mc2 * real (
Zc ) + Md2 * Md2 * real ( Zd ) ) /( V2_mag * V2_mag * pf2 * pf2 ) ;
46 B12 =( Ma1 * Ma2 * real ( Za ) + Mb1 * Mb2 * real ( Zb ) + Mc1 * Mc2 * real (
Zc ) + Md1 * Md2 * real ( Zd ) ) /( V1_mag * V2_mag * pf1 * pf2 ) ;
85
47 printf ( \n\ nThe L o s s c o e f f i c i e n t s i n PU a r e \ nB11=%0
. 5 f pu \ nB22=%0 . 5 f pu \ nB12=%0 . 5 f pu ,B11 , B22 , B12 ) ;
48 printf ( \n\ nThe L o s s c o e f f i c i e n t s i n r e c i p r o c a l
megawatts a r e \ nB11=%0 . 8 f MW1\nB22=%0 . 8 f MW1\
nB12=%0 . 8 f MW1 , B11 /100 , B22 /100 , B12 /100) ;
Scilab code Exa 7.7 Optimal generation schedule for hydrothermal sys-
tem
1 // C h a p t e r 7
2 // Example 7 . 7
3 // p a g e 281
4 //To f i n d t h e o p t i m a l g e n e r a t i o n s c h e d u l e f o r a
t y p i c a l day o f t h e f u n d a m e n t a l h y d r o t h e r m a l
system
5 clear ; clc ;
6
7 h_b =20; // b a s i c head o f t h e w a t e r
8 e =0.005; // head c o r r e c t i o n f a c t o r
9 r =2; // non e f f e c t i v e w a t e r d i s c h a r g e
10 Pd_1 =7; Pd_2 =10; Pd_3 =5; // l o a d a t t h r e e intervals
o f t i m e d u r i n g a day
11 alpha =0.5; // p o s i t i v e s c a l a r
12 X_0 =100; // i n i t i a l w a t e r s t o r a g e i n t h e r e s e r v o i r
13 X_3 =60; // f i n a l w a t e r s t o r a g e i n t h e r e s e r v o i r
14 // l e t u s assume t h e i n i t i a l v a l u e s o f t h e c o n t r o l
variables
15 q_2 =15;
16 q_3 =15;
17 i =0; // i t e r a t i o n c o u n t
18 grad_2 =1; grad_3 =1; // i n i t a l v a l u e f o r i t e r a t i o n s
86
19
20 while (( grad_2 >0.1) |( grad_3 >0.1) )
21
22 // w a t e r d i s c h a r g e i n t h e f i r s t i n t e r v a l
23 q_1 = X_0 - X_3 -( q_2 + q_3 ) ;
24
25 // w a t e r l e v e l a f t e r t h e f i r s t i n t e r v a l s a r e
26 X_1 = X_0 - q_1 ;
27 X_2 = X_1 - q_2 ;
28
29 // h y d r o g e n e r a t i o n s i n t h e s u b i n t e r v a l s
30 Pgh_1 =9.81*(10^ -3) *20*(1+0.5* e *( X_1 + X_0 ) ) *( q_1 - r ) ;
31 Pgh_2 =9.81*(10^ -3) *20*(1+0.5* e *( X_2 + X_1 ) ) *( q_2 - r ) ;
32 Pgh_3 =9.81*(10^ -3) *20*(1+0.5* e *( X_3 + X_2 ) ) *( q_3 - r ) ;
33
34 // t h e r m a l g e n e r a t i o n i n t h e t h r e e i n t e r v a l s
35 Pgt_1 = Pd_1 - Pgh_1 ;
36 Pgt_2 = Pd_2 - Pgh_2 ;
37 Pgt_3 = Pd_3 - Pgh_3 ;
38
39 // c a l c u l a t i n g l a m d a 1 f o r t h r e e s u b i n t e r v a l s
40 lamda_1_1 = Pgt_1 +25;
41 lamda_1_2 = Pgt_2 +25;
42 lamda_1_3 = Pgt_3 +25;
43
44 // s i n c e we a r e c o n s i d e r i n g l o s s l e s s c a s e
45 lamda_3_1 = lamda_1_1 ;
46 lamda_3_2 = lamda_1_2 ;
47 lamda_3_3 = lamda_1_3 ;
48
49 // f o r c a l c u l a t i n g l a m d a 2 f o r t h r e e i n t e r v a l s
50 lamda_2_1 = lamda_3_1 *9.81*(10^ -3) *20*(1+0.5* e *(2* X_0
-2* q_1 + r ) ) ;
51 lamda_2_2 = lamda_2_1 - lamda_3_1 *(0.5*9.81*(10^ -3) *20* e
*( q_1 - r ) ) - lamda_3_2 *(0.5*9.81*(10^ -3) *20* e *( q_2 - r
));
52 lamda_2_3 = lamda_2_2 - lamda_3_2 *(0.5*9.81*(10^ -3) *20* e
*( q_2 - r ) ) - lamda_3_3 *(0.5*9.81*(10^ -3) *20* e *( q_3 - r
87
));
53
54 // c a l c u l a t i o n o f g r a d i e n t v e c t o r
55 grad_2 = lamda_2_2 - lamda_3_2 *9.81*(10^ -3) *20*(1+0.5* e
*(2* X_1 -2* q_2 + r ) ) ;
56 grad_3 = lamda_2_3 - lamda_3_3 *9.81*(10^ -3) *20*(1+0.5* e
*(2* X_2 -2* q_3 + r ) ) ;
57
58 q_2 = q_2 - alpha * grad_2 ; // u p d a t i n g v a l u e o f q and
reiterating
59 q_3 = q_3 - alpha * grad_3 ;
60 i = i +1;
61 end
62
63 // Hydel and t h e r m a l g e n e r a t i o n f o r t h e t h r e e sub
i n t e r a v a l s are given in tabular format
64 printf ( \ n R e s u l t s f o r Optimal L o a d i n g o f
H y d r o t h e r m a l s t a t i o n s a t t h e end o f %d i t e r a t i o n s
,i ) ;
65 printf ( \n
n );
66 printf ( I n t e r v a l \ t \ tLoad \ t \ tHydro \ t \ t T h e r m a l \ t \
tWater d i s c h a r g e \n ) ;
67 printf ( \ t \tMW\ t \tMW\ t \tMW\ t \tm 3/ s \n ) ;
68 printf (
n );
69 printf ( 1 \ t \t%d\ t \ t%0 . 4 f \ t \ t%0 . 4 f \ t \ t%0 . 2 f \n
, Pd_1 , Pgh_1 , Pgt_1 , q_1 ) ;
70 printf ( 2 \ t \t%d\ t \ t%0 . 4 f \ t \ t%0 . 4 f \ t \ t%0 . 2 f \n
, Pd_2 , Pgh_2 , Pgt_2 , q_2 ) ;
71 printf ( 3 \ t \t%d\ t \ t%0 . 4 f \ t \ t%0 . 4 f \ t \ t%0 . 2 f \n
, Pd_3 , Pgh_3 , Pgt_3 , q_3 ) ;
72 printf (
n );
88
89
Chapter 8
1 // C h a p t e r 8
2 // Example 8 . 1
3 // p a g e 300
4 //To d e t e r m i n e t h e c h a n g e i n t h e f r e q u e n c y
5 clear ; clc ;
6 f =50;
7 H =5 e3 ;
8 KE = H *100*1000; //K . E s t o r e d i n t h e g e n e r a t o r
9 PI =50 e6 ; // power i n p u t t o g e n e r a t o r b e f o r e t h e stem
valve i s closed
10 EE = PI *0.4 ; // E x c e s s e n e r g y i n p u t t o t h e r o t a t i n g
parts
11 fnew = f *(( KE + EE ) / KE ) ^0.5; // f r e q u e n c y a t t h e end o f
the 0.4 sec
12 printf ( \ n K i n e t i c Energy s t o r e d i n t h e r o t a t i n g
p a r t s o f g e n e r a t o r and t u r b i n e = %d kWs e c , KE
/1000) ;
90
13 printf ( \ n E x c e s s power i n p u t t o g e n e r a t o r b e f o r e t h e
stem v a l v e b e g i n s t o c l o s e =%d MW , PI /1000000) ;
14 printf ( \ n E x c e s s e n e r g y i n p u t t o r o t a t i n g p a r t s i n
0 . 4 s e c=%d kWs e c , EE /1000) ;
15 printf ( \ n F r e q u e n c y a t t h e end o f 0 . 4 s e c=%0 . 2 f Hz\n\
n , fnew ) ;
1 // C h a p t e r 8
2 // Example 8 . 2
3 // p a g e 301
4 //To d e t e r m i n e d e t e r m i n e l o a d s h a r i n g and s y s t e m
frequency
5 clear ; clc ;
6 f =50; // s y s t e m f r e q u e n c y
7 x =200; // l o a d on f i r s t g e n e r a t o r ( v a l u e i s assumed
first )
8 delta_f =0.01* x ; // from t h e f i r s t e q u a t i o n g i v e n i n
t h e book
9 x =(3.75) /(0.01+0.00625) ; // by s u b s t i t u t i n g ( i ) i n (
ii )
10 delta_f =0.01* x ; // r e c a l c u l a t i n g t h e v a l u e
11 x2 =600 - x ;
12 printf ( \ nLoad s h a r e d by t h e g e n e r a t o r : \ n\ t
G e n e r a t o r 1=%0 . 2 f MW\n\ t G e n e r a t o r 2=%0 . 2 f MW\n ,x ,
x2 ) ;
13 printf ( \ nSystem F r e q u e n c y=%0 . 2 f Hz\n\n ,f - delta_f ) ;
91
Chapter 9
1 // C h a p t e r 9
2 // Example 9 . 1
3 // p a g e 335
4 //To c a l c u l a t e f a u l t c u r r e n t
5 clear ; clc ;
6 // s e l e c t i n g b a s e KVA and MVA
7 mvab =100;
8 Gmva =10;
9 T1mva =10; T2mva =5;
10 Gkvb =11; // g e n e r a t o r kV b a s e
11 OHLkvb =33; // o v e r h e a d l i n e kV b a s e
12 Ckvb =6.6; // c a b l e kB b a s e
13 xg1 = %i *0.15; xg2 = %i *0.125; xt1 = %i *0.10; xt2 = %i *0.08;
14 xOHL =0.27+ %i *0.36 ; xcab = 0.135+ %i *0.08;
15
16 // c l c u l a t i n g PU i m p e d a n c e s
17
18 xg1 =( xg1 * mvab ) / Gmva ;
19 xg2 =( xg2 * mvab ) / Gmva ;
92
20 xt1 =( xt1 * mvab ) / T1mva ;
21 xt2 =( xt2 * mvab ) / T2mva ;
22 xOHL =(30* xOHL * mvab ) /( OHLkvb ^2) ;
23 xcab =(3* xcab * mvab ) /( Ckvb ^2) ;
24 // d i s p l a y i n g r e s u l t s
25 printf ( \n R e a c t a n c e o f G1= j%0 . 1 f pu \n , abs ( imag (
xg1 ) ) ) ;
26 printf ( R e a c t a n c e o f G2= j%0 . 1 f pu \n , abs ( imag ( xg2 )
));
27 printf ( R e a c t a n c e o f T1= j%0 . 1 f pu \n , abs ( imag ( xt1 )
));
28 printf ( R e a c t a n c e o f T2= j%0 . 1 f pu \n , abs ( imag ( xt2 )
));
29 printf ( Overhead l i n e i m p e d a n c e =(%0 . 3 f + j%0 . 3 f ) pu
\n , real ( xOHL ) , abs ( imag ( xOHL ) ) ) ;
30 printf ( C a b l e i m p e d a n c e= (%0 . 3 f + j%0 . 3 f ) pu \n ,
real ( xcab ) , abs ( imag ( xcab ) ) ) ;
31
32 // Impedance d i a g r a m i s a s shown i n t h e f i g u r e 9 . 7 i n
the textbook
33 // A XCOS s i m u l a t i o n f o r t h i s p r o b l e i s done t o
e x p l a i n t h e s u b t r a n s i e n t , t r a n s i e n t and s t e a d y
state periods of a symmetrical short c i r c u i t
34 xtotal =(( xg1 * xg2 ) /( xg1 + xg2 ) + xt1 + xt2 + xOHL + xcab ) ;
35 Isc_pu =(1/ xtotal ) ;
36 Ibase =( mvab /( sqrt (3) * Ckvb ) ) *1000;
37 Isc = Isc_pu * Ibase ;
38 x_F_to_bus =( xt1 + xt2 + xOHL + xcab ) ;
39 v_11b = x_F_to_bus * Isc_pu *11;
40 // d i s p l a y i n g r e s u l t s
41 printf ( \ n T o t a l i m p e d a n c e= %0 . 1 f < %0 . 2 f deg pu \n ,
abs ( xtotal ) , atand ( imag ( xtotal ) / real ( xtotal ) ) ) ;
42 printf ( S h o r t c i r c u i t c u r r e n t= %d A\n , abs ( Isc ) ) ;
43 printf ( V o l t a g e a t 11kV bus=%0 . 2 f kV\n , abs ( v_11b ) ) ;
93
This code can be downloaded from the website wwww.scilab.in
1 // C h a p t e r 9
2 // Example 9 . 2
3 // p a g e 337
4 //To c a l c u l a t e s u b t r a n s i e n t and momentary c u r r e n t
5 clear ; clc ;
6 mvab =25;
7 Gmva =25;
8 T1mva =25; T2mva =25;
9 Gkvb =11; // g e n e r a t o r kV b a s e
10 OHLkvb =66; // o v e r h e a d l i n e kV b a s e
11 Mkvb =6.6; // motor kV b a s e
12 Mmva =5; // motor mva
13
14 XdG = %i *0.2; // G e n e r a t o r s s u b t r a n s i e n t r e a c t a n c e
15 XdM = %i *0.25; // Motor s s u b t r a n s i e n t r e a c t a n c e
16 XdM2 = %i *0.3; // Motor s t r a n s i e n t r e a c t a n c e
17 Xt1 = %i *0.1; // s t e p up t r a n s f o r m e r s r e a c t a n c e
18 Xt2 = %i *0.1; // s t e p down t r a n s f o r m e r s r e a c t a n c e
19 Xtl = %i *0.15 ; // t r n a s m i s s i o n l i n e s r e a c t a n c e
20
21 // p e r u n i t c a l c u l a t i o n
22 XdM =( XdM * mvab ) / Mmva ; // p e r u n i t i m p e d a n c e o f e a c h
motor
94
95
23 printf ( \ n S u b t r a n s i e n t r e a c t a n c e o f e a c h motor = j%0
. 2 f pu \n , abs ( XdM ) ) ;
24
25 // ( a ) s u b t r a n s i e n t c u r r e n t i n t h e f a u l t
26 Isc =(3*(1/ XdM ) ) +(1/( XdG + Xt1 + Xt2 + Xtl ) ) ;
27 Ibase =( mvab *1000) /( sqrt (3) * Mkvb ) ;
28 Isc = Isc * Ibase ;
29 printf ( \ n S u b t r a n s i e n t c u r r e n t i n t h e f a u l t =%0 . 1 fA \
n , abs ( Isc ) ) ;
30
31 // ( b ) s u b t r a n s i e n t c u r r e n t i n t h e b r e a k e r B
32 IscB =(2*(1/ XdM ) ) +(1/( XdG + Xt1 + Xt2 + Xtl ) ) ;
33 IscB = IscB * Ibase ;
34 printf ( \ n S u b t r a n s i e n t c u r r e n t i n b r e a k e r B=%0 . 1 fA \n
, abs ( IscB ) ) ;
35
36 // ( c ) t o f i n d t h e momentary c u r r e n t t h r o u g h b r e a k e r
B
37 ImomB =1.6* IscB ;
38 printf ( \ nMomentary c u r r e n t t h r o u g h t h e b r e a k e r B=
%dA\n , abs ( ImomB ) ) ;
39
40 // ( d ) t o compute c u r r e n t t o be i n t e r r u p t e d by
breaker in 5 cycles
41 XdM2 =( XdM2 * mvab ) / Mmva ; // p e r u n i t t r a n s i e n t i m p e d a n c e
o f e a c h motor
42 IscB =(2*(1/ XdM2 ) ) +(1/( XdG + Xt1 + Xt2 + Xtl ) ) ;
43 IscB = IscB * Ibase ;
44 ImomB =1.1* IscB ;
45 printf ( \ n C u r r e n t t o be i n t e r r u p t e d by b r e a k e r B i n
f i v e c y c l e s =%dA\n , abs ( ImomB ) ) ;
96
Figure 9.2: Subtransient and Momentary current Calculation
1 // C h a p t e r 9
97
2 // Example 9 . 3
3 // p a g e 340
4 //To c a l c u l a t e s u b t r a n s i e n t c u r r e n t i n G e n e r a t o r ,
Motor and f a u l t
5 clear ; clc ;
6 mvab =25;
7 kvb =11;
8 Vo =10.6/ kvb ; //PU P r e f a u l t v o l t a g e
9 printf ( \ n P r e f a u l t V o l t a g e = %0 . 4 f p u \n , Vo ) ;
10
11 Load =15/ mvab ; // l o a d PU w i t h 0 . 8 p f l e a d i n g
12 Io =( Load /( Vo *0.8) ) *( cosd (36.9) + %i * sind (36.9) ) ; //
Prefault current
13 printf ( \ n P r e f a u l t c u r r e n t = %0 . 4 f a t %0 . 1 f deg PU
, abs ( Io ) , atand ( imag ( Io ) / real ( Io ) ) ) ;
14
15 Eg = Vo +( %i *0.45* Io ) ; // v o l t a g e b e h i n d s u b t r a n s i e n t
reactance ( generator )
16 printf ( \n\ n V o l t a g e b e h i n d s u b t r a n s i e n t r e a c t a n c e (
G e n e r a t o r ) = %0 . 4 f+j%0 . 2 f pu \n , real ( Eg ) , imag (
Eg ) ) ;
17
18 Em = Vo -( %i *0.15* Io ) ; // v o l t a g e b e h i n d s u b t r a n s i e n t
r e a c t a n c e ( motor )
19 printf ( \ n V o l t a g e b e h i n d s u b t r a n s i e n t r e a c t a n c e (
Motor ) = %0 . 4 f j%0 . 4 f pu , real ( Em ) , abs ( imag ( Em ) ) )
;
20
21 Ig = Eg /( %i *0.45) ; // u n d e r f a u l t c o n d i t i o n
22 Im = Em /( %i *0.15) ; // u n d e r f a u l t c o n d i t i o n
23 printf ( \n\ nUnder F a u l t e d c o n d i t i o n \n I g =%0 . 4 f
j%0 . 4 f pu , real ( Ig ) , abs ( imag ( Ig ) ) ) ;
24 printf ( \n Im=%0 . 4 f j%0 . 4 f pu , real ( Im ) , abs ( imag (
Im ) ) ) ;
25 If = Ig + Im ; // C u r r e n t i n f a u l t
26 printf ( \n\ n C u r r e n t i n f a u l t = j%0 . 4 f pu , abs ( imag (
If ) ) ) ;
27
98
28 Ib =( mvab *1000/( sqrt (3) *11) ) ; // Base c u r r e n t
29 // A c t u a l C u r r e n t s
30 printf ( \n\nNow ) ;
31 Ig = Ig * Ib
32 Im = Im * Ib
33 If = If * Ib
34 printf ( \ n I g = %0 . 1 f j%0 . 1 f A , real ( Ig ) , abs ( imag ( Ig
)));
35 printf ( \nIm= %0 . 1 f j%0 . 1 f A , real ( Im ) , abs ( imag ( Im
)));
36 printf ( \ n I f= j%d A , abs ( imag ( If ) ) ) ;
1 // C h a p t e r 9
2 // Example 9 . 4
3 // p a g e 345
4 //To c a l c u l a t e maximum MVA
5 clear ; clc ;
6 mvab =50;
7 kvb =6.6;
8 mvaA =40;
9 mvaB =50;
10 mvaC =25;
11 feeder_impedance =((0.06+ %i *0.12) * mvab ) /( kvb ^2)
12
99
Figure 9.3: Subtransient Current Calculation
100
13 Gen_A_reactance =( %i *0.1* mvab / mvaA ) ;
14 Gen_B_reactance =( %i *0.1* mvab / mvaB ) ;
15 Gen_C_reactance =( %i *0.1* mvab / mvaC ) ;
16
17 printf ( \ n G e n e r a t o r A r e a c t a n c e = j%0 . 3 f pu , abs (
Gen_A_reactance ) ) ;
18 printf ( \ n G e n e r a t o r B r e a c t a n c e = j%0 . 3 f pu , abs (
Gen_B_reactance ) ) ;
19 printf ( \ n G e n e r a t o r C r e a c t a n c e = j%0 . 3 f pu , abs (
Gen_C_reactance ) ) ;
20
21 Reactor_A_reactance =( %i *0.12* mvab / mvaA ) ;
22 Reactor_B_reactance =( %i *0.12* mvab / mvaB ) ;
23 Reactor_C_reactance =( %i *0.12* mvab / mvaC ) ;
24
25 printf ( \ n R e a c t o r A r e a c t a n c e = j%0 . 3 f pu , abs (
Reactor_A_reactance ) ) ;
26 printf ( \ n R e a c t o r B r e a c t a n c e = j%0 . 3 f pu , abs (
Reactor_B_reactance ) ) ;
27 printf ( \ n R e a c t o r C r e a c t a n c e = j%0 . 3 f pu , abs (
Reactor_C_reactance ) ) ;
28
29 function resistance = parallel ( r1 , r2 )
30 resistance =( r1 * r2 /( r1 + r2 ) ) ;
31 endfunction
32
33 Z =( feeder_impedance ) + parallel ( %i *0.125 ,( %i *0.15 +
parallel ( %i *0.22 , %i *0.44) ) ) ;
34 scmva =(1/ abs ( Z ) ) * mvab ;
35 printf ( \n\nSC MVA = %d MVA , scmva ) ;
101
Figure 9.4: Maximum MVA Calculation
102
Scilab code Exa 9.5 Short Circuit Solution
Short Circuit Solution
1 // C h a p t e r 9
2 // Example 9 . 5
3 // p a g e 347
4 //To c a l c u l a t e s h o r t c i r c u i t s o l u t i o n
5 clear ; clc ;
6 // r e f e r r i n g t o f i g u r e s 9 . 1 9 i n t h e t e x t book , we g e t
d i r e c t l y the f a u l t current
7 V4o =1.0;
8 Zf = %i *0.13560;
9 If = V4o / Zf ;
10 printf ( \ n I f= j%0 . 5 f pu \n\n , abs ( If ) ) ;
11
12 // From F i g 9 . 1 9 d
13 I1 = If *(( %i *0.19583) /( %i *0.37638) ) ;
14 I2 = If *(( %i *0.18055) /( %i *0.37638) ) ;
15 printf ( I 1 = j%0 . 5 f pu \n\ n I 2 = j%0 . 5 f pu \n\n , abs
( I1 ) , abs ( I2 ) ) ;
16
17 // v o l t a g e c h a n g e s f o r bus 1 , 2 and 3
18 deltaV1 =0 -( %i *0.15) * I1 ;
19 deltaV2 =0 -( %i *0.15) * I2 ;
20 printf ( DeltaV1=%0 . 5 f pu \n\ nDeltaV2=%0 . 5 f pu \n\n ,
deltaV1 , deltaV2 ) ;
21
22 // r e f f e r i n g t o book
23 V1f =1+ deltaV1 ;
24 V2f =1+ deltaV2 ;
25 printf ( V1f= %0 . 5 f pu \n\ nV2f=%0 . 5 f pu \n\n ,V1f , V2f ) ;
26 I13 =( V1f - V2f ) /( %i *0.15+ %i *0.1) ;
27 printf ( I 1 3=j%0 . 5 f pu \n\n , abs ( I13 ) ) ;
103
28 deltaV3 =0 -(( %i *0.15) *( I1 ) +( %i *0.15) *( I13 ) ) ;
29 Vf3 =1+ deltaV3 ;
30 printf ( DeltaV3=%0 . 5 f pu \n\n , deltaV3 ) ;
31 printf ( Vf3=%0 . 5 f pu \n\n , Vf3 ) ;
32 Vf4 =0;
33 printf ( Vf4=%d\n\n , Vf4 ) ;
34 // s h o r t c i r c u i t MVA a t bus 4
35 SC_MVA_4 = abs ( If ) *100;
36 printf ( S h o r t c i r c u i t MVA a t b u s 4 =%0 . 3 f MVA ,
SC_MVA_4 ) ;
1 // C h a p t e r 9
2 // Example 9 . 6
3 // p a g e 352
4 //To c a l c u l a t e s h o r t c i r c u i t s o l u t i o n u s i n g
algorithm for short c i r c u i t studies
5 clear ; clc ;
6
7 Y11 =1/(0.15* %i ) +1/(0.15* %i ) +1/(0.1* %i ) +1/(0.2* %i ) ;
8 Y12 = -1/(0.2* %i ) ;
9 Y21 = Y12 ;
10 Y13 = -1/(0.15* %i ) ;
11 Y31 = Y13 ;
12 Y14 = -1/(0.1* %i ) ;
104
Figure 9.5: Short Circuit Solution
105
13 Y41 = Y14 ;
14 Y22 =1/(0.15* %i ) +1/(0.15* %i ) +1/(0.1* %i ) +1/(0.2* %i ) ;
15 Y23 = -1/(0.1* %i ) ;
16 Y32 = Y23 ;
17 Y24 = -1/(0.15* %i ) ;
18 Y42 = Y24 ;
19 Y33 =1/(0.15* %i ) +1/(0.1* %i ) ;
20 Y34 =0;
21 Y43 = Y34 ;
22 Y44 =1/(0.15* %i ) +1/(0.1* %i ) ;
23
24 // Ybus m a t r i x can be w r i t t e n a s
25
26 Ybus =[ Y11 Y12 Y13 Y14 ; Y21 Y22 Y23 Y24 ; Y31 Y32 Y33
Y34 ; Y41 Y42 Y43 Y44 ];
27
28 Zbus = inv ( Ybus ) ;
29
30 // p r e a u l t v o l t a g e s
31 V10 =1; V20 =1; V30 =1; V40 =1;
32
33 // p o s t f a u l t v o l t a g e s
34 V1f = V10 -( Zbus (1 ,4) / Zbus (4 ,4) ) * V40 ;
35 V2f = V20 -( Zbus (2 ,4) / Zbus (4 ,4) ) * V40 ;
36 V3f = V30 -( Zbus (3 ,4) / Zbus (4 ,4) ) * V40 ;
37 V4f = V40 -( Zbus (4 ,4) / Zbus (4 ,4) ) * V40 ;
38
39 // t o c a l c u l a t e f a u l t c u r r e n t t h r o u g h Z f =0
40 If = V40 /( Zbus (4 ,4) +0) ;
41
42 // s h o r t c i r c u i t c u r r e n t i n l i n e s 1 3 ,1 2 ,1 4 ,2 4 and
23
43
44 I13f =( V1f - V3f ) /(0.15* %i ) ;
45 I12f =( V1f - V2f ) /(0.2* %i ) ;
46 I14f =( V1f - V4f ) /(0.1* %i ) ;
47 I24f =( V2f - V4f ) /(0.15* %i ) ;
48 I23f =( V2f - V3f ) /(0.1* %i ) ;
106
49
50 // I f a t a l l f a u l t o c c u r s on b u s 1 o r b u s 2
51 If12 =1/ Zbus (1 ,1) ;
52
53 // d i s p l a y i n g t h e r e s u l t s
54 printf ( \n Ybus= ) ;
55 disp ( Ybus ) ;
56
57 printf ( \n Zbus= ) ;
58 disp ( Zbus ) ;
59
60 printf ( \ nV1f= %0 . 4 f pu , V1f ) ;
61 printf ( \ nV2f= %0 . 4 f pu , V2f ) ;
62 printf ( \ nV3f= %0 . 4 f pu , V3f ) ;
63 printf ( \ nV4f= %0 . 1 f pu \n , V4f ) ;
64
65 printf ( \ n F a u l t c u r r e n t=j%0 . 5 f pu \n , abs ( If ) ) ;
66
67 printf ( \ n I 1 3 f=j%0 . 3 f pu , abs ( I13f ) ) ;
68 printf ( \ n I 1 2 f=j%0 . 3 f pu , abs ( I12f ) ) ;
69 printf ( \ n I 1 4 f=j%0 . 3 f pu , abs ( I14f ) ) ;
70 printf ( \ n I 2 4 f=j%0 . 3 f pu , abs ( I24f ) ) ;
71 printf ( \ n I 2 3 f=j%0 . 3 f pu \n , abs ( I23f ) ) ;
72
73 printf ( \n F a u l t c u r r e n t f o r a f a u l t on bus 1 ( o r
bus 2 ) \n I f =j%0 . 6 f pu \n\n , abs ( If12 ) ) ;
1 // C h a p t e r 9
2 // Example 9 . 7
107
3 // p a g e 355
4 //To e v a l u a t e Zbus u s i n g C u r r e n t I n j e c t i o n method
5 clear ; clc ;
6
7 disp ( We can a p p r o a c h t h i s p r o b l e m u s i n g XCOS
s i m u l a t i o n )
8 disp ( I n t h i s s i m u l a t i o n ) ;
9 disp ( 1 ) For i n j e c t i n g u n i t c u r r e n t a t b u s 1 k e e p i n g
b u s 2 open c i r c u i t , we u s e a c u r r e n t s o u r c e o f 1
u n i t which i s s w i t c h e d on from t =0 t o t =2. D u r i n g
t h i s p e r i o d we can o b s e r v e t h e v o l t a g e w a v e f o r m s
o f V1 and V2 and compare w i t h t h e r e s u l t s g i v e n
i n the textbook );
10 disp ( 2 ) For i n j e c t i n g u n i t c u r r e n t a t b u s 2 k e e p i n g
b u s 1 open c i r c u i t , we u s e a c u r r e n t s o u r c e o f 1
u n i t which i s s w i t c h e d on from t =4 t o t =6. D u r i n g
t h i s p e r i o d we can o b s e r v e t h e v o l t a g e w a v e f o r m s
o f V1 and V2 and compare w i t h t h e r e s u l t s g i v e n
i n the textbook );
11
12 Z11 =7;
13 Z21 =4;
14 Z12 = Z21 ;
15 Z22 =6;
16
17 Zbus =[ Z11 Z12 ; Z21 Z22 ]
108
Figure 9.6: Current Injection Method
109
Zbus matrix building using Algorithm
1 // C h a p t e r 9
2 // Example 9 . 8
3 // p a g e 360
4 //To b u i l d Zbus m a t r i x u s i n g Zbus b u i l d i n g a l g o r i t h m
5 clear ; clc ;
6
7 disp ( L e t u s go on m o d i f y i n g Zbus by i n c l u d i n g n o d e s
and t h e e l e m e n t s c o n n e c t e d t o i t one by one a s
given in the textbook )
8
9 // s t e p 1 t y p e 1 m o d i f i c a t i o n
10 Zbus =[0.25];
11 printf ( \ n s t e p 1 t y p e 1 m o d i f i c a t i o n \ nZbus= ) ; disp (
Zbus ) ;
12
13 // s t e p 2 t y p e 2 m o d i f i c a t i o n
14 Zbus =[ Zbus ,0.25;0.25 ,0.25+0.1];
15 printf ( \ n s t e p 2 t y p e 2 m o d i f i c a t i o n \ nZbus= ) ; disp (
Zbus ) ;
16
17 // s t e p 3 t y p e 2 m o d i f i c a t i o n
18 Zbus =[ Zbus [0.25;0.25]; 0.25 0.25 0.35];
19 printf ( \ n s t e p 3 t y p e 2 m o d i f i c a t i o n \ nZbus= ) ; disp (
Zbus ) ;
20
21 // s t e p 4 t y p e 3 m o d i f i c a t i o n
22 Zbus = Zbus -(1/( Zbus (3 ,3) +0.25) ) *[ Zbus (1:3 ,2:2) ]*[ Zbus
(2:2 ,1:3) ];
23 printf ( \ n s t e p 4 t y p e 3 m o d i f i c a t i o n \ nZbus= ) ; disp (
Zbus ) ;
24
25 printf ( T h i s i s t h e f i n a l Zbus m a t r i x a f t e r
i n c l u d i n g a l l t h e e l e m e n t s \n ) ;
26 // s t e p 5 t y p e 4 m o d i f i c a t i o n
27 Zbus = Zbus -(1/(0.1+ Zbus (2 ,2) + Zbus (3 ,3) -2* Zbus (2 ,3) ) )
110
*[ Zbus (1:3 ,2:2) - Zbus (1:3 ,3:3) ]*[ Zbus (2:2 ,1:3) -
Zbus (3:3 ,1:3) ];
28 printf ( \ n s t e p 5 t y p e 4 m o d i f i c a t i o n \ nZbus= ) ; disp (
Zbus ) ;
29
30 disp ( o p e n i n g a l i n e b e t w e e n 23 i s e q u i v a l e n t t o
c o n n e c t i n g ( 0.1) between bus3 bus2 )
31 Zbus = Zbus -(1/( -0.1+ Zbus (2 ,2) + Zbus (3 ,3) -2* Zbus (2 ,3) ) )
*[ Zbus (1:3 ,2:2) - Zbus (1:3 ,3:3) ]*[ Zbus (2:2 ,1:3) -
Zbus (3:3 ,1:3) ];
32 printf ( Zbus= ) ; disp ( Zbus ) ; printf ( ( same a s i n s t e p
4) );
1 // C h a p t e r 9
2 // Example 9 . 9
3 // p a g e 362
4 //To f i n d p o s t f a u l t c u r r e n t s and v o l t a g e s
5 clear ; clc ;
6
7 disp ( The T h e v e n i n p a s s i v e n e t w o r k f o r t h i s s y s t e m
i s drawn i n E x a m p l e 9 8 ( o r f i g 9 . 2 8 i n t h e
textbook ) );
8 disp ( U s i n g t h e Zbus m a t r i x from t h e r e s u l t s o f
e x a m p l e 9 8 , we can c a l c u l a t e p o s t f a u l t c u r r e n t s
and v o l t a g e s ) ;
9 Zbus = %i *[0.1397059 0.1102941 0.125;0.1102941
0.1397059 0.125;0.125 0.125 0.175]
10
11 // t o f i n d f a u l t c u r r e n t
111
12 V30 =1; V10 =1; V20 =1;
13 If =( V30 /( Zbus (3 ,3) +0) ) ;
14 printf ( \ n I f=j%0 . 2 f pu \n , abs ( If ) ) ;
15
16
17 // t o f i n d p o s t f a u l t v o l t a g e s
18 V1f = V10 -( Zbus (1 ,3) / Zbus (3 ,3) ) ;
19 V2f = V20 -( Zbus (2 ,3) / Zbus (3 ,3) ) ;
20 printf ( \ nV1f=%0 . 3 f , V1f ) ;
21 printf ( \ nV2f=%0 . 3 f , V2f ) ;
22
23 // t o f i n d f a u l t c u r r e n t s i n t h e TL
24 I12f =( V1f - V2f ) /( %i *0.1) ;
25 I13f =( V1f -0) /( %i *0.1) ;
26 I23f =( V2f -0) /( %i *0.1) ;
27 printf ( \n\ n I 1 2 f=%d , I12f ) ;
28 printf ( \ n I 1 3 f=j%0 . 2 f , abs ( I13f ) ) ;
29 printf ( \ n I 2 3 f=j%0 . 2 f , abs ( I23f ) ) ;
30
31 // t o f i n d g e n e r a t o r c u r r e n t s d u r i n g f a u l t s
32 Eg1 =1; Eg2 =1;
33 Ig1f =( Eg1 - V1f ) /(0.2* %i +0.05* %i ) ;
34 Ig2f =( Eg2 - V2f ) /(0.2* %i +0.05* %i ) ;
35 printf ( \n\ n I g 1 f=j%0 . 2 f , abs ( Ig1f ) ) ;
36 printf ( \ n I g 2 f=j%0 . 2 f \n\n , abs ( Ig2f ) ) ;
112
Chapter 10
Symmetrical Components
1 // C h a p t e r 10
2 // Example 1 0 . 1
3 // p a g e 374
4 //To c a l c u l a t e s y m m e t r i c a l c o m p o n e n t s o f l i n e
currents
5 clear ; clc ;
6 Ia =10*( cosd (30) + %i * sind (30) ) ;
7 Ib =15*( cosd ( -60) + %i * sind ( -60) ) ;
8 // from KCL I a+I b+I c =0
9 Ic = -( Ia + Ib ) ;
10 // d e f i n i n g a l p h a ( a )
11 a = cosd (120) +( %i * sind (120) ) ;
12 Ip =[ Ia ; Ib ; Ic ];
13 A =[1 1 1; a ^2 a 1; a a ^2 1];
14 IA = inv ( A ) * Ip ;
15 IB = diag ([ a ^2 ,a ,1]) * IA ;
16 IC = diag ([ a , a ^2 ,1]) * IA ;
17
113
18 function [r , theta ]= phasorform ( x )
19 r = abs ( x ) ;
20 theta = atand ( imag ( x ) , real ( x ) ) ;
21 endfunction
22
23 [ IAr , IAth ]= phasorform ( IA ) ;
24 [ IBr , IBth ]= phasorform ( IB ) ;
25 [ ICr , ICth ]= phasorform ( IC ) ;
26
27 // t o d i s p l a y t h e r e s u l t s o f s y m e t t r i c a l c o m p o n e n t s
of line currents
28
29 printf ( \n\ nIA1=%0 . 2 f @ %d deg A , IAr (1 ,1) , IAth (1 ,1)
);
30 printf ( \ nIA2=%0 . 2 f @ %d deg A , IAr (2 ,1) , IAth (2 ,1) ) ;
31 printf ( \ nIA0=%0 . 2 f A , IAr (3 ,1) ) ;
32
33
34 printf ( \n\ nIB1=%0 . 2 f @ %d deg A , IBr (1 ,1) , IBth (1 ,1)
);
35 printf ( \ nIB2=%0 . 2 f @ %d deg A , IBr (2 ,1) , IBth (2 ,1) ) ;
36 printf ( \ nIB0=%0 . 2 f A , IBr (3 ,1) ) ;
37
38
39 printf ( \n\ nIC1=%0 . 2 f @ %d deg A , ICr (1 ,1) , ICth (1 ,1)
);
40 printf ( \ nIC2=%0 . 2 f @ %d deg A , ICr (2 ,1) , ICth (2 ,1) ) ;
41 printf ( \ nIC0=%0 . 2 f A , ICr (3 ,1) ) ;
42
43 // t o c a l c u l a t e D e l t a c u r r e n t s
44
45 IAB =( Ia - Ib ) /3;
46 IBC =( Ib - Ic ) /3;
47 ICA =( Ic - Ia ) /3;
48
49 // t o g e t t h e r e s u l t s i n p h a s o r n o t a t i o n
50 [ IABr , IABth ]= phasorform ( IAB ) ;
51 [ IBCr , IBCth ]= phasorform ( IBC ) ;
114
52 [ ICAr , ICAth ]= phasorform ( ICA ) ;
53
54 printf ( \n\nIAB=%0 . 2 f @ %d deg A , IABr , IABth ) ;
55 printf ( \nIBC=%0 . 2 f @ %d deg A , IBCr , IBCth ) ;
56 printf ( \nICA=%0 . 2 f @ %d deg A , ICAr , ICAth ) ;
57
58 // t o c a l c u l t e t h e s y m m e t r i c a l c om p o n e n t s o f d e l t a
c u r r e n t s by r e u s i n g t h e v a r i a b l e I p
59 Ip =[ IAB ; IBC ; ICA ];
60 IAB = inv ( A ) * Ip ;
61 IBC = diag ([ a ^2 ,a ,1]) * IAB ;
62 ICA = diag ([ a , a ^2 ,1]) * IAB ;
63
64 [ IABr , IABth ]= phasorform ( IAB ) ;
65 [ IBCr , IBCth ]= phasorform ( IBC ) ;
66 [ ICAr , ICAth ]= phasorform ( ICA ) ;
67
68 // t o d i s p l a y t h e r e s u l t s o f s y m m e t r i c a l c o m p o n e n t s
of Delta currents
69
70 printf ( \n\ nIAB1=%0 . 2 f @ %d deg A , IABr (1 ,1) , IABth
(1 ,1) ) ;
71 printf ( \ nIAB2=%0 . 2 f @ %d deg A , IABr (2 ,1) , IABth
(2 ,1) ) ;
72 printf ( \ nIAB0=%0 . 2 f A , IABr (3 ,1) ) ;
73
74
75 printf ( \n\ nIBC1=%0 . 2 f @ %d deg A , IBCr (1 ,1) , IBCth
(1 ,1) ) ;
76 printf ( \ nIBC2=%0 . 2 f @ %d deg A , IBCr (2 ,1) , IBCth
(2 ,1) ) ;
77 printf ( \ nIBC0=%0 . 2 f A , IBCr (3 ,1) ) ;
78
79
80 printf ( \n\ nICA1=%0 . 2 f @ %d deg A , ICAr (1 ,1) , ICAth
(1 ,1) ) ;
81 printf ( \ nICA2=%0 . 2 f @ %d deg A , ICAr (2 ,1) , ICAth
(2 ,1) ) ;
115
82 printf ( \ nICA0=%0 . 2 f A\n\n , ICAr (3 ,1) ) ;
1 // C h a p t e r 10
2 // Example 1 0 . 2
3 // p a g e no 390
4 //To draw s e q u e n c e n e t w o r k s o f t h e s y s t e m
5 clear ; clc ;
6
7 // s e l e c t i n g g e n e r a t o r r a t i n g a s b a s e i n g e n e r a t o r
circuit
8
9 mvab =25;
10 kvGb =11; // b a s e v o l t a g e f o r g e n e r a t o r
11 kvTLb = kvGb *(121/10.8) ; // b a s e v o l t a g e f o r TL
12 kvMb = kvTLb *(10.8/121) ; // b a s e v o l t a g e f o r m o t o r s
13
14 xG = %i *0.2;
15 xT = %i *0.1;
16 xTL =100;
17 xM = %i *0.25;
18
19 mvaG =25;
20 mvaT =30;
21 mvaM1 =15;
22 mvaM2 =7.5;
23
24 kvM =10;
25
26 // c o n v e r t i n g a l l t h e r e a c t a n c e s t o PUs
116
27
28 xT = xT *( mvab / mvaT ) *(10.8/ kvGb ) ^2;
29 xTL = xTL *( mvab /( kvTLb ) ^2) ;
30 xM1 = xM *( mvab / mvaM1 ) *( kvM / kvMb ) ^2;
31 xM2 = xM *( mvab / mvaM2 ) *( kvM / kvMb ) ^2;
32
33 // d i s p l a y i n g t h e r e s u l t s
34
35 printf ( \n\ n T r a n s m i s s i o n l i n e v o l t a g e b a s e = %0 . 1 f
kV , kvTLb ) ;
36 printf ( \n\ Motor v o l t a g e b a s e = %d kV , kvMb ) ;
37 printf ( \n\ n T r a n s f o r m e r r e a c t a n c e = %0 . 4 f pu , abs (
imag ( xT ) ) ) ;
38 printf ( \ n L i n e r e a c t a n c e = %0 . 3 f pu , abs ( xTL ) ) ;
39 printf ( \ n R e a c t a n c e o f motor 1 = %0 . 3 f pu , abs ( imag (
xM1 ) ) ) ;
40 printf ( \ n R e a c t a n c e o f motor 2 = %0 . 3 f pu \n\n , abs (
imag ( xM2 ) ) ) ;
41
42 disp ( P o s i t i v e and N e g a t i v e s e q u e n c e d i a g r a m h a s
b e e n drawn u s i n g XCOS, s i m u l a t i o n h a s n o t b e e n
done a s i t i s n o t b e i n g a s k e d i n t h e p r o b l e m ) ;
1 // C h a p t e r 10
2 // Example 1 0 . 3
3 // p a g e no 392
117
4 //To draw t h e z e r o s e q u e n c e n e t w o r k s o f t h e s y s t e m
5 clear ; clc ;
6
7 disp ( Z e r o s e q u e n c e d i a g r a m h a s b e e n drawn u s i n g
XCOS, s i m u l a t i o n h a s n o t b e e n done a s i t i s n o t
b e in g asked i n the problem );
1 // C h a p t e r 10
2 // Example 1 0 . 4
3 // p a g e no 392
4 //To draw t h e z e r o s e q u e n c e n e t w o r k s o f t h e s y s t e m
g i v e n i n example 1 0 . 2
5 clear ; clc ;
6
7 // s e l e c t i n g g e n e r a t o r r a t i n g a s b a s e i n g e n e r a t o r
circuit
8
9 mvab =25;
10 kvGb =11; // b a s e v o l t a g e f o r g e n e r a t o r
11 kvTLb = kvGb *(121/10.8) ; // b a s e v o l t a g e f o r TL
12 kvMb = kvTLb *(10.8/121) ; // b a s e v o l t a g e f o r m o t o r s
13
14 // C a l c u l a t i o n o f z e r o s e q u e n c e r e a c t a n c e
15
16 xT0 =0.0805; // z e r o s e q u e n c e r e a c t a n c e o f t r a n s f o r m e r
17 xG0 =0.06; // z e r o s e q u e n c e r e a c t a n c e o f g e n e r a t o r
118
18
19 // z e r o s e q u e n c e r e a c t a n c e o f m o t o r s
20 xM1_0 =0.06*( mvab /15) *(10/ kvMb ) ^2;
21 xM2_0 =0.06*( mvab /7.5) *(10/ kvMb ) ^2;
22
23 x_clr_0 =3*2.5*( mvab / kvGb ^2) ; // R e a c t a n c e o f c u r r e n t
l i m i t i n g r e a c t o r s t o be i c l u d e d i n t h e z e r o
sequence network
24 x_TL_0 =300*( mvab / kvTLb ^2) ; // Z e r o s e q u e n c e r e a c t a n c e
o f TL
25
26 printf ( \n\ n T r a n s f o r m e r z e r o s e q u e n c e r e a c t a n c e = %0
. 4 f pu , xT0 ) ;
27 printf ( \ n G e n e r a t o r z e r o s e q u e n c e r e a c t a n c e s = %0 . 2 f
pu , xG0 ) ;
28 printf ( \ n Z e r o s e q u e n c e r e a c t a n c e o f motor 1 = %0 . 3 f
pu , xM1_0 ) ;
29 printf ( \ n Z e r o s e q u e n c e r e a c t a n c e o f motor 2 = %0 . 3 f
pu , xM2_0 ) ;
30 printf ( \ n R e a c t a n c e o f c u r r e n t l i m i t i n g r e a c t o r s =
%0 . 3 f pu , x_clr_0 ) ;
31 printf ( \ n Z e r o s e q u e n c e r e a c t a n c e o f t r a n s m i s s i o n
l i n e = %0 . 3 f pu \n\n , x_TL_0 ) ;
32
33 disp ( Z e r o s e q u e n c e d i a g r a m h a s b e e n drawn u s i n g
XCOS, s i m u l a t i o n h a s n o t b e e n done a s i t i s n o t
b e in g asked i n the problem );
119
Chapter 11
1 // C h a p t e r 11
2 // Example 1 1 . 1
3 // p a g e 406
4 //To draw s e q u e n c e n e t w o r k s o f g e n e r a t o r and t o
compare LG f a u l t c u r r e n t w i l l be g r e a t e r t h a n
t h r e e p h a s e f a u l t c u r r e n t when n e u t r a l i s s o l i d l y
grounded
5 clear ; clc ;
6
7 disp ( S e q u e n c e n e t w o r k s o f s y n c h r o n o u s g e n e r a t o r
g r o u n d e d t h r o u g h n e u t r a l i m p e d a n c e h a s b e e n drawn
u s i n g XCOS ) ;
8
9 disp ( S i n c e t h e d e r i v a t i o n can n o t be done h e r e , l e t
u s do t h i s p r o b l e m by t a k i n g a s u i t a b l e v a l u e s
f o r the s e q u e n c e r e a c t a n c e s o f the g e n e r a t o r );
10
11 disp ( X1=j 0 . 1 8 , X2=j 0 . 1 5 , X0=j 0 . 1 0 pu and Ea=1 ) ;
12
120
13 disp ( From t h e f i g s 1 1 . 1 3 and 1 1 . 1 4 i n t h e t e x t b o o k ,
we can f i n d I l g and I3L ) ;
14
15 Ea =1; X1 =0.18* %i ; X2 =0.15* %i ; X0 =0.10* %i ;
16
17 IaLG =3* Ea /(2* X1 + X0 )
18 Ia3L =3* Ea /(3* X1 )
19
20 disp ( Same v a l u e s o f s e q u e n c e i m p e d a n c e have b e e n
u s e d i n XCOS s i m u l a t i o n a l s o t o v a r i f y t h e r e s u l t
);
Scilab code Exa 11.2 Grounding Resistor voltage and Fault Current
1 // C h a p t e r 11
2 // Example 1 1 . 2
3 // p a g e 408
4 //To f i n d f a u l t c u r r e n t and v o l t a g e a c r o s s t h e
grounding r e s i s t o r
5 clear ; clc ;
6
7 X1eq =( %i *0.18) /2;
8 X2eq =( %i *0.15) /2;
9 Z0eq =( %i *0.10) +3*(2*20/(11^2) ) ;
10
11 Ea =1;
121
Figure 11.1: LG and 3Phase faults Comparision
122
12
13 // c a l c u l a t i o n o f f a u l t c u r r e n t
14 printf ( \ n F a u l t c u r r e n t i s g i v e n by ) ;
15 If =(3* Ea ) /( X1eq + X2eq + Z0eq )
16
17 // c u r r e n t i n g r o u n d i n g r e s i s t o r
18 Ifg = abs ( If ) *(20/(11* sqrt (3) ) ) ;
19 printf ( \n\ n C u r r e n t t h r o u g h g r o u n d i n g r e s i s t o r I f g=
%0 . 2 fkA , Ifg ) ;
20
21 // v o l t a g e a c r o s s g r o u n d i n g r e s i s t o r
22 Vgr = abs ( If *(2*20/(11^2) ) *(11/ sqrt (3) ) ) ;
23 printf ( \n\ n V o l t a g e a c r o s s g r o u n d i n g r e s i s t o r Vgr=%0
. 2 fkV \n\n , Vgr ) ;
Scilab code Exa 11.3 Fault and subtransient currents of the system
1 // C h a p t e r 11
2 // Example 1 1 . 3
3 // p a g e 409
4 //To f i n d f a u l t c u r r e n t and s u b t r a n s i e n t c u r r e n t i n
a l l p a r t s o f the system
5 clear ; clc ;
6
7 a = -0.5+( sqrt (3) /2) * %i ;
8
123
Figure 11.2: Grounding Resistor voltage and Fault Current
124
9 // n e g l e c t i n g p r e f a u l t c u r r e n t s
10 Vf0 =10/11;
11 Eg = Vf0 ; Em1 = Vf0 ; Em2 = Vf0 ;
12
13 // p o s i t i v e s e q u e n c e n e t w o r k when i t i s r e p l a c e d by
i t s t h e v e n i n s e q u v i v a l e n t a s shown i n f i g 1 1 . 1 8
14 printf ( \ n s e q u e n c e i m p e d a n c e s a r e g i v e n by \n ) ;
15 Z1 =( %i *0.525* %i *0.23) /( %i *0.755) ;
16 Z2 = Z1 ;
17 Z0 = %i *1.712;
18 printf ( Z1=j%0 . 4 f \ nZ2=j%0 . 4 f \ nZ0=j%0 . 4 f , abs ( imag (
Z1 ) ) , abs ( imag ( Z2 ) ) , abs ( imag ( Z0 ) ) ) ;
19 // t o f i n d s e q u e n c e c u r r e n t
20 Ia1 = Vf0 /( Z1 + Z2 + Z0 ) ;
21 Ia2 = Ia1 ;
22 Ia0 = Ia1 ;
23
24 // t o f i n d f a u l t c u r r e n t
25 If =3* Ia0 ;
26 printf ( \n\ n F a u l t C u r r e n t= j%0 . 4 f , abs ( imag ( If ) ) ) ;
27
28
29 // component c u r r e n t f l o w i n g from g e n e r a t o r and motor
30 printf ( \n\ nComponents c u r r e n t s f l o w i n g from
G e n e r a t o r and motor a r e \n )
31 Ig1 = Ia1 *(0.23/0.755) ;
32 Ig2 = Ig1 ;
33 Ig0 =0;
34 printf ( I g 1= j%0 . 4 f \ n I g 2= j%0 . 4 f \ n I g 0=%d , abs (
Ig1 ) , abs ( Ig2 ) , abs ( Ig0 ) ) ;
35 printf ( \n ) ;
36 Im1 = Ia1 *(0.525/0.755) ;
37 Im2 = Im1 ;
38 Im0 = Ia0 ;
39 printf ( \ nIm1= j%0 . 4 f \ nIm2= j%0 . 4 f \ nIm0= j%0 . 4 f
, abs ( Im1 ) , abs ( Im2 ) , abs ( Im0 ) ) ;
40
41 // f a u l t c u r r e n t s from t h e g e n e r a t o r and motor
125
towards g are
42 printf ( \n\ n F a u l t c u r r e n t from t h e g e n e r a t o r t o w a r d s
g a r e );
43 Ig =[1 1 1; a ^2 a 1; a a ^2 1]*[ Ig1 ; Ig2 ; Ig0 ];
44 disp ( Ig ) ;
45 printf ( and t o g from m o t o r s a r e ) ;
46 Im =[1 1 1; a ^2 a 1; a a ^2 1]*[ Im1 ; Im2 ; Im0 ];
47 disp ( Im ) ;
48
49 printf ( \ n P o s i t i v e s e q u e n c e c u r r e n t =%0 . 3 f pu ,( - %i *
Ig1 ) ) ;
50 printf ( \ n N e g a t i v e s e q u e n c e c u r r e n t =%0 . 3 f pu ,( %i *
Ig2 ) ) ;
51 printf ( \ n Z e r o s e q u e n c e c u r r e n t=%d\n , Ig0 ) ;
52
53 // u n d e r l o a d e d c o n d i t i o n , PU motor c u r r e n t s a r e
54 Im1o =(15/(25*0.909*0.8) ) *(0.800103636+ %i
*0.5998617938) ;
55 Im2o =(7.5/(25*0.909*0.8) ) *(0.800103636+ %i
*0.5998617938) ;
56 printf ( \ nThe p e r u n i t motor c u r r e n t s a r e : \ n ) ;
57 printf ( Motor1 : %0 . 2 f +j%0 . 3 f pu , real ( Im1o ) , imag (
Im1o ) ) ;
58 printf ( \ nMotor2 : %0 . 2 f +j%0 . 3 f pu , real ( Im2o ) , imag (
Im2o ) ) ;
59
60 // t h e v o l t a g e s b e h i n d s u b t r a n s i e n t r e a c t a n c e s a r e
c a l c u l a t e d below
61 printf ( \n\ n V o l t a g e b e h i n d s u b t r a n s i e n t r e a c t a n c e s : \
n );
62 printf ( Motor1 : ) ;
63 Em1 = Em1 -( %i *0.345* Im1o ) ;
64 printf ( Em1= %0 . 4 f j%0 . 4 f , real ( Em1 ) , abs ( imag ( Em1 ) ) )
;
65
66 printf ( \ nMotor2 : ) ;
67 Em2 = Em2 -( %i *0.69* Im2o ) ;
68 printf ( Em2= %0 . 4 f j%0 . 4 f , real ( Em2 ) , abs ( imag ( Em2 ) ) )
126
;
69
70 printf ( \ n G e n e r a t o r : ) ;
71 Eg = Eg +( %i *0.525*( Im2o + Im1o ) ) ;
72 printf ( Eg= %0 . 4 f j +%0 . 4 f , real ( Eg ) , abs ( imag ( Eg ) ) ) ;
73
74 // a c t u a l v a l u e o f p o s i t i v e s e q u e n c e c u r r e n t from
g e n e r a t o r and motor
75 printf ( \n\ nThe a c t u a l v a l u e o f p o s i t i v e s e q u e n c e
c u r r e n t from t h e g e n e r a t o r t o w a r d s f a u l t i s = %0
. 2 f+j%0 . 3 f , real ( Im1o + Im2o + Ig1 ) , imag ( Im1o + Im2o +
Ig1 ) ) ;
76 printf ( \ nThe a c t u a l v a l u e o f p o s i t i v e s e q u e n c e
c u r r e n t from t h e m o t o r s t o w a r d s f a u l t i s = %0 . 2 f
j%0 . 3 f , real ( - Im1o - Im2o + Im1 ) , abs ( imag ( - Im1o - Im2o +
Im1 ) ) ) ;
LL Fault Current
1 // C h a p t e r 11
2 // Example 1 1 . 4
3 // p a g e 412
4 //To f i n d LL f a u l t c u r r e n t and v o l t a g e o f h e a l t h y
phase
5 clc ; clear ;
6 X1eq =0.09* %i ;
127
Figure 11.3: Fault and subtransient currents of the system
128
7 X2eq =0.075* %i ;
8 Z0 =0.99+( %i *0.1) ;
9 Ea =1; Ia0 =0;
10
11 // t o c a l c u l a t e I a 1
12 Ia1 = Ea /( X1eq + X2eq ) ;
13
14 // t o c a l c u l a t e f a u l t c u r r e n t
15 If =( - %i * sqrt (3) ) *( - %i *6.06) ;
16 Va1 = Ea -( Ia1 * X1eq ) ;
17 Va0 =( - Ia0 * Z0 ) ;
18 Va2 = Va1 ;
19
20 // v o l t a g e i n h e a l t h y p h a s e
21 Va = Va1 + Va2 + Va0 ;
22
23 // d i s p l a y i n g t h e r e s u l t
24 printf ( \ n I a 1=j%0 . 2 f , abs ( Ia1 ) ) ;
25 printf ( \ n I f=%0 . 3 f , If ) ;
26 printf ( \ nVa1=Va2=%0 . 3 f , Va1 ) ;
27 printf ( \ nVa0=%d , Va0 ) ;
28 printf ( \nVa=Va1+Va2+Va0=%0 . 2 f \n\n , Va ) ;
1 // C h a p t e r 11
129
Figure 11.4: LL Fault Current
130
2 // Example 1 1 . 5
3 // p a g e 413
4 //To f i n d Double l i n e t o g r o u n d f a u l t c u r r e n t and
v o l t a g e o f healthy phase
5 clc ; clear ;
6
7 Z1eq =0.09* %i ;
8 Z2eq =0.075* %i ;
9 Z0 =( %i *0.1) ;
10 Ea =1;
11 a =( -0.5+ %i * sqrt (3) /2) ;
12
13 // t o f i n d t h e s e q u e n c e c o mp o n e n t s o f h e a l t h y p h a s e
14 Ia1 = Ea /( Z1eq +( Z2eq * Z0 /( Z2eq + Z0 ) ) ) ;
15 Va1 = Ea -( Ia1 * Z1eq ) ;
16 Va2 = Va1 ;
17 Va0 = Va1 ;
18
19 Ia2 = -( Va2 / Z2eq ) ;
20 Ia0 = -( Va0 / Z0 ) ;
21
22 I =[1 1 1; a ^2 a 1; a a ^2 1]*[ Ia1 ; Ia2 ; Ia0 ];
23
24 // v o l t a g e o f t h e h e a l t h y p h a s e
25 Va =3* Va1 ;
26
27 // d i s p l a y i n g t h e r e s u l t s
28 printf ( I a 1=j%0 . 3 f \n , abs ( Ia1 ) ) ;
29 printf ( I a 2=j%0 . 3 f \n , abs ( Ia2 ) ) ;
30 printf ( I a 0=j%0 . 3 f \n\n , abs ( Ia0 ) ) ;
31
32 printf ( I a=%0 . 3 f + j%0 . 3 f \n , real ( I (1 ,1) ) , imag ( I
(1 ,1) ) ) ;
33 printf ( I b=%0 . 3 f + j%0 . 3 f \n , real ( I (2 ,1) ) , imag ( I
(2 ,1) ) ) ;
34 printf ( I c=%0 . 3 f + j%0 . 3 f \n\n , real ( I (3 ,1) ) , imag ( I
(3 ,1) ) ) ;
35
131
Figure 11.5: Double line to ground Fault
36 printf ( V o l t a g e o f t h e h e a l t h y p h a s e Va=3Va1=%0 . 3 f
, Va ) ;
132
1 // C h a p t e r 11
2 // Example 1 1 . 6
3 // p a g e 420
4 //To f i n d bus v o l t a g e s and c u r r e n t s
5
6 clc ; clear ;
7 v_pf =1; // p r e f a u l t v o l t a g e
8 // a c c o r d i n g t o t h e f i g . 1 1 . 2 6
9 Y1dd =(( %i *0.2) ^ -1) +(( %i *0.0805) ^ -1) ;
10 Y1fg = -( %i *0.0805) ^ -1;
11 Y1de = Y1fg ;
12 Y1ff =(( %i *0.0805) ^ -1) +(( %i *0.164) ^ -1) ;
13 Y1ee = Y1ff ;
14 Y1ef = -( %i *0.164) ^ -1;
15 Y1gg =(( %i *0.0805) ^ -1) +(( %i *0.345) ^ -1) +(( %i *0.69) ^ -1)
;
16 Y1df =0;
17 Y1dg =0;
18 Y1ed = Y1de ;
19 Y1eg =0;
20 Y1fd =0;
21 Y1fe = Y1ef ;
22 Y1gd =0;
23 Y1ge =0;
24 Y1gf = Y1fg ;
25 printf ( \nYBus and ZBus m a t r i x can be w r i t t e n a s : \
n )
26 Y1_bus =[ Y1dd Y1de Y1df Y1dg ; Y1ed Y1ee Y1ef Y1eg ; Y1fd
Y1fe Y1ff Y1fg ; Y1gd Y1ge Y1gf Y1gg ];
27 Y2_bus = Y1_bus ;
28 printf ( \ nY1 bus= ) ; disp ( Y1_bus ) ;
29 printf ( \ nY2 bus= ) ; disp ( Y2_bus ) ;
30 Y0dd =( %i *1.608) ^ -1; Y0de =0; Y0df =0; Y0dg =0;
31 Y0ed =0; Y0ee =(( %i *0.0805) ^ -1) +(( %i *0.494) ^ -1) ; Y0ef = -(
%i *0.494) ^ -1; Y0eg =0;
32 Y0fd =0; Y0fe = Y0ef ; Y0ff = Y0ee ; Y0fg =0;
33 Y0gd =0; Y0de =0; Y0gf =0; Y0gg =( %i *1.712) ^ -1;
34
133
35 Y0_bus =[ Y0dd Y0de Y0df Y0dg ; Y0ed Y0ee Y0ef Y0eg ; Y0fd
Y0fe Y0ff Y0fg ; Y0gd Y0de Y0gf Y0gg ];
36 printf ( \ nY0 bus= ) ; disp ( Y0_bus ) ;
37
38 // f i n d i n g Zbus m a t r i x
39 Z1_bus = inv ( Y1_bus ) ;
40 Z2_bus = inv ( Y2_bus ) ;
41 Z0_bus = inv ( Y0_bus ) ;
42 printf ( \n\ nZ1bus= ) ; disp ( Z1_bus ) ;
43 printf ( \ n Z 2 b u s= ) ; disp ( Z2_bus ) ;
44 printf ( \ n Z 0 b u s= ) ; disp ( Z0_bus ) ;
45
46 // t o f i n d f a u l t c u r r e n t w i t h LG f a u l t on bus e
case ( i )
47 If_e =(3* v_pf ) /( Z1_bus (2 ,2) + Z2_bus (2 ,2) + Z0_bus (2 ,2) ) ;
48 printf ( \n\n\ n F a u l t c u r r e n t w i t h LG f a u l t on bus e
i s I f e = j%0 . 5 f \n , abs ( imag ( If_e ) ) ) ;
49
50 // t o f i n d f a u l t c u r r e n t w i t h LG f a u l t on bus f
case ( i i )
51 If_f =(3* v_pf ) /( Z1_bus (3 ,3) + Z2_bus (3 ,3) + Z0_bus (3 ,3) ) ;
52 printf ( F a u l t c u r r e n t w i t h LG f a u l t on bus f i s I f f
= j%0 . 5 f \n , abs ( imag ( If_f ) ) ) ;
53
54 // t o f i n d bus v o l t a g e s and l i n e c u r r e n t s i n c a s e ( i )
55 printf ( \n\n\ nBus v o l t a g e s and c u r r e n t s a r e g i v e n
b e l o w : \ n\n ) ;
56 Vf1_d =1 -( Z1_bus (1 ,2) * If_e /3) ;
57 Vf1_e =1 -( Z1_bus (2 ,2) * If_e /3) ;
58 Vf1_f =1 -( Z1_bus (3 ,2) * If_e /3) ;
59 Vf1_g =1 -( Z1_bus (4 ,2) * If_e /3) ;
60 disp ( V f 1 d= ) ; disp ( Vf1_d ) ;
61 disp ( V f 1 e= ) ; disp ( Vf1_e ) ;
62 disp ( V f 1 f= ) ; disp ( Vf1_f ) ;
63 disp ( V f 1 g= ) ; disp ( Vf1_g ) ;
64
65 printf ( \n\n\n ) ;
66 Vf2_d = -( Z2_bus (1 ,2) * If_e /3) ;
134
67 Vf2_e = -( Z2_bus (2 ,2) * If_e /3) ;
68 Vf2_f = -( Z2_bus (3 ,2) * If_e /3) ;
69 Vf2_g = -( Z2_bus (4 ,2) * If_e /3) ;
70 disp ( V f 2 d= ) ; disp ( Vf2_d ) ;
71 disp ( V f 2 e= ) ; disp ( Vf2_e ) ;
72 disp ( V f 2 f= ) ; disp ( Vf2_f ) ;
73 disp ( V f 2 g= ) ; disp ( Vf2_g ) ;
74
75 printf ( \n\n\n ) ;
76 Vf0_d = -( Z0_bus (1 ,2) * If_e /3) ;
77 Vf0_e = -( Z0_bus (2 ,2) * If_e /3) ;
78 Vf0_f = -( Z0_bus (3 ,2) * If_e /3) ;
79 Vf0_g = -( Z0_bus (4 ,2) * If_e /3) ;
80 disp ( V f 0 d= ) ; disp ( Vf0_d ) ;
81 disp ( V f 0 e= ) ; disp ( Vf0_e ) ;
82 disp ( V f 0 f= ) ; disp ( Vf0_f ) ;
83 disp ( V f 0 g= ) ; disp ( Vf0_g ) ;
84
85 printf ( \n\n\n ) ;
86 If1_fe = - Y1fe *( Vf1_f - Vf1_e ) ; disp ( I f 1 f e = ) ; disp (
If1_fe ) ;
87 If1_de = - Y1de *( Vf1_d - Vf1_e ) ; disp ( I f 1 d e = ) ; disp (
If1_de ) ;
88 Ia1 = If1_fe + If1_de ; disp ( I a 1= ) ; disp ( Ia1 ) ;
89
90 printf ( \n\n\n ) ;
91 If1_gf = - Y1gf *( Vf2_g - Vf2_f ) ; disp ( I f 1 g f = ) ; disp (
If1_gf ) ;
92
93 printf ( \n\n\n ) ;
94 If2_fe = - Y1fe *( Vf2_f - Vf2_e ) ; disp ( I f 2 f e = ) ; disp (
If2_fe ) ; // Y 2 f e=Y 1 f e
95 If0_fe = - Y0fe *( Vf2_f - Vf2_e ) ; disp ( I f 0 f e = ) ; disp (
If0_fe ) ;
96 If_fe = If1_fe + If2_fe + If0_fe ; disp ( I f f e = ) ; disp ( If_fe
);
135
Scilab code Exa 11.7 Short Circuit Current Calculations
1 // C h a p t e r 11
2 // Example 1 1 . 7
3 // p a g e 423
4 //To f i n d s h o r t c i r c u i t c u r r e n t s
5
6 clc ; clear ;
7 v_pf =1; // p r e f a u l t v o l t a g e
8 a =0.5+0.8660254* %i ;
9 // a c c o r d i n g t o t h e f i g . 1 1 . 2 8 we can w r i t e Zbus
m a t r i x f o r p o s i t i v e and n e g a t i v e p h a s e s e q u e n c e
10 printf ( \ n s t e p by s t e p f o r f i n d i n g Z 1 b u s \n )
11
12 // Bus1 t o r e f e r a n c e bus
13 Z1_bus =[0.15];
14 printf ( Bus1 t o r e f e r e n c e \ n Z 1 b u s= ) ; disp ( Z1_bus ) ;
15
16 // Bus2 t o Bus1
17 Z1_bus =[ Z1_bus 0.15;0.15 0.15+0.2];
18 printf ( \ nBus2 t o Bus1 \ n Z 1 b u s= ) ; disp ( Z1_bus ) ;
19
20 // Bus2 t o r e f e r e n c e bus
21 Z1_bus = Z1_bus -(1/( Z1_bus (2 ,2) +0.15) ) *[ Z1_bus
(1:2 ,2:2) ]*[ Z1_bus (2:2 ,1:2) ];
22 Z1_bus =( %i * Z1_bus ) ;
23 Z2_bus = Z1_bus ;
24 printf ( \ nBus2 t o R e f e r e n c e \ n Z 1 b u s= ) ; disp ( Z1_bus ) ;
printf ( \ n Z 2 b u s= ) ; disp ( Z2_bus ) ;
25
136
26 // a c c o r d i n g t o t h e f i g . 1 1 . 2 9 we can w r i t e Zbus
matrix f o r zero phase sequence
27 printf ( \ n s t e p by s t e p f o r f i n d i n g Z 0 b u s \n )
28 // Bus1 t o r e f e r a n c e bus
29 Z0_bus =[0.05];
30 printf ( \ nBus1 t o r e f e r e n c e \ n Z 0 b u s= ) ; disp ( Z0_bus )
;
31
32 // Bus2 t o Bus1
33 Z0_bus =[ Z0_bus 0.05;0.05 0.05+0.4];
34 printf ( \ nBus1 t o Bus1 \ n Z 0 b u s= ) ; disp ( Z0_bus ) ;
35
36 // Bus2 t o r e f e r e n c e bus
37 Z0_bus = Z0_bus -(1/( Z0_bus (2 ,2) +0.05) ) *[ Z0_bus
(1:2 ,2:2) ]*[ Z0_bus (2:2 ,1:2) ];
38 Z0_bus =( %i * Z0_bus ) ;
39 printf ( \ nBus2 t o r e f e r e n c e \ n Z 0 b u s= ) ; disp ( Z0_bus )
;
40
41 // t o f i n d p o s i t i v e s e q u e n c e o f f a u l t c u r r e n t
42 printf ( \n\n\ n F a u l t c u r r e n t c a l c u l a t i o n \n )
43 If1_1 = v_pf /( Z1_bus (1 ,1) + Z2_bus (1 ,1) + Z0_bus (1 ,1) ) ;
printf ( I f 1 1 = j%0 . 5 f , abs ( imag ( If1_1 ) ) ) ;
44 printf ( \ n F a u l t c u r r e n t= I f 1 =3 I f 1 1 =j%0 . 1 f \n\n , abs (
imag (3* If1_1 ) ) ) ;
45
46 Vf1_1 =1 - Z1_bus (1 ,1) * If1_1 ;
47 Vf1_2 =1 - Z1_bus (2 ,1) * If1_1 ;
48
49 Vf2_1 = - Z2_bus (1 ,1) * If1_1 ;
50 Vf2_2 = - Z2_bus (2 ,1) * If1_1 ;
51
52 Vf0_1 = - Z0_bus (1 ,1) * If1_1 ;
53 Vf0_2 = - Z0_bus (2 ,1) * If1_1 ;
54
55 If1_12 =(( %i *0.2) ^ -1) *( Vf1_1 - Vf1_2 ) ;
56 If2_12 =(( %i *0.2) ^ -1) *( Vf2_1 - Vf2_2 ) ;
57 If0_12 =(( %i *0.4) ^ -1) *( Vf0_1 - Vf0_2 ) ;
137
58
59 If =[1 1 1; a ^2 a 1; a a ^2 1]*[ If1_12 ; If2_12 ; If0_12 ];
60
61 printf ( \n\n\ n S h o r t c i r c u i t c u r r e n t on t h e
t r a n s m i s s i o n l i n e i n a l l t h e t h r e e p h a s e s \n )
62 printf ( \ n I f a 1 2 = ) ;
63 disp ( If (1 ,1) ) ;
64
65 printf ( \ n I f b 1 2= ) ;
66 disp ( If (2 ,1) ) ;
67
68 printf ( \ n I f b 1 2= ) ;
69 disp ( If (3 ,1) ) ;
70
71 // s h o r t c i r c u i t c u r r e n t p h a s e ( a ) o f t h e g e n e r a t o r
72 If1_G =((0.15* %i ) ^ -1) *(1 - Vf1_1 ) *( cosd ( -30) + %i * sind
( -30) ) ;
73 If2_G =((0.15* %i ) ^ -1) *(0 - Vf2_1 ) *( cosd (30) + %i * sind (30)
);
74 If0_G =0;
75 printf ( \n\n\ n s h o r t c i r c u i t c u r r e n t p h a s e ( a ) o f t h e
g e n e r a t o r \n )
76 Ifa_G = If1_G + If2_G + If0_G ; printf ( I f a G = j%0 . 5 f ,
abs ( imag ( Ifa_G ) ) ) ;
77
78 // V o l t a g e o f t h e h e a l t h y p h a s e s o f t h e bus 1 .
79 printf ( \n\n\ n V o l t a g e o f t h e h e a l t h y p h a s e s o f t h e
bus 1\ n )
80 Vf_b_1 = Vf1_1 *( cosd (240) + %i * sind (240) ) + Vf2_1 *( cosd
(120) + %i * sind (120) ) + Vf0_1 ; printf ( V f b 1=%0 . 4 f
j%0 . 5 f , real ( Vf_b_1 ) , abs ( imag ( Vf_b_1 ) ) ) ;
81 Vf_c_1 = Vf1_1 *( cosd (120) + %i * sind (120) ) + Vf2_1 *( cosd
(240) + %i * sind (240) ) + Vf0_1 ; printf ( \ n V f c 1=%0 . 4 f
+ j%0 . 5 f , real ( Vf_c_1 ) , abs ( imag ( Vf_c_1 ) ) ) ;
138
Chapter 12
Scilab code Exa 12.1 Calculation of stored kinetic energy and rotor ac-
celeration
1 // C h a p t e r 12
2 // Example 1 2 . 1
3 // p a g e 439
4 //To f i n d s t o r e d k i n e t i c e n e r g y , r o t o r a c c e l e r a t i o n ,
c h a n g e i n t o r q u e a n g l e and r o t o r s p e e d
5 clear ; clc ;
6 G =100; // b a s e machine r a t i n g
7 H =8.0; // i n e r t i a c o n s t a n t
8 P =4; // no o f p o l e s
9 // ( a ) To f i n d s t o r e d e n e r g y i n r o t o r a t s y n c h r o n o u s
speed
10 stored_energy = G * H ;
11 printf ( \ n S t o r e d e n e r g y = %d MJ , stored_energy ) ;
12
13 // ( b ) To f i n d r o t o r a c c e l e r a t i o n when m e c h a n i c a l
i n p u t i s r a i s e d 80MW f o r an e l e c t r i c a l l o a d o f 50
MW
14 Pa =30; // n e t t power
139
15 f =50; // f r e q u e n c y
16 M = stored_energy /(180* f ) ;
17 alpha = Pa / M ; // r o t o r a c c e l e r a t i o n
18 printf ( \n\ nRotor a c c e l e r a t i o n = %0 . 1 f e l e c t deg / s 2
, alpha ) ;
19
20 // ( c ) To c a l c u l a t e c h a n g e i n t o r q u e a n g l e and r o t o r
s p e e d when t h e a b o v e a c c e l e r a t i o n i s m a i n t a i n e d
f o r 10 c y c l e s
21 change_angle =0.5* alpha *(10*20*10^( -3) ) ;
22 printf ( \n\ nChange i n t o r q u e a n g l e = %0 . 2 f e l e c t
d e g r e e s , change_angle ) ;
23 change_angle =60* alpha /(2*360) ;
24 printf ( \ nChange i n t o r q u e a n g l e = %0 . 3 f rpm/ s ,
change_angle ) ;
25 speed =(120* f / P ) +( change_angle *0.2) ;
26 printf ( \n\ nRoor s p e e d a t t h e end o f 10 c y c l e s = %0
. 3 f rpm , speed ) ;
1 // C h a p t e r 12
2 // Example 1 2 . 1
3 // p a g e 448
4 //To c a l c u l a t e s t e a d y s t a t e power l i m i t
5 clear ; clc ;
6
7 Xdg =1* %i ; // g e n e r a t o r s
8 Xdm =1* %i ; // motor s
9 Xt =0.1* %i ; // t r a n s f o r m e r s
10 Xl =0.25* %i ; // t r a n s m i s s i o n l i n e s
140
11 Xc = -1* %i ; // s t a t i c c a p a c i t o r s
12 Xi =1* %i ; // i n d u c t i v e r e a c t o r
13 Eg =1.2; // g e n e r a t o r s i n t e r n a l v o l t a g e
14 Em =1; // motor s i n t e r n a l v o l t a g e
15
16 // c a s e ( i ) s t e a d y s t a t e power l i m i t w i t h o u t r e a c t o r
17 P1 =( abs ( Eg ) * abs ( Em ) ) /( abs ( Xdg + Xt + Xl + Xt + Xdm ) ) ;
18 printf ( \n\n S t e a d y s t a t e power l i m i t w i t h o u t
r e a c t o r = %0 . 5 f pu , P1 ) ;
19
20 // c a s e ( i i ) s t e a d y s t a t e power l i m i t w i t h c a p a c i t i v e
reactor
21 // t h r e e arms o f s t a r c o n n e c t e d r e a c t a n c e s a r e
22 Xa = Xdg + Xt + Xl ; // from g e n e r a t o r s i d e
23 Xb = Xdm + Xt ; // from l o a d s i d e
24 Xc = Xc ; // from r e a c t o r s i d e
25
26 // c o n v e r t i n g s t a r t o d e l t a
27 // r e a c t a n c e b e t w e e n g e n e r a t o r s i d e t o l o a d s i d e is
28 Xab =( Xa * Xb + Xb * Xc + Xc * Xa ) / Xc ;
29 // power l i m i t i s
30 P2 =( abs ( Eg ) * abs ( Em ) ) /( abs ( Xab ) ) ;
31 printf ( \n\n S t e a d y s t a t e power l i m i t w i t h
c a p a c i t i v e r e a c t o r = %0 . 5 f pu , P2 ) ;
32
33 // c a s e ( i i i ) s t e a d y s t a t e power l i m i t w i t h i n d u c t i v e
reactor
34 // t h r e e arms o f s t a r c o n n e c t e d r e a c t a n c e s a r e
35 Xa = Xdg + Xt + Xl ; // from g e n e r a t o r s i d e
36 Xb = Xdm + Xt ; // from l o a d s i d e
37 Xc = Xi ; // from r e a c t o r s i d e
38
39 // c o n v e r t i n g s t a r t o d e l t a
40 // r e a c t a n c e b e t w e e n g e n e r a t o r s i d e t o l o a d s i d e i s
41 Xab =( Xa * Xb + Xb * Xc + Xc * Xa ) / Xc ;
42 // power l i m i t i s
43 P3 =( abs ( Eg ) * abs ( Em ) ) /( abs ( Xab ) ) ;
44 printf ( \n\n S t e a d y s t a t e power l i m i t w i t h i n d u c t i v e
141
r e a c t o r = %0 . 5 f pu , P3 ) ;
1 // C h a p t e r 12
2 // Example 1 2 . 3
3 // p a g e 450
4 //To c a l c u l a t e maximum power t r a n s f e r r e d
5 clear ; clc ;
6
7 Vt =1.0; // g e n e r a t o r t e r m i n a l v o l t a g e
8 V =1.0 ; // i n f i n i t e bus v o l t a g e
9 Pe =1.0 ; // power d e l i v e r e d
10 Xd =0.25* %i ; // g e n e r a t o r s t r a n s i e n t r e a c t a n c e
11 Xl =0.5* %i ; // t r a n s m i s s i o n l i n e s r e a c t a n c e
12 Xt =0.1* %i ; // t r a n s f o r m e r s r e a c t a n c e
13
14 // t o c a l c u l a t e a l p h a
15 alpha = asind ( Pe * abs ( Xt + Xl /2) /( abs ( Vt ) * abs ( V ) ) ) ;
16 printf ( \n\ nAlpha=%0 . 1 f deg , alpha ) ;
17
18 // c u r r e n t t o i n f i n i t e bus
19 I =( Vt *( cosd ( alpha ) + %i * sind ( alpha ) ) -V ) /( Xt + Xl /2) ;
20 printf ( \ n C u r r e n t t o i n f i n t e bus=%d+j%0 . 3 f pu , real (
I ) , imag ( I ) ) ;
21
22 // v o t a g e b e h i n d t r a n s i e n t r e a c t a n c e
23 E = Vt + I *( Xd + Xt + Xl /2) ;
24 printf ( \ n V o l t a g e b e h i n d t r a n s i e n t r e a c t a n c e= E =
%0 . 3 f+j%0 . 1 f pu = %0 . 3 f @%0 . 1 f deg pu \n\n , real ( E
) , imag ( E ) , abs ( E ) , atand ( imag ( E ) / real ( E ) ) ) ;
142
25
26 delta =0:0.001:180;
27
28 // c a s e ( a ) Maximum power when s y s t e m i s h e a l t h y
29 X12 = Xd + Xt + Xl /2;
30 Pmax = abs ( V ) * abs ( E ) / abs ( X12 ) ;
31 Pe1 = Pmax * sind ( delta ) ;
32 printf ( Maximum power t h a t can be t r a n s f e r r e d u n d e r
the f o l l o w i n g condition i s )
33 printf ( \n\n ( a ) System H e a l t h y : ) ;
34 printf ( \nPmax=%0 . 2 f pu , Pmax ) ;
35 printf ( \ nPe=%0 . 2 f s i n ( d e l t a ) pu , Pmax ) ;
36
37 // c a s e ( b ) One l i n e s h o r t i n t h e m i d d l e
38 // c o n v e r t i n g b u s 3 t o d e l t a 4 0
39 Xa = Xd + Xt ; // g e n e r a t o r s i d e
40 Xb = Xl ; // h e a l t h y t r a n s m i s s i o n l i n e s i d e
41 Xc = Xl /2; // u n h e a l t h y l i n e s i d e
42 X12 =( Xa * Xb + Xb * Xc + Xc * Xa ) /( Xc ) ;
43 Pmax = abs ( V ) * abs ( E ) / abs ( X12 ) ;
44 Pe2 = Pmax * sind ( delta ) ;
45 printf ( \n\n ( b ) One l i n e s h o r t e d i n t h e m i d d l e : ) ;
46 printf ( \nPmax=%0 . 4 f pu , Pmax ) ;
47 printf ( \ nPe=%0 . 4 f s i n ( d e l t a ) pu , Pmax ) ;
48
49 // c a s e ( c ) One l i n e open
50 X12 = Xd + Xt + Xl ;
51 Pmax = abs ( V ) * abs ( E ) / abs ( X12 ) ;
52 Pe3 = Pmax * sind ( delta ) ;
53 printf ( \n\n ( c ) One l i n e open : ) ;
54 printf ( \nPmax=%0 . 4 f pu , Pmax ) ;
55 printf ( \ nPe=%0 . 4 f s i n ( d e l t a ) pu , Pmax ) ;
56
57 // p l o t t i n g Power a n g l e c u r v e s
58 plot ( delta , Pe1 , delta , Pe2 , delta , Pe3 ) ;
59 legend ([ 1 . 7 9 s i n ( d e l t a ) ; 0 . 6 9 4 s i n ( d e l t a ) ; 1 . 2 6 5 s i n
( d e l t a ) ]) ;
60 title ( Power a n g l e c u r v e s ) ;
143
Figure 12.1: Maximum Power Transferred
61 xlabel ( D e l t a ) ;
62 ylabel ( Pe ) ;
1 // C h a p t e r 12
2 // Example 1 2 . 4
3 // p a g e 453
144
4 //To c a l c u l a t e a c c e l e r a t i o n and r o t o r a n g l e
5 clear ; clc ;
6
7 delta0 =33.9; // i n i t i a l r o t o r a n g l e
8 H =4; // i n e r t i a c o n s t a n t
9 f =50; // f r e q u e n c y
10 Pm =1; // m e c h a n i c a l power i n p u t
11 t =0.05; // t i m e i n t e r v a l
12 angular_acceleration =( Pm -0.694* sind ( delta0 ) ) *180* f / H
;
13 delta_change =0.5* angular_acceleration * t ^2;
14 delta_new = delta0 + delta_change ;
15 new_angular_acceleration =( Pm -0.694* sind ( delta_new ) )
*180* f / H ;
16
17 printf ( \n\ n I n i t i a l r o t o r a n g u l a r a c c e l e r a t i o n = %d
e l e c t deg / s 2 , angular_acceleration ) ;
18 printf ( \ n D e l t a c h a n g e=%0 . 1 f deg , delta_change ) ;
19 printf ( \nNew d e l t a =d e l t a 1=%0 . 1 f deg , delta_new ) ;
20 printf ( \ n A n g u l a r a c c e l e r a t i o n a t t h e end o f 0 . 0 5 s =
%d e l e c t deg / s 2\ n\n , new_angular_acceleration ) ;
1 // C h a p t e r 12
2 // Example 1 2 . 5
3 // p a g e 456
4 //To c a l c u l a t e f r e q u e n c y o f natural o s c i l a t i o n s
5 clear ; clc ;
6
7 E =1.2; // no l o a d v o l t a g e
145
8 V =1; // i n f i n i t e bus v o l t a g e
9 Xg =1.2; // s y n c h r o n o u s g e n e r a t o r r e a c t a n c e
10 Xtl =0.6 // t r a n s f o r m e r a n f t r a n s m i s s i o n l i n e
reactance
11 H =4; // i n e r t i a c o n s t a n t
12
13 // c a s e ( i ) 50% l o a d i n g
14 delta0 = asind (0.5) ;
15 synchronizing_coefficien =( abs ( E ) * abs ( V ) * cosd ( delta0 )
) /( Xg + Xtl ) ;
16 M = H /( %pi *50) ;
17 p = %i * sqrt ( synchronizing_coefficien / M ) ;
18 f = abs ( p ) /(2* %pi ) ;
19 printf ( \n\ n c a s e ( i ) For 50%% l o a d i n g ) ;
20 printf ( \ n D e l t a 0=%d deg , delta0 ) ;
21 printf ( \ n s y n c h r o n i z i n g c o e f f i c i e n t =%0 . 3 f MW( pu ) /
e l e c t r a d , synchronizing_coefficien ) ;
22 printf ( \nM=%0 . 4 f s 2/ e l e c t r a d ,M ) ;
23 printf ( \ n F r e q u e n c y o f o s c i l l a t i o n s =%0 . 2 f r a d / s e c =
%0 . 3 f Hz\n , abs ( p ) ,f ) ;
24
25 // c a s e ( i ) 80% l o a d i n g
26 delta0 = asind (0.8) ;
27 synchronizing_coefficien =( abs ( E ) * abs ( V ) * cosd ( delta0 )
) /( Xg + Xtl ) ;
28 M = H /( %pi *50) ;
29 p = %i * sqrt ( synchronizing_coefficien / M ) ;
30 f = abs ( p ) /(2* %pi ) ;
31 printf ( \n\ n c a s e ( i i ) For 80%% l o a d i n g ) ;
32 printf ( \ n D e l t a 0=%d deg , delta0 ) ;
33 printf ( \ n S y n c h r o n i z i n g c o e f f i c i e n t =%0 . 3 f MW( pu ) /
e l e c t r a d , synchronizing_coefficien ) ;
34 printf ( \nM=%0 . 4 f s 2/ e l e c t r a d ,M ) ;
35 printf ( \ n F r e q u e n c y o f o s c i l l a t i o n s =%0 . 2 f r a d / s e c =
%0 . 3 f Hz\n , abs ( p ) ,f ) ;
146
Scilab code Exa 12.6 Steady State Power Limit 2
1 // C h a p t e r 12
2 // Example 1 2 . 6
3 // p a g e 457
4 //To f i n d s t e a d y s t a t e power l i m i t
5 clear ; clc ;
6
7 V =1.0; // i n f i n i t e bus v o l a t g e
8 Vt =1.2; // t e r m i n a l v o l a t g e
9 Xd =0.5* %i ; // s y n c h r o n o u s g e n e r a t o r r e a c t a n c e
10 X = %i ; // s e r i e s r e a c t a n c e
11 // by s o l v i n g t h e e x p r e s s i o n s g i v e n i n t h e t e x t b o o k
12 theta = acosd (0.5/1.8) ;
13 printf ( \n\ n t h e t a=%0 . 3 f deg , theta ) ;
14 Vt = Vt *( cosd ( theta ) + %i * sind ( theta ) ) ;
15 printf ( \ nVt=%0 . 3 f+j%0 . 3 f pu , real ( Vt ) , imag ( Vt ) ) ;
16 I =( Vt - V ) / X ;
17 printf ( \ n I=%0 . 3 f+j%0 . 3 f pu , real ( I ) , imag ( I ) ) ;
18 E = Vt + Xd * I ;
19 printf ( \nE=%0 . 3 f @ %d deg pu , abs ( E ) , atand ( imag ( E ) /
real ( E ) ) ) ;
20 Pmax =( abs ( E ) * abs ( V ) ) / abs ( X + Xd ) ;
21 printf ( \n\ n S t e a d y s t a t e power l i m i t i s g i v e n by : \
tPmax=%0 . 3 f pu , Pmax ) ;
22 E =1.2; Pmax =( abs ( E ) * abs ( V ) ) / abs ( X + Xd ) ;
23 printf ( \n\ n I f t h e g e n e r a t o r emf i s h e l d f i x e d a t a
v a l u e 1 . 2 pu , s t e a d y s t a t e power l i m i t would be : \ t
Pmax=%0 . 2 f pu \n\n , Pmax ) ;
147
Scilab code Exa 12.7 Critcal Clearing Angle
1 // C h a p t e r 12
2 // Example 1 2 . 7
3 // p a g e 475
4 //To c a l c u l a t e c r i t c a l clearing angle
5 clear ; clc ;
6
7 Xd =0.25; // d i r e c t a x i s t r a n s i e n t reactance of the
generator
8 Xl1 =0.5; Xl2 =0.4; // r e a c t a n c e s o f t r a n s m i s s i o n l i n e
9 E =1.2; // v o l t a g e b e h i n d t r a n s i e n t r e a c t a n c e
10 Xinf =0.05; // r e a c t n c e b e f o r e i n f i n i t e bus
11 V =1; // i n f i n i t e bus v o l t a g e
12 Pm =1; // m e c h a n i c a l i n p u t t o t h e g e n e r a t o r
13 delta =0:1:180;
14
15 // Normal o p e r a t i o n ( p r e f a u l t )
16 X1 = Xd +( Xl1 * Xl2 /( Xl1 + Xl2 ) ) + Xinf ; // e q u i v a l e n t
r e a c t a n c e b e t w e e n s e n d i n g e n e d and r e c e i v i n g end
17 // Power a n g l e e q u a t i o n b e f o r e t h e f a u l t i s
18 Pe1 =( E * V / X1 ) * sind ( delta ) ;
19 // p r e f a u l t o p e r a t i n g power =1.0 pu
20 delta0 = asin (1/ max ( Pe1 ) ) ;
21 printf ( Normal O p e r a t i o n ( p r e f a u l t ) : \ n ) ;
22 printf ( X1=%0 . 3 f PU\n , X1 ) ;
23 printf ( Pe1=%0 . 1 f s i n ( d e l t a ) \n\n , max ( Pe1 ) ) ;
24
25 // d u r i n g f a u l t t h e r e w i l l be no power t r a n s f e r
26 Pe2 =0;
148
27 printf ( D u r i n g F a u l t : \ n ) ;
28 printf ( Pe2=%d\n\n , Pe2 ) ;
29
30 // P o s t f a u l t o p e r a t i o n ( f a u l t c l e a r e d by o p e n i n g t h e
faulted line )
31 X3 = Xd + Xl1 + Xinf ;
32 Pe3 =( E * V / X3 ) * sind ( delta ) ;
33 delta_max = %pi - asin ( Pm / max ( Pe3 ) ) ;
34 // from A1 and A2 , we s o l v e A1=A2
35 deff ( [ y ]= f x ( d e l t a c r ) , y =1.5 c o s ( d e l t a c r )+
d e l t a c r 1.293 Pm ( d e l t a c r d e l t a 0 ) ) ;
36 delta_cr = fsolve (0.45 , fx ) ;
37 printf ( P o s t f a u l t o p e r a t i o n ( f a u l t c l e a r e d by
opening the f a u l t e d l i n e ) : \ n );
38 printf ( X3=%0 . 1 fPU\n , X3 ) ;
39 printf ( Pe3=%0 . 1 f s i n ( d e l t a ) \n , max ( Pe3 ) ) ;
40 printf ( D e l t a c r=%0 . 4 f r a d =%0 . 2 f deg , delta_cr ,
delta_cr *180/ %pi ) ;
41 plot ( delta , Pe1 , delta , Pe3 , delta , Pm * ones (1 , length (
delta ) ) ) ;
42 legend ( Pe1 =2.3 s i n ( d e l t a ) , Pe3 =1.5 s i n ( d e l t a ) , Pm=1
);
43 title ( Power a n g l e Diagram f o r e x a m p l e 1 2 . 7 ) ;
44 xlabel ( d e l t a ( i n d e g r e e s )&g t ; ) ;
45 ylabel ( E l e c t r i c a l o u t p u t ( Pe )&g t ; ) ;
1 // C h a p t e r 12
149
Figure 12.2: Critcal Clearing Angle
150
2 // Example 1 2 . 8
3 // p a g e 477
4 //To c a l c u l a t e c r i t c a l clearing angle
5 clear ; clc ;
6
7 Xd =0.25; // d i r e c t a x i s t r a n s i e n t reactance of the
generator
8 Xl1 =0.28; Xl2_1 =0.14; Xl2_2 =0.14; // r e a c t a n c e s of
transmission line
9 E =1.2; // v o l t a g e b e h i n d t r a n s i e n t r e a c t a n c e
10 Xinf =0.17; // r e a c t n c e b e f o r e i n f i n i t e bus
11 V =1; // i n f i n i t e bus v o l t a g e
12 Pm =1; // m e c h a n i c a l i n p u t t o t h e g e n e r a t o r
13 Xtr =0.15; // t r a n s f o r m e r r e a c t a n c e
14 delta =0:1:180;
15
16 // p r e f a u l t o p e r a t i o n
17 X1 = Xd + Xinf +( Xtr + Xl1 + Xtr ) /2; // t r a n s f e r r e a c t a n c e
b e t w e e n g e n e r a t o r and i n f i n t e bus
18 Pe1 = E * V * sind ( delta ) / X1 ;
19 delta0 = asin (1/ max ( Pe1 ) ) ;
20 printf ( Normal O p e r a t i o n ( p r e f a u l t ) : \ n ) ;
21 printf ( X1=%0 . 3 f PU\n , X1 ) ;
22 printf ( Pe1=%0 . 2 f s i n ( d e l t a ) \n , max ( Pe1 ) ) ;
23 printf ( d e l t a 0=%0 . 3 fPU\n\n , delta0 ) ;
24 // d u r i n g f a u l t t h e r e w i l l be no power t r a n s f e r
25 // u s i n g s t a r d e l t a t r a n s f o r m a t i o n g i v e n i n t h e
textbook
26 X2 =2.424;
27 Pe2 = E * V * sind ( delta ) / X2 ;
28 printf ( D u r i n g F a u l t : \ n ) ;
29 printf ( X2=%0 . 3 f PU\n , X2 ) ;
30 printf ( Pe2=%0 . 3 f s i n ( d e l t a ) \n\n , max ( Pe2 ) ) ;
31
32 // P o s t f a u l t o p e r a t i o n ( f a u l t y l i n e switched o f f )
33 X3 = Xd + Xinf +( Xtr + Xl1 + Xtr ) ;
34 Pe3 = E * V * sind ( delta ) / X3 ;
35 delta_max = %pi - asin ( Pm / max ( Pe3 ) ) ;
151
36 // from A1 and A2 , we s o l v e A1=A2
37 deff ( [ y ]= f x ( d e l t a c r ) , y=d e l t a 0+max ( Pe2 ) c o s (
d e l t a c r ) 0.399 0.661 max ( Pe3 ) c o s ( d e l t a c r )+
delta max );
38 delta_cr = fsolve (0.45 , fx ) ;
39 printf ( P o s t f a u l t o p e r a t i o n ( f a u l t y l i n e s w i t c h e d
o f f ) : \ n );
40 printf ( X3=%0 . 1 fPU\n , X3 ) ;
41 printf ( Pe3=%0 . 1 f s i n ( d e l t a ) \n , max ( Pe3 ) ) ;
42 printf ( D e l t a c r=%0 . 4 f r a d =%0 . 2 f deg , delta_cr ,
delta_cr *180/ %pi ) ;
43 plot ( delta , Pe1 , delta , Pe2 , delta , Pe3 , delta , Pm ) ;
44 legend ( Pe1 =1.69 s i n ( d e l t a ) , Pe2 = 0 . 4 9 5 s i n ( d e l t a ) ,
Pe3 =1.2 s i n ( d e l t a ) , Pm=1 ) ;
45 title ( Power a n g l e Diagram f o r e x a m p l e 1 2 . 8 ) ;
46 xlabel ( d e l t a ( i n d e g r e e s )> ) ;
47 ylabel ( E l e c t r i c a l o u t p u t ( Pe )> ) ;
48 f = get ( c u r r e n t f i g u r e )
49 f . figure_position =[0 ,15]
50 f . figure_size =[750 ,750]
1 // C h a p t e r 12
2 // Example 1 2 . 9
3 // p a g e 479
4 //To c a l c u l a t e c r i t c a l c l e a r i n g a n g l e
5 clear ; clc ;
6 Pmax1 =2; // p r e f a u l t ( 2 l i n e s )
152
Figure 12.3: Critcal Clearing Angle 2
153
7 Pmax2 =0.5; // d e u r i n g f a u l t
8 Pmax3 =1.5; // p o s t f a u l t ( 1 l i n e )
9 Pm =1; // i n i t i a l l o a d i n g
10
11 delta0 = asin ( Pm / Pmax1 ) ;
12 delta_max = %pi - asin ( Pm / Pmax3 ) ;
13
14 // t o f i n d c r i t i c a l a n g l e , u s i n g eq . 1 2 . 6 7
15 delta_cr = acos (( Pm *( delta_max - delta0 ) - Pmax2 * cos (
delta0 ) + Pmax3 * cos ( delta_max ) ) /( Pmax3 - Pmax2 ) ) ;
16 printf ( Pmax1=%0 . 1 f PU\ t Pmax2=%0 . 2 f PU\ t Pmax3=%0 . 2
f PU\n\n , Pmax1 , Pmax2 , Pmax3 ) ;
17 printf ( D e l t a 0=%0 . 3 f r a d \n\n , delta0 ) ;
18 printf ( D e l t a m a x=%0 . 3 f r a d \n\n , delta_max ) ;
19 printf ( D e l t a c r=%0 . 3 f r a d =%0 . 2 f deg \n\n , delta_cr ,
delta_cr *180/ %pi ) ;
Scilab code Exa 12.10 Swing Curves For Sustained Fault and Cleared
Fault at the Specified Time
Swing Curves For Sustained Fault and Cleared Fault at the Specified Time
1 // C h a p t e r 12
2 // Example 1 2 . 1 0
3 // p a g e 482
4 //To p l o t s w i n g c u r v e s f o r s u s t a i n e d f a u l t and f a u l t
c l e a r e d a t 2 . 5 and 6 . 2 5 c y c l e s
5 clear ; clc ;
6 P_delivered =18;
7 MVA_base =20;
8 Xd =0.35; E =1.1;
9 Xl =0.2;
10 V =1;
154
11
12 H =2.52;
13 f =50;
14 M = H /(180* f ) ;
15
16 // / / / / / / / P r e f a u l t / / / / / / / / / / / / / / / / / / / / / / / / / /
17 X1 = Xd + Xl /2;
18 delta =0:0.1:180;
19 Pe1 = E * V * sind ( delta ) / X1 ;
20 P_initial = P_delivered / MVA_base ; Pm = P_initial ;
21 delta0 = asind ( P_initial / max ( Pe1 ) ) ;
22
23
24 // / / / / d u r i n g f a u l t / / / / / / / /
25 X2 =1.25; // from d e l t a t o s t a r c o n v e r s i o n
26 Pe2 = E * V * sind ( delta ) / X2 ;
27
28 // / / / / p o s t f a u l t : w i t h f a u l t e d l i n e s w i t c h e d o f f
/////////
29 X3 = Xd + Xl ;
30 Pe3 = E * V * sind ( delta ) / X3 ;
31
32 Pa_0minus =0;
33 Pa_0plus = Pm - max ( Pe2 ) * sind ( delta0 ) ;
34 Pa_avg =( Pa_0minus + Pa_0plus ) /2;
35
36
37 // /// f o r a s u s t a i n e d f a u l t / / / / / / / / / / /
38 P_max = max ( Pe2 ) ;
39 delta_delta =0; // i n i t i a l l y
40 delta =21.64; // i n i t i a l l y
41 delta_old =21.64;
42 delta_t =0.05;
43 z1 =21.64
44 n =10;
45 T =0;
46 printf ( P o i n t byp o i n t c a l c u l a t i o n o f s w i n g c u r v e
f o r s u s t a i n e d f a u l t d e l t a t =0.05 s e c \n ) ;
155
47 printf (
\n ) ;
48 printf ( t \ t \tPmax\ t \ t s i n ( d e l t a ) \ t \ tPa \ t \ t y \ t \
t d e l t a \n ) ;
49 printf (
\n ) ;
50 printf ( %0 . 3 f s e c \ t%0 . 3 f \ t \ t %0 . 3 f \ t \ t \ t%0 . 3 f \ t \ t%0
. 3 f \ t \ t%0 . 3 f \n ,0.000 , P_max , sind ( delta ) ,(0.9 -
P_max * sind ( delta ) ) /2 ,8.929*(0.9 - P_max * sind ( delta )
) /2 , delta ) ;
51 for i =1: n
52 t = i * delta_t ;
53 if i ==1 then
54 Pa =(0.9 - P_max * sind ( delta_old ) ) /2;
55 else
56 Pa =0.9 - P_max * sind ( delta_old ) ;
57 end
58
59 y =( delta_t ^2) * Pa / M ;
60 delta_delta = delta_delta + y ;
61 delta = delta + delta_delta ;
62 z1 =[ z1 , delta ]; T =[ T , t ];
63 printf ( %0 . 3 f s e c \ t%0 . 3 f \ t \ t %0 . 3 f \ t \ t \ t%0 . 3 f \ t \
t%0 . 3 f \ t \ t%0 . 3 f \n ,t , P_max , sind ( delta ) ,0.9 -
P_max * sind ( delta ) ,8.929*(0.9 - P_max * sind ( delta
) ) , delta ) ;
64 delta_old = delta ;
65 end
66
67
68 // / / / / F a u l t c l e a r e d in 2 . 5 c y c l e s ( time to c l e a r
f a u l t =0.05 s e c ) / / / / /
69
70 P_max1 = max ( Pe2 ) ;
71 P_max2 = max ( Pe3 ) ;
72 delta_delta =0; // i n i t i a l l y
156
73 delta =21.64; // i n i t i a l l y
74 delta_old =21.64;
75 delta_t =0.05;
76 z2 =21.64
77 n =10;
78 T =0;
79 printf ( \n\ n C o m p u t a t i o n s o f s w i n g c u r v e s for fault
c l e a r e d a t 2 . 5 c y c l e s ( 0 . 0 5 s e c ) \n ) ;
80 printf (
\n ) ;
81 printf ( t \ t \tPmax\ t \ t s i n ( d e l t a ) \ t \ tPa \ t \ t y \ t \
t d e l t a \n ) ;
82 printf (
\n ) ;
83 printf ( %0 . 3 f s e c \ t%0 . 3 f \ t \ t %0 . 3 f \ t \ t \ t%0 . 3 f \ t \ t%0
. 3 f \ t \ t%0 . 3 f \n ,0.000 , P_max , sind ( delta ) ,(0.9 -
P_max * sind ( delta ) ) /2 ,8.929*(0.9 - P_max * sind ( delta )
) /2 , delta ) ;
84 for i =1: n
85 t = i * delta_t ;
86 if i ==1 then
87 Pa =(0.9 - P_max * sind ( delta_old ) ) /2;
88 P_max = P_max1 ;
89 elseif i ==2 then
90 Pa =((0.9 - P_max2 * sind ( delta_old ) ) +((0.9 -
P_max1 * sind ( delta_old ) ) ) ) /2;
91 P_max = P_max2 ;
92 else
93 Pa =0.9 - P_max2 * sind ( delta_old ) ;
94 P_max = P_max2 ;
95 end
96
97 y =( delta_t ^2) * Pa / M ;
98 delta_delta = delta_delta + y ;
99 delta = delta + delta_delta ;
100 z2 =[ z2 , delta ]; T =[ T , t ];
157
101
102 if i ==1 then
103 delta_old = delta ;
104 printf ( %0 . 3 f s e c \ t%0 . 3 f \ t \ t %0 . 3 f \ t \ t \ t%0 . 3 f \
t \ t%0 . 3 f \ t \ t%0 . 3 f \n ,t , P_max , sind ( delta )
,((0.9 - P_max2 * sind ( delta_old ) ) +((0.9 - P_max1
* sind ( delta_old ) ) ) ) /2 ,8.929*((0.9 - P_max2 *
sind ( delta_old ) ) +((0.9 - P_max1 * sind (
delta_old ) ) ) ) /2 , delta ) ;
105 else
106 printf ( %0 . 3 f s e c \ t%0 . 3 f \ t \ t %0 . 3 f \ t \ t \ t%0 . 3
f \ t \ t%0 . 3 f \ t \ t%0 . 3 f \n ,t , P_max , sind ( delta
) ,0.9 - P_max * sind ( delta ) ,8.929*(0.9 - P_max *
sind ( delta ) ) , delta ) ;
107 delta_old = delta ;
108 end
109
110 end
111
112
113
114 // / / / / F a u l t c l e a r e din 6.25 c y c l e s ( time to c l e a r
f a u l t =0.125 s e c ) /////
115
116 P_max1 = max ( Pe2 ) ;
117 P_max2 = max ( Pe3 ) ;
118 P_max = P_max1 ;
119 delta_delta =0; // i n i t i a l l y
120 delta =21.64; // i n i t i a l l y
121 delta_old =21.64;
122 delta_t =0.05;
123 z3 =21.64
124 n =10;
125 T =0;
126 printf ( \n\ n C o m p u t a t i o n s o f s w i n g c u r v e s for fault
c l e a r e d a t 6 . 2 5 c y c l e s ( 0 . 1 2 5 s e c ) \n ) ;
127 printf (
158
\n ) ;
128 printf ( t \ t \tPmax\ t \ t s i n ( d e l t a ) \ t \ tPa \ t \ t y \ t \
t d e l t a \n ) ;
129 printf (
\n ) ;
130 printf ( %0 . 3 f s e c \ t%0 . 3 f \ t \ t %0 . 3 f \ t \ t \ t%0 . 3 f \ t \ t%0
. 3 f \ t \ t%0 . 3 f \n ,0.000 , P_max , sind ( delta ) ,(0.9 -
P_max * sind ( delta ) ) /2 ,8.929*(0.9 - P_max * sind ( delta )
) /2 , delta ) ;
131 for i =1: n
132 t = i * delta_t ;
133 if i ==1 then
134 Pa =(0.9 - P_max1 * sind ( delta_old ) ) /2;
135 P_max = P_max1 ;
136 elseif i ==2 then
137 Pa =(0.9 - P_max1 * sind ( delta_old ) ) ;
138 P_max = P_max1 ;
139 elseif i ==3 then
140 Pa =(0.9 - P_max1 * sind ( delta_old ) ) ;
141 P_max = P_max2 ;
142 else
143 Pa =0.9 - P_max2 * sind ( delta_old ) ;
144 P_max = P_max2 ;
145 end
146
147 y =( delta_t ^2) * Pa / M ;
148 delta_delta = delta_delta + y ;
149 delta = delta + delta_delta ;
150 z3 =[ z3 , delta ];
151 T =[ T , t ];
152 printf ( %0 . 3 f s e c \ t%0 . 3 f \ t \ t %0 . 3 f \ t \ t \ t%0 . 3 f \ t \
t%0 . 3 f \ t \ t%0 . 3 f \n ,t , P_max , sind ( delta ) ,0.9 -
P_max * sind ( delta ) ,8.929*(0.9 - P_max * sind ( delta
) ) , delta ) ;
153 delta_old = delta ;
154
155 end
159
156
157 plot (T , z1 ,T , z2 ,T , z3 ) ;
158 set ( gca () , g r i d ,[1 1]) ;
159 legend ( S u s t a i n e d F a u l t , F a u l t c l e a r e d a t 2 . 5
c y c l e s , F a u l t c l e a r e d a t 6 . 2 5 c y c l e s ,[ ,2]) ;
160
161 title ( Swing C u r v e s f o r Example 1 2 . 1 0 f o r a
s u s t a i n e d f a u l t and f o r c l e a r i n g i n 2 . 5 and 6 . 2 5
c y c l e s , f o n t s i z e ,2.4) ;
162 xlabel ( Time ( i n s e c o n d s )> ) ;
163 ylabel ( Torque A n g l e ( d e l t a , deg )> ) ;
164 f = get ( c u r r e n t f i g u r e )
165 f . figure_position =[0 ,15]
166 f . figure_size =[645 ,1000]
1 // C h a p t e r 12
2 // Example 1 2 . 1 1
3 // p a g e 488
4 //To p l o t s w i n g c u r v e s f o r f a u l t c l e a r e d a t 0 . 2 7 5 s
and 0 . 0 8 s o f a m u l t i m a c h i n e s y s t e m
5 clear ; clc ;
6
7 xd1 = %i *0.067; xd2 = %i *0.1;
8
9 // p r i m i t i v e a d m i t t a n c e s o f t h e l i n e s
10 y45 =1/(0.018+ %i *0.11) ; B45 = %i *0.113;
11 y51 =1/(0.004+ %i *0.0235) ; B51 = %i *0.098;
160
Figure 12.4: Swing Curves For Sustained Fault and Cleared Fault at the
Specified Time
161
12 y41 =1/(0.007+ %i *0.04) ; B41 = %i *0.041;
13 z24 =( %i *0.022) ;
14 z35 =( %i *0.04) ;
15
16 // Bus d a t a and p r e f a u l t l o a d f l o w v a l u e s i n PU
17 V1 =1.0; P1 = -3.8083; Q1
= -0.2799; Pl1 =0; Ql2 =0;
18 V2 =1.0194+ %i *0.1475; P2 =3.25; Q2 =0.6986;
Pl2 =0; Ql2 =0;
19 V3 =1.0121+ %i *0.1271; P3 =2.10; Q3 =0.3110;
Pl3 =0; Ql3 =0;
20 V4 =1.0146+ %i *0.0767; P4 =0; Q4 =1.0;
Pl4 =1.0; Ql4 =0.44;
21 V5 =1.0102+ %i *0.0439; P5 =0; Q5 =0;
Pl5 =0.5; Ql5 =0.16;
22
23
24 // To f i n d v o l t a g e b e h i n d t r a n s i e n t r e a c t a n c e s
b e f o r e the occurance of f a u l t
25
26 I2 =( P2 - %i * Q2 ) /( V2 ) ;
27 E2 = V2 + I2 * xd1 ;
28 E1 = V1 ;
29 I3 =( P3 - %i * Q3 ) /( V3 ) ;
30 E3 = V3 + I3 * xd2 ;
31
32 // c o n v e r t i n g l o a d s i n t o t h e i r a d m i t t a n c e s
33 Yl4 =( Pl4 - %i * Ql4 ) /( V4 * V4 ) ;
34 Yl5 =( Pl5 - %i * Ql5 ) /( V5 * V5 ) ;
35
36 // f o r m i n g augmented Bus a d m i t t a n c e m a t r i x b e f o r e t h e
occurance of f a u l t
37 Y11 = y41 + y51 ; Y12 =0; Y13 =0; Y14 = - y41 ; Y15 = - y51 ;
38 Y21 = Y12 ; Y22 =1/( xd1 + z24 ) ; Y23 =0; Y24 = -(1/( z24 + xd1 ) ) ; Y25
=0;
39 Y31 =0; Y32 =0; Y33 =1/( z35 + xd2 ) ; Y34 =0; Y35 = -1/( z35 + xd2 ) ;
40 Y41 = Y14 ; Y42 = Y24 ; Y43 = Y34 ; Y44 = y41 + Yl4 + y45 + B45 + B41 - Y24 ;
Y45 = - y45 ;
162
41 Y51 = Y15 ; Y52 = Y25 ; Y53 = Y35 ; Y54 = Y45 ; Y55 = Yl5 + y45 + y51 + B45 +
B51 - Y35 ;
42
43 Ybus =[ Y11 Y12 Y13 Y14 Y15 ;
44 Y21 Y22 Y23 Y24 Y25 ;
45 Y31 Y32 Y33 Y34 Y35 ;
46 Y41 Y42 Y43 Y44 Y45 ;
47 Y51 Y52 Y53 Y54 Y55 ];
48
49 printf ( \n Augmented p r e f a u l t bus a d m i t t a n c e m a t r i x
( i n PU) i s g i v e n by \n\n Ybus=\n ) ;
50 disp ( Ybus ) ;
51 // / / / / / t o f i n d t h e Ybus d u r i n g f a u l t
52 Ybus_1 = Ybus ([1:3 ,5] ,[1:3 ,5]) ;
53 n =4
54 for k =1: n -1
55 for j =1: n -1
56 Ybus_during_fault (k , j ) = Ybus_1 (k , j ) -( Ybus_1 (k
, n ) * Ybus_1 (n , j ) ) / Ybus_1 (n , n ) ;
57 end
58 end
59 printf ( \n\n\n Bus a d m i t t a n c e m a t r i x d u r i n g f a u l t (
i n PU) i s g i v e n by \n\n Y b u s d u r i n g f a u l t =\n ) ;
60 disp ( Ybus_during_fault ) ;
61
62 // t o f i n d Ybus a f t e r t h e f a u l t h a s b e e n c l e a r e d
63 Y45 =0; Y54 =0; Y44 = Y44 - y45 - B45 ; Y55 = Y55 - y45 - B45 ;
64 Ybus_2 =[ Y11 Y12 Y13 Y14 Y15 ;
65 Y21 Y22 Y23 Y24 Y25 ;
66 Y31 Y32 Y33 Y34 Y35 ;
67 Y41 Y42 Y43 Y44 Y45 ;
68 Y51 Y52 Y53 Y54 Y55 ];
69
70 // e l i m i n a t i n g node 5 from Ybus 2
71 n =5
72 for k =1: n -1
73 for j =1: n -1
74 Ybus_3 (k , j ) = Ybus_2 (k , j ) -( Ybus_2 (k , n ) * Ybus_2 (
163
n , j ) ) / Ybus_2 (n , n ) ;
75 end
76 end
77
78 // e l i m i n a t i n g node 4 t o g e t p o s t f a u l t Ybus
79 n =4
80 for k =1: n -1
81 for j =1: n -1
82 Ybus_post_fault (k , j ) = Ybus_3 (k , j ) -( Ybus_3 (k , n
) * Ybus_3 (n , j ) ) / Ybus_3 (n , n ) ;
83 end
84 end
85 printf ( \n\n\n Bus a d m i t t a n c e m a t r i x postfault ( in
PU) i s g i v e n by \n\n Y b u s p o s t f a u l t =\n ) ;
86 disp ( Ybus_post_fault ) ;
87 printf ( \n\n\n ) ;
88 // D u r i n g f a u l t power a n g l e e q u a t i o n
89 delta3 =0:0.1:180;
90 Pe2f =0;
91 Pe3f =( abs ( E3 ) ) ^2* real ( Ybus_during_fault (3 ,3) ) + abs (
E1 ) * abs ( E3 ) * abs ( Ybus_during_fault (3 ,1) ) * cosd (
delta3 - atand ( imag ( Ybus_during_fault (1 ,3) ) / real (
Ybus_during_fault (1 ,3) ) ) ) ;
92
93 // P o s t f a u l t power a n g l e e q u a t i o n s
94 delta2 =0:0.1:180;
95 Pe2pf =( abs ( E2 ) ) ^2* real ( Ybus_post_fault (2 ,2) ) + abs ( E1
) * abs ( E2 ) * abs ( Ybus_post_fault (2 ,1) ) * cosd ( delta2
- atand ( imag ( Ybus_post_fault (1 ,2) ) / real (
Ybus_post_fault (1 ,2) ) ) ) ;
96 Pe3pf =( abs ( E3 ) ) ^2* real ( Ybus_post_fault (3 ,3) ) + abs ( E1
) * abs ( E3 ) * abs ( Ybus_post_fault (3 ,1) ) * cosd ( delta3
- atand ( imag ( Ybus_post_fault (1 ,3) ) / real (
Ybus_post_fault (1 ,3) ) ) ) ;
97
98 // m e c h a n i c a l i n p u t s which a r e assumed t o be c o n s t a n t
a r e g i v e n by
99 Pm2 = max ( real ( E2 * I2 ) ) ;
164
100 Pm3 = max ( real ( E3 * I3 ) ) ;
101
102 // x d o t f u n c t i o n d e f i n i n g t h e s w i n g e q u a t i o n s o f each
o f the machines
103 function xdot = mac2 (t ,x , tc )
104 xdot (1) = x (2) ;
105 if t > tc then
106 xdot (2) =180*50*( Pm2 -(0.6012+8.365* sind ( x (1)
-1.662) ) ) /12; // s w i n g e q u a t i o n a f t e r
c l e a r i n g the f a u l t
107 else
108 xdot (2) =180*50*( Pm2 -(0) ) /12; // s w i n g
equation b e f o r e c l e a r i n g the f a u l t
109 end
110
111 endfunction
112
113 function xdot = mac3 (t ,x , tc )
114 xdot (1) = x (2) ;
115 if t > tc then
116 xdot (2) =180*50*( Pm3 -(0.1823+6.5282* sind ( x (1)
-0.8466) ) ) /9; // s w i n g e q u a t i o n a f t e r
c l e a r i n g the f a u l t
117 else
118 xdot (2) =180*50*( Pm3 -(0.1561+5.531* sind ( x (1)
-0.755) ) ) /9; // s w i n g e q u a t i o n b e f o r e
c l e a r i n g the f a u l t
119 end
120
121 endfunction
122
123 // t o f i n d t h e s o l u t i o n o f s w i n g e q u a t i o n t o draw t h e
swing curves
124
125 // t o draw t h e s w i n g c u r v e s f o r m a c h i n e s 2 and 3 f o r
example12 . 1 1 f o r c l e a r i n g at 0 . 2 7 5 s e c
126 subplot (2 ,1 ,1)
127 x_1_0 =[19.354398 ,0] ; t0 =0; T =0:0.01:1; T =T ;
165
128 x_2_0 =[18.2459 ,0] ; tc =0.275;
129 sol1 = ode ( x_1_0 , t0 ,T , mac2 ) ;
130 sol2 = ode ( x_2_0 , t0 ,T , mac3 ) ;
131
132 plot ( T (1:20) , sol1 (1 ,1:20) ,T , sol2 (1 ,:) ) ;
133 set ( gca () , g r i d ,[1 1]) ;
134 legend ( Machine 2 , Machine 3 ,[ ,1]) ;
135 title ( Swing C u r v e s f o r m a c h i n e s 2 and 3 o f Example
1 2 . 1 1 f o r a c l e a r i n g a t + string ( tc ) + s ) ;
136 xstring (0.55 ,59 , Machine 1 i s r e f e r e n c e ( i n f i n t e bus
) );
137 xlabel ( Time ( i n s e c o n d s )> ) ;
138 ylabel ( Torque A n g l e ( d e l t a , deg )> ) ;
139
140
141 // t o draw t h e s w i n g c u r v e s f o r m a c h i n e s 2 and 3 f o r
example12 . 1 1 f o r c l e a r i n g at 0 . 0 8 s e c
142 subplot (2 ,1 ,2)
143 x_1_0 =[19.354398 ,0] ; t0 =0; T =0:0.01:1; T =T ;
144 x_2_0 =[18.2459 ,0] ; tc =0.08;
145 sol1 = ode ( x_1_0 , t0 ,T , mac2 ) ;
146 sol2 = ode ( x_2_0 , t0 ,T , mac3 ) ;
147
148 plot (T , sol1 (1 ,:) ,T , sol2 (1 ,:) ) ;
149 set ( gca () , g r i d ,[1 1]) ;
150 legend ( Machine 2 , Machine 3 ,[ ,4]) ;
151 title ( Swing C u r v e s f o r m a c h i n e s 2 and 3 o f Example
1 2 . 1 1 f o r a c l e a r i n g a t + string ( tc ) + s ) ;
152 xstring (0.44 ,43 , Machine 1 i s r e f e r e n c e ( i n f i n t e bus
) );
153 xlabel ( Time ( i n s e c o n d s )> ) ;
154 ylabel ( Torque A n g l e ( d e l t a , deg )> ) ;
155
156 f = get ( c u r r e n t f i g u r e ) ;
157 f . figure_position =[0 ,15];
158 f . figure_size =[565 ,1000];
166
Scilab code Exa 12.12 Swing Curves For Three Pole and Single Pole Switch-
ing
1 // C h a p t e r 12
2 // Example 1 2 . 1 2
3 // p a g e 500
4 //To p l o t s w i n g c u r v e s f o r s i n g l e p o l e and t h r e e
pole switching
5 clear ; clc ;
6
7 Xg0 =0.1; Xg1 =0.3; Xg2 =0.15; E =1.2; H =4.167;
8 Xt =0.1;
9 Xl0 =1.0; Xl1 =0.3; Xl2 =0.3; V =1;
10
11 // t r a n s f e r r e a c t a n c e d u r i n g LG f a u l t ( f a u l t n o t
c l e a r e d ) by s t a r d e l t a t r a n s f o r m a t i o n i s g i v e n by
12 X12_fault =1.45;
13
14 // t r a n s f e r r e a c t a n c e a f t e r LG f a u l t e d l i n e open i s
g i v e n by
15 X12_fault_open =1.22;
16
17 // t r a n s f e r r e a c t a n c e when a l l t h e l i n e s a r e h e a l t h y
i s g i v e n by
18 X12_healthy =0.8;
19
20 // power a n g l e e q u a t i o n s
21 delta =0:0.1:180;
167
Figure 12.5: Swing Curves For Multimachines
168
22
23 // P r e f a u l t c o n d i t i o n
24 Pe1 =( E * V ) * sind ( delta ) / X12_healthy ;
25 // f o r an i n i t i a l l o a d o f 1PU
26 delta0 = asind (1/1.5) ;
27
28 // d u r i n g f a u l t
29 Pe2 =( E * V ) * sind ( delta ) / X12_fault ;
30
31 // d u r i n g s i n g l e p o l e s w i t c h i n g
32 Pe3 =( E * V ) * sind ( delta ) / X12_fault_open ;
33
34 // d u r i n g t h r e e p o l e s w i t c h i n g
35 Pe4 =0;
36
37 // a f t e r r e c l o s u r e
38 Pe5 = Pe1 ;
39
40 Pm =1.0;
41
42 // x d o t f u n c t i o n d e f i n i n g t h e s w i n g e q u a t i o n s o f
machine d u r i n g s i n g l e p o l i n g
43 function xdot = mac_1_pole (t ,x , tc , tr )
44 xdot (1) = x (2) ;
45 if (t <= tc ) then
46 xdot (2) =180*50*( Pm -(0.827* sind ( x (1) ) ) ) /12; //
swing equation b e f o r e c l e a r i n g the f a u l t e d
line
47 elseif (t > tc ) &( t < tr ) then
48 xdot (2) =180*50*( Pm -(0.985* sind ( x (1) ) ) ) /12; //
swing equation during s i n g l e pole s w i t c h i n g
49 elseif (t >= tr ) then
50 xdot (2) =180*50*( Pm -(1.5* sind ( x (1) ) ) ) /12; //
after reclosure
51 end
52 endfunction
53
54 // x d o t f u n c t i o n d e f i n i n g t h e s w i n g e q u a t i o n s o f
169
machine d u r i n g t h r e e p o l i n g
55 function xdot = mac_3_pole (t ,x , tc , tr )
56 xdot (1) = x (2) ;
57 if (t > tc ) &( t < tr ) then
58 xdot (2) =180*50*( Pm -0) /4.167; // s w i n g e q u a t i o n
during three pole switching
59 elseif (t <= tc ) then
60 xdot (2) =180*50*( Pm -(0.827* sind ( x (1) ) ) ) /4.167;
// s w i n g e q u a t i o n b e f o r e c l e a r i n g t h e
faulted line
61 elseif (t >= tr ) then
62 xdot (2) =180*50*( Pm -(1.5* sind ( x (1) ) ) ) /4.167; //
after reclosure
63 end
64 endfunction
65
66 // t o f i n d t h e s o l u t i o n o f s w i n g e q u a t i o n t o draw t h e
swing curves
67
68 // t o draw t h e s w i n g c u r v e s f o r t h r e e p o l e s w i t c h i n g
with r e c l o s u r e
69 subplot (2 ,1 ,1)
70 x_1_0 =[41.8 ,0] ; t0 =0; T =0:0.001:0.65; T =T ;
71 tc =0.075; tr =0.325;
72 sol1 = ode ( x_1_0 , t0 ,T , mac_3_pole ) ;
73 plot (T , sol1 (1 ,:) ) ;
74 set ( gca () , g r i d ,[1 1]) ;
75 title ( Swing Curve f o r t h r e e p o l e s w i t c h i n g a t +
string ( tc ) + s + and r e c l o s u r e a t + string ( tr ) +
s , f o n t s i z e ,3) ;
76 xset ( f o n t s i z e ,3)
77 xstring (0.2 ,300 , MACHINE UNSTABLE ) ;
78 xlabel ( Time ( i n s e c o n d s )> ) ;
79 ylabel ( Torque A n g l e ( d e l t a , deg )> ) ;
80
81 // t o draw t h e s w i n g c u r v e s f o r s i n g l e p o l e s w i t c h i n g
with r e c l o s u r e
82 subplot (2 ,1 ,2)
170
83 x_1_0 =[41.8 ,0] ; t0 =0; T =0:0.001:2.2; T =T ;
84 tc =0.075; tr =0.325;
85 sol2 = ode ( x_1_0 , t0 ,T , mac_1_pole ) ;
86 plot (T , sol2 (1 ,:) ) ;
87 set ( gca () , g r i d ,[1 1]) ;
88 title ( Swing Curve f o r s i n g l e p o l e s w i t c h i n g a t +
string ( tc ) + s + and r e c l o s u r e a t + string ( tr ) +
s , f o n t s i z e ,3) ;
89 xset ( f o n t s i z e ,3)
90 xstring (1.2 ,50 , MACHINE STABLE ) ;
91 xlabel ( Time ( i n s e c o n d s )> ) ;
92 ylabel ( Torque A n g l e ( d e l t a , deg )> ) ;
93
94 f = get ( c u r r e n t f i g u r e ) ;
95 f . figure_position =[0 ,15];
96 f . figure_size =[560 ,1000];
171
Figure 12.6: Swing Curves For Three Pole and Single Pole Switching
172
Chapter 13
Scilab code Exa 13.1 Generation Shift Factors and Line Outage Distribu-
tion Factors
1 // C h a p t e r 13
2 // Example 1 3 . 1
3 // p a g e 522
4 //To f i n d t h e g e n e r a t i o n s h i f t f a c t o r s and t h e l i n e
outage d i s t r i b u t i o n f a c t o r s
5 clear ; clc ;
6
7 // t h i s p r o b l e m can be t h o u g h t t o be s o l v e d by u s i n g
g a u s s s i e d e l method u s i n g Zbus (X m a t r i x g i v e n i n
t a b l e 1 3 . 1 ) , but t h e n i n t h i s method we n e e d t o t a l
l i n e c h a r g i n g a d m i t t a n c e s t o g r o u n d a t e a c h bus .
Hence we c a n t s o l v e t h i s p r o b l e m o n l y u s i n g t h e
g i v e n t a b l e 1 3 . 1 , And we can u s e g a u s s s i e d e l
method u s i n g Ybus by t a k i n g t h e v a l u e s o f
i m p e d a n c e s and l i n e c h a r g i n g a d m i t t a n c e s o f t h e
s y s t e m which i s t a k e n from t h e t e x t b o o k [ 1 ]
Computer Methods i n Power System A n a l y s i s , S t a g g
and ElAbiad , Page No 2 8 4
173
8 //
9
10 // F u n c t i o n t o form t h e Ybus f o r p r i m i t v e a d m i t t a n c e
v a l u e s and l i n e c h a r g i n g a d m i t t a n c e v a l u e s
11 function Ybus = formYbus ( y_l , y_lc )
12 Ybus =[ y_l (1) + y_l (2) + y_lc (1) + y_lc (2) - y_l (1)
- y_l (2) 0 0;
13 - y_l (1) y_l (1) + y_l (3) + y_l (4) + y_l (5) +
y_lc (1) + y_lc (3) + y_lc (4) + y_lc (5) - y_l
(3) - y_l (4) - y_l (5) ;
14 - y_l (2) - y_l (3) y_l (2) + y_l (3) + y_l (6)
+ y_lc (2) + y_lc (3) + y_lc (6) - y_l (6)
0;
15 0 - y_l (4) - y_l (6) y_l (6) + y_l (4) +
y_l (7) + y_lc (6) + y_lc (4) + y_lc (7) - y_l
(7) ;
16 0 - y_l (5) 0 - y_l (7) y_l (5) + y_l
(7) + y_lc (5) + y_lc (7) ];
17 endfunction
18
19 // F u n c t i o n t o i n c o r p o r a t e l o a d f l o w a n a l y s i s f o r a
given system
20 function P_line = load_flow (E , Pg , Qg , Pl , Ql , y_l , y_lc )
21
22 // t o r e t r i e v e Ybus f o r t h e g i v e n n e t w o r k
parameters
23 Y = formYbus ( y_l , y_lc ) ;
24
25 // t o form p r i m i t i v e a d m i t t a n c e m a t r i x and
primitive l i n e charging admittances that
r e q u i r e d l a t e r i n t h e program
26 yl =[0 y_l (1) y_l (2) 0 0;
27 y_l (1) 0 y_l (3) y_l (4) y_l (5) ;
28 y_l (2) y_l (3) 0 y_l (6) 0;
29 0 y_l (4) y_l (6) 0 y_l (7) ;
30 0 y_l (5) 0 y_l (7) 0];
174
31 yc =[0 y_lc (1) y_lc (2) 0 0;
32 y_lc (1) 0 y_lc (3) y_lc (4) y_lc (5) ;
33 y_lc (2) y_lc (3) 0 y_lc (6) 0;
34 0 y_lc (4) y_lc (6) 0 y_lc (7) ;
35 0 y_lc (5) 0 y_lc (7) 0];
36
37 // t o o p t i m i z e t h e e v a l u a t i o n , c o n s t a n t s l i k e
KLs and YLs a r e e v a l u a t e d o n l y o n c e o u t s i d e
the loop
38 KL2 =(( Pg (2) - Pl (2) ) -( Qg (2) - Ql (2) ) ) / Y (2 ,2) ;
39 KL3 =(( Pg (3) - Pl (3) ) -( Qg (3) - Ql (3) ) ) / Y (3 ,3) ;
40 KL4 =(( Pg (4) - Pl (4) ) -( Qg (4) - Ql (4) ) ) / Y (4 ,4) ;
41 KL5 =(( Pg (5) - Pl (5) ) -( Qg (5) - Ql (5) ) ) / Y (5 ,5) ;
42
43 YL21 = Y (2 ,1) / Y (2 ,2) ; YL23 = Y (2 ,3) / Y (2 ,2) ;
YL24 = Y (2 ,4) / Y (2 ,2) ; YL25 = Y (2 ,5) / Y (2 ,2) ;
44 YL31 = Y (3 ,1) / Y (3 ,3) ; YL32 = Y (3 ,2) / Y (3 ,3) ;
YL34 = Y (3 ,4) / Y (3 ,3) ;
45 YL42 = Y (4 ,2) / Y (4 ,4) ; YL43 = Y (4 ,3) / Y (4 ,4) ;
YL45 = Y (4 ,5) / Y (4 ,4) ;
46 YL52 = Y (5 ,2) / Y (5 ,5) ; YL54 = Y (5 ,4) / Y (5 ,5) ;
47
48 // t o c a l c u l a t e bus v o l t a g e s ( R e f e r [ 1 ] s t a g g , pg
285)
49 n =100;
50 for i =1: n
51 E (1) = E (1) ;
52 E (2) =( KL2 / E (2) ) - YL21 * E (1) - YL23 * E (3) - YL24 * E
(4) - YL25 * E (5) ;
53 E (3) =( KL3 / E (3) ) - YL31 * E (1) - YL32 * E (2) - YL34 * E
(4) ;
54 E (4) =( KL4 / E (4) ) - YL42 * E (2) - YL43 * E (3) - YL45 * E
(5) ;
55 E (5) =( KL5 / E (5) ) - YL52 * E (2) - YL54 * E (4) ;
56 end
57 // t o c a l c u l a t e l i n e f l o w s ( R e f e r [ 1 ] s t a g g , pg
291)
58 for i =1:5
175
59 for j =1:5
60 S (i , j ) = E ( i ) *( E ( i ) -E ( j ) ) * yl (i , j ) + E ( i ) * E
( i ) * yc (i , j ) ;
61 end
62 end
63 P_line = conj ( S ) ; // s i n c e P l i n e=PjQ=c o n j ( S )
64
65 endfunction
66 //
//////////////////////////////////////////////////////////////////
67 // F i r s t we w i l l c a l c u l a t e t h e l i n e f l o w s f o r t h e
s y s t e m which o p e r a t i n g u n d e r n o r m a l c o n d i t i o n (
w i t h o u t any c o n g i n c y ) [ t a k e n a s Base s y s t e m f o r
comparision ]//
68 //
//////////////////////////////////////////////////////////////////
69 // ypq y pq /2 l i n e no
Buscode ( pq )
70 yl1 =1/(0.02+ %i *0.06) ; ylc_1 = %i *0.030; // l =1
l i n e 12
71 yl2 =1/(0.08+ %i *0.24) ; ylc_2 = %i *0.025; // l =2
l i n e 13
72 yl3 =1/(0.06+ %i *0.18) ; ylc_3 = %i *0.020; // l =3
l i n e 23
73 yl4 =1/(0.06+ %i *0.18) ; ylc_4 = %i *0.020; // l =4
l i n e 24
74 yl5 =1/(0.04+ %i *0.12) ; ylc_5 = %i *0.015; // l =5
l i n e 25
75 yl6 =1/(0.01+ %i *0.03) ; ylc_6 = %i *0.010; // l =6
l i n e 34
76 yl7 =1/(0.08+ %i *0.24) ; ylc_7 = %i *0.025; // l =7
l i n e 45
77
78 y_l_vector =[ yl1 yl2 yl3 yl4 yl5 yl6 yl7 ];
79 y_lc_vector =[ ylc_1 ylc_2 ylc_3 ylc_4 ylc_5 ylc_6
ylc_7 ];
176
80
81
82 // Assumed v o l t a g e Generation
load
Buscode
83 // MW MVAR
MW MVAR
84 E1 =1.06+ %i *0; Pg1 =0; Qg1 = %i
*0; Pl1 =0; Ql1 = %i *0; // 1
85 E2 =1+ %i *0; Pg2 =0.4; Qg2 = %i
*0.3; Pl2 =0.2; Ql2 = %i *0.1; // 2
86 E3 =1+ %i *0; Pg3 =0; Qg3 = %i
*0; Pl3 =0.45; Ql3 = %i *0.15; // 3
87 E4 =1+ %i *0; Pg4 =0; Qg4 = %i
*0; Pl4 =0.40; Ql4 = %i *0.05; // 4
88 E5 =1+ %i *0; Pg5 =0; Qg5 = %i
*0; Pl5 =0.60; Ql5 = %i *0.10; // 5
89
90 E =[ E1 E2 E3 E4 E5 ]; Pg =[ Pg1 Pg2 Pg3 Pg4 Pg5 ];
Qg =[ Qg1 Qg2 Qg3 Qg4 Qg5 ];
91 Pl =[ Pl1 Pl2 Pl3 Pl4 Pl5 ]; Ql =[ Ql1 Ql2 Ql3 Ql4 Ql5
];
92
93 P_base = load_flow (E , Pg , Qg , Pl , Ql , y_l_vector ,
y_lc_vector ) ;
94 P_base = P_base *100; // c o n v e r t i n g back t o MW and MVARs
95
96
97
98
99 //
//////////////////////////////////////////////////////////////////
177
102
103 // ( i ) when g e n e r a t o r a t s l a c k bus t r i p s
104 Pg1_old = Pg1 ; // r e q u i r e d f o r t h e c a l c u l a t i o n o f
c h a n g e i n MWs
105 Pg1 =0; Qg1 =0; // g e n e r a t i o n r e m a i n s same
106 Pg =[ Pg1 Pg2 Pg3 Pg4 Pg5 ]; Qg =[ Qg1 Qg2 Qg3 Qg4
Qg5 ]; // u p d a t i n g t h e c h a n g e d v a l u e s
107
108 // c o n d u c t i n g l o a d f l o w s t u d i e s
109 P_G_1 = load_flow (E , Pg , Qg , Pl , Ql , y_l_vector ,
y_lc_vector ) ;
110 P_G_1 = P_G_1 *100; // c o n v e r t i n g back t o MW and MVARs
111 alpha1 =( real ( P_G_1 ) - real ( P_base ) ) /(( Pg1_old - Pg1
+0.001) *100) ; // 0 . 0 0 1 i s added t o e l i m i n a t e
d i v i d e by z e r o e r r o r
112 alpha1 = tril ( alpha1 ) ; // o n l y l o w e r t r i a n g u l a r
matrix i s r e q u i r e d
113 l1 =[ alpha1 (2 ,1) alpha1 (3 ,1) alpha1 (3 ,2) alpha1
(4 ,2) alpha1 (5 ,2) alpha1 (4 ,3) alpha1 (5 ,4) ];
114 // ( i i ) When g e n e r a t o r a t Bus2 t r i p s
115 Pg2_old = Pg2 ; // r e q u i r e d f o r t h e c a l c u l a t i o n o f
c h a n g e i n MWs
116 Pg2 =0; Qg2 =0; Pg1 =0; Qg1 =0;
117 Pg =[ Pg1 Pg2 Pg3 Pg4 Pg5 ]; Qg =[ Qg1 Qg2 Qg3 Qg4
Qg5 ]; // u p d a t i n g t h e c h a n g e d v a l u e s
118
119 // c o n d u c t i n g l o a d f l o w s t u d i e s
120 P_G_2 = load_flow (E , Pg , Qg , Pl , Ql , y_l_vector ,
y_lc_vector ) ;
121 P_G_2 = P_G_2 *100; // c o n v e r t i n g back t o MW and MVARs
122 alpha2 =( real ( P_G_2 ) - real ( P_base ) ) /(( Pg2_old - Pg2 )
*100) ;
123 alpha2 = tril ( alpha2 ) ; // o n l y l o w e r t r i a n g u l a r
matrix i s r e q u i r e d
124 l2 =[ alpha2 (2 ,1) alpha2 (3 ,1) alpha2 (3 ,2) alpha2
(4 ,2) alpha2 (5 ,2) alpha2 (4 ,3) alpha2 (5 ,4) ];
125 //To p r i n t t h e r e s u l t s o f g e n e r a t o r s h i f t f a c t o r s
178
126
127 printf ( G e n e r a t o r S h i f t F a c t o r f o r F i v e bus System \n
);
128 printf (
\
n );
129 printf ( L i n e s \ t \ t \ t Bus 1 \ t \ t \ tBus 2\ n ) ;
130 printf (
\
n );
131 for i =1:7
132 printf ( l = %d\ t \ t \ t %d\ t \ t \ t%0 . 4 f \n ,i , l1 (
i ) , l2 ( i ) ) ;
133 end
134 printf (
\
n );
135 //
//////////////////////////////////////////////////////////////////
138
139 // c h a n g i n g t h e n e t w o r k back t o n o r m a l s y s t e m
140 Pg2 =0.4; Qg2 = %i *0.3;
141
142 // c o p y i n g t h e o r i g i n a l v a l u e s o f t h e n e t w o r k
parameters
143 y_l_vector_normal = y_l_vector ;
y_lc_vector_normal = y_lc_vector ;
144 Pg =[ Pg1 Pg2 Pg3 Pg4 Pg5 ]; Qg =[ Qg1 Qg2 Qg3 Qg4
Qg5 ]; // u p d a t i n g t h e c h a n g e d v a l u e s
145 // when j t h l i n e t r i p s t h e l o a d f l o w a n a l y s i s i s done
as f o l l o w s
146 for j =1:7
179
147 y_l_vector ( j ) =0; y_lc_vector ( j ) =0;
148 P_L = load_flow (E , Pg , Qg , Pl , Ql , y_l_vector ,
y_lc_vector ) ; // l o a d f l o w a n l y s i s
149 P_L = P_L *100;
150 select j ,
151 case 1 then fi0 = P_base (2 ,1) ,
152 case 2 then fi0 = P_base (3 ,1) ,
153 case 3 then fi0 = P_base (3 ,2) ,
154 case 4 then fi0 = P_base (4 ,2) ,
155 case 5 then fi0 = P_base (5 ,2) ,
156 case 6 then fi0 = P_base (4 ,3) ,
157 case 7 then fi0 = P_base (5 ,4) ,
158 end
159 d0 =( real ( P_L ) - real ( P_base ) ) / real ( fi0 ) ;
160 d (: , j ) =[ d0 (2 ,1) ; d0 (3 ,1) ; d0 (3 ,2) ; d0 (4 ,2) ; d0
(5 ,2) ; d0 (4 ,3) ; d0 (5 ,4) ];
161 y_l_vector = y_l_vector_normal ; y_lc_vector =
y_lc_vector_normal ; // c h a n g i n g t h e s y s t e m back
to normal
162 end
163
164 // when a l i n e t r i p s power f l o w i n t h a t l i n e i s z e r o ,
t h i s i s n o t a c c o u n t e d i n l o a d f l o w . So a c c o u n t i n g
t h i s by making a l l d i a g o n a l e l e m n t s o f d=0
165 for i =1:7
166 d (i , i ) =0;
167 end
168
169 //To p r i n t t h e r e s u l t s o f l i n e o u t a g e d i s t r i b u t i o n
factors
170 printf ( \n\n\n\ n L i n e Outage D i s t r i b u t i o n F a c t o r f o r
F i v e bus System \n ) ;
171 printf (
n );
172 printf ( L i n e s \ t \ t j =1\ t \ t j =2\ t \ t j =3\ t \ t j =4\ t \ t j =5\ t
\ t j =6\ t \ t j =7\n ) ;
173 printf (
180
n );
174 for l =1:7
175 printf ( l = %d\ t \ t%0 . 4 f \ t \ t%0 . 4 f \ t \ t%0 . 4 f \ t \ t%0
. 4 f \ t \ t%0 . 4 f \ t \ t%0 . 4 f \ t \ t%0 . 4 f \n ,l , d (l ,1) ,d (
l ,2) ,d (l ,3) ,d (l ,4) ,d (l ,5) ,d (l ,6) ,d (l ,7) ) ;
176 end
177 printf (
n\n\n ) ;
181
Chapter 14
An Introduction to State
Estimation of Power Systems
1 // C h a p t e r 14
2 // Example 1 4 . 1
3 // p a g e 533
4 //To e s t i m a t e t h e v a l u e s o f t h e random v a r i a b l e s x1
and x2
5 clear ; clc ;
6
7 H =[1 0;0 1;1 1]; // g i v e n m a t r i x
8 k = inv (H * H ) *H ; // from eq 1 4 . 9
9 y =[ y1 ; y2 ; y3 ];
10 k = string ( k ) ;
11 x =[ k (1 ,1) + y (1 ,1) + k (1 ,2) + y (2 ,1) + + + k (1 ,3) + y (3 ,1) ; k
(2 ,1) + y (1 ,1) + + + k (2 ,2) + y (2 ,1) + + + k (2 ,3) + y (3 ,1)
];
12 printf ( E s t i m a t e o f x =\n ) ;
13 disp ( x ) ;
182
Scilab code Exa 14.2 Estimation of random variables using WLSE
1 // C h a p t e r 14
2 // Example 1 4 . 2
3 // p a g e 534
4 //To e s t i m a t e t h e v a l u e s o f t h e random v a r i a b l e s x1
and x2 u s i n g WLSE
5 clear ; clc ;
6
7 w = diag ([0.1;1;0.1]) ; // assumed m a t r i x
8 H =[1 0;0 1;1 1]; // g i v e n m a t r i x
9 k = inv (H * w * H ) *H * w ; // from eq 1 4 . 1 2 b
10 y =[ y1 ; y2 ; y3 ];
11 Px = k *k ;
12 k = string ( k ) ;
13 x =[ k (1 ,1) + y (1 ,1) + k (1 ,2) + y (2 ,1) + + + k (1 ,3) + y (3 ,1) ; k
(2 ,1) + y (1 ,1) + + + k (2 ,2) + y (2 ,1) + + + k (2 ,3) + y (3 ,1)
];
14 printf ( The w e i g h t e d l e a s t s q u a r e s e s t i m a t e o f t h e
v e c t o r x =\n ) ;
15 disp ( x ) ;
16 printf ( \n\ nThe m a t r i x k i s i n t h i s c a s e f o u n d t o be
\n ) ;
17 disp ( k ) ;
18 // c o v a r i a n c e o f measurement i s assumed i s assumed t o
be u n i t m a t r i x
19 printf ( \n\ nThe c o v a r i a n c e o f t h e e s t i m a t i o n e r r o r
i s o b t a i n e d a s Px=\n ) ;
20 disp ( Px ) ;
21
183
22 printf ( \n\n\n Now c h o o s i n g W=1\n ) ;
23 w = diag ([1;1;1]) ; // assumed m a t r i x
24 H =[1 0;0 1;1 1]; // g i v e n m a t r i x
25 k = inv (H * w * H ) *H * w ; // from eq 1 4 . 1 2 b
26 Px = k *k ;
27 printf ( \n\ nThe m a t r i x k i s i n t h i s c a s e f o u n d t o be
\n ) ;
28 disp ( k ) ;
29 printf ( \n\ nThe c o v a r i a n c e o f t h e e s t i m a t i o n e r r o r
i s o b t a i n e d a s Px=\n ) ;
30 disp ( Px ) ;
1 // C h a p t e r 14
2 // Example 1 4 . 3
3 // p a g e 538
4 //To e s t i m a t e t h e v a l u e s o f t h e random v a r i a b l e s x1
and x2 u s i n g WLSE
5 clear ; clc ;
6 i =0; x =1; y =8.5
7 printf ( \n ) ;
8 printf ( i t e r a t i o n \ t \ t x ( l ) \n ) ;
9 printf ( \n ) ;
10 printf ( \t%d\ t \ t%0 . 3 f \n ,i , x ) ;
11 for i =1:1:10
12 k =(1/3) * x ^ -2 // e x p r e s s i o n f o r t h e v a l u e o f
k has been p r i n t e d wrongly i n the textbook
13 x = x +( k ) *( y - x ^3) ;
14 printf ( \t%d\ t \ t%0 . 3 f \n ,i , x ) ;
15
16 end
184
185
Chapter 17
Voltage Stability
1 // C h a p t e r 17
2 // Example 1 7 . 1
3 // p a g e 602
4 //To f i n d r e a c t i v e power s e n s i t i v i t y a t t h e bus
5 clear ; clc ;
6 Q_nom =1; // g i v e n
7 Ksh =0.8; V =1.0; // assumed
8 Qnet =( V ^2 - Ksh * V ^2) * Q_nom ;
9 // s e n s t i v i t y =dQnet /dV
10 s =2* V -2* V * Ksh ;
11 printf ( R e a c t i v e power S e n s i t i v i t y a t t h e bus i s =
%0 . 2 f pu ,s ) ;
186
Capacity of static VAR compensator
1 // C h a p t e r 17
2 // Example 1 7 . 2
3 // p a g e 602
4 //To f i n d c a p a c i t y o f s t a t i c VAR c o m p e n s a t o r
5 clear ; clc ;
6
7 delta_V =5/100; // a l l o w a b l e v o l t a g e f l u c t u a t i o n
8 S_sc =5000; // s y s t e m s h o r t c i r c u i t c a p a c i t y i n MVA
9 delta_Q = delta_V * S_sc ; // s i z e o f t h e c o m p e n s a t o r
10 printf ( The c a p a c i t y o f t h e s t a t i c VAR c o m p e n s a t o r
i s +%d MVAR , delta_Q ) ;
187