summaryrefslogtreecommitdiff
path: root/Generation_Of_Electrical_Energy_by_B._R._Gupta/Chapter14.ipynb
blob: a2681fd447bc058e397cc0dea4f71e28cd48868e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
{
 "metadata": {
  "name": "",
  "signature": "sha256:7ee8895bf918e29dc996fcc120f35aefc5913500e53b4df4d74c03c3d0bc218c"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Ch-14, System Interconnections"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 14.1 Page 302"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "p=100  #rating of alternater\n",
      "sd=0.04 #speed of alrternator drops \n",
      "df=-0.1  #change in frequency and drops so -ve\n",
      "f=50    #frequency is 50hz\n",
      "r=sd*f/p  #r in hz/MW\n",
      "dp=-(df)/r \n",
      "print \" speed regulation of alternator is %.2fHz/MW \\n change in power output %dMW\"%(r,dp)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " speed regulation of alternator is 0.02Hz/MW \n",
        " change in power output 5MW\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example14.2 Page 302"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "p=100 #power of alternator\n",
      "f=50  #frequency\n",
      "h=5   #h constant of machine kW-sec kVA\n",
      "inl=50 #load suddenly increase by\n",
      "de=0.5 #time delay\n",
      "ke=h*p*10**3 #kinetic energy\n",
      "lke=inl*10**3*de #loss in kinetic energy\n",
      "nf=((1-(lke/ke))**(de))*f #now frequency \n",
      "fd=(1-nf/f)*100  #frequency deviation\n",
      "print \"kinetic energy stored at rated speed %.1e kW-sec \\nloss in kinetic energy due to increase in load %.1e kW-sec \\nnew frequency %.3fHz \\nfrequency deviation %.3f\"%(ke,lke,nf,fd)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "kinetic energy stored at rated speed 5.0e+05 kW-sec \n",
        "loss in kinetic energy due to increase in load 2.5e+04 kW-sec \n",
        "new frequency 48.734Hz \n",
        "frequency deviation 2.532\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 14.3 Page 303"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "ar1=500 #alternator rating1\n",
      "pl=0.5  #each alternator is operating at half load \n",
      "ar2=200 #alternator rating2\n",
      "f=50   #frequency\n",
      "il=140  #load increase by 140 MW\n",
      "fd=49.5  #frequency drops\n",
      "fdd=-f+fd #frequency deviation \n",
      "dp1=(ar1*pl)-il  #change in load alternator 1\n",
      "dp2=-(ar2*pl)+il #change in load of alternator 2\n",
      "r1=-fdd/dp1  \n",
      "r2=-fdd/dp2\n",
      "print \" R1=%.3fohm \\n R2=%.4fohm\"%(r1,r2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " R1=0.005ohm \n",
        " R2=0.0125ohm\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example14.4 Page 303"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "rc=10000 #rated capacity\n",
      "r=2   #regulation in all units\n",
      "li=0.02 #load increase\n",
      "f=50  #frequency\n",
      "d=rc/(2*f) #d=partial derevative with respect to frequency\n",
      "d=d/rc\n",
      "b=d+1/r\n",
      "m=li*rc/2\n",
      "mpu=m/rc\n",
      "df=-mpu/b \n",
      "dff=-mpu/d\n",
      "print \"static frequency drop %fHz \\nfrequency drop %dHz\"%(df,dff)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "static frequency drop -0.019608Hz \n",
        "frequency drop -1Hz\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 14.5 Page 303"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "cac=10000  #control area capacity\n",
      "nol=5000  #normal operating\n",
      "h=5       #inertial constent\n",
      "r=3       #regulation\n",
      "cf=1      #1%change in corresponds to 1% change in load\n",
      "f=50      #frequency\n",
      "d=cac/(2*f)\n",
      "dpu=d/(cac)\n",
      "kp=1/dpu\n",
      "tp=2*h/(f*dpu)\n",
      "print \"d=%.2fp.u.MW/hz, \\nkp=%dhz/p.u.MW \\ntp=%dsecond\"%(dpu,kp,tp)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "d=0.01p.u.MW/hz, \n",
        "kp=100hz/p.u.MW \n",
        "tp=20second\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 14.6 Page 304"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "rc=10000 #rated capacity\n",
      "r=2   #regulation in all units\n",
      "li=0.02 #load increase\n",
      "f=50  #frequency\n",
      "d=rc/(2*f) #d=partial derevative with respect to frequency\n",
      "dd=d/rc\n",
      "b=dd+1/r\n",
      "m=li*rc/2\n",
      "mpu=m/rc\n",
      "df=-mpu/b \n",
      "dff=-mpu/dd\n",
      "cf=abs(df*d)\n",
      "inc=-(df/r)*10**4\n",
      "print \"the contribution of frequency drop to meet increase in load %.3fMW \\nincrease in generation cost Rs%.2f\"%(cf,inc)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the contribution of frequency drop to meet increase in load 1.961MW \n",
        "increase in generation cost Rs98.04\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 14.7 Page 307"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "p=100  #MVA of generated\n",
      "f=50   #frequency\n",
      "rpm=3000 #no load rpm\n",
      "lad=25  #load applied to the machiene\n",
      "t=0.5  #time delay \n",
      "h=4.5  #inertia constent\n",
      "ke=h*p  #kinetic energy is product of h*p\n",
      "lke=lad*t  #loss of ke\n",
      "nf=(((ke-lke)/ke)**t)*f  #new frequency ((1-lke/ke)**t)*f\n",
      "fd=(1-(nf/f))*100    #frequency deviation\n",
      "print \"ke at no load %dMW-sec \\nloss in k.e due to load %.1fMW-sec \\nnew frequency %.1fHz \\nfrequency deviation %.1fpercent\"%(ke,lke,nf,fd)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "ke at no load 450MW-sec \n",
        "loss in k.e due to load 12.5MW-sec \n",
        "new frequency 49.3Hz \n",
        "frequency deviation 1.4percent\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 14.8 Page 307"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "c=4000#capacity\n",
      "f=50  #frequency\n",
      "ol=2500 #operating load\n",
      "r=2   #speed regulation\n",
      "h=5  #inertial constant\n",
      "dl=0.02 #change in load\n",
      "df=0.01  #change in frequency\n",
      "dff=-0.2 #change in steady state frequency\n",
      "d=(dl*ol)/(df*f) #\n",
      "dpu=d/c  #din pu\n",
      "b=dpu+(1/r)\n",
      "m=-dff*b\n",
      "print \"largest chang in load is %.3fp.u.MW=%dMW\"%(m,m*c)\n",
      "kp=(1/dpu)\n",
      "tp=(kp)*2*h/f\n",
      "tt=(r+kp)/(r*tp) #time constant \n",
      "print \"\\ndf=(dff)(1-e**%f*t)\"%(tt)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "largest chang in load is 0.105p.u.MW=420MW\n",
        "\n",
        "df=(dff)(1-e**2.625000*t)\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example14.9 Page 307"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "c=4000 #capacity of system\n",
      "f=50  #frequency #operatingload=rated area capacity\n",
      "h=5   #time constent\n",
      "r=0.025  #\n",
      "dl=0.01 #change in load\n",
      "df=0.01 #change in frequency\n",
      "rr=r*f #\n",
      "d=(dl*c)/(df*f) \n",
      "dpu=d/c\n",
      "kp=1/dpu\n",
      "tp=(kp)*(2*h/f)\n",
      "tt=(rr+kp)/(rr*tp)\n",
      "sfe=(kp*rr*dpu)/(rr+kp)\n",
      "ki=(1+(kp/r))**2/(4*tp*kp)\n",
      "print \" df=-%.5f(1-e**(-%.1f)) \\n ki=%.4fp.u.MW/Hz\"%(sfe,tt,ki)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " df=-0.02439(1-e**(-4.1)) \n",
        " ki=2002.0005p.u.MW/Hz\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example14.10 Page 308"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "tg=0.2 #time constent of steam turbine\n",
      "t=2 #time constant of turbine\n",
      "h=5 #inertia constent\n",
      "r=0.04  #given\n",
      "dl=0.01  #change in load\n",
      "df=0.01  #change in frequency\n",
      "c=1500  #capacity\n",
      "f=50  #frequency\n",
      "adl=0.01 #max allowable change in load\n",
      "print '(a)'\n",
      "print \"\\ntransfer function of governor gr= 1/(1+%.1f*s) \\n transfer function of turbine gt=1/(1+%d*s)\"%(tg,t)\n",
      "rr=r*f\n",
      "d=(dl*c)/(df*f)\n",
      "dpu=(d/c)\n",
      "kp=(1/dpu)\n",
      "tp=(kp*(2*h)/(f))\n",
      "print \"\\ntransfer function of power system \\n Gp=(%d/(1+%d*s)\\n Df=-gp/(1+(0.5*(gr*gt*gp)))\"%(kp,tp)\n",
      "ddf=-(kp)/(1+kp/r)\n",
      "dff=df*f\n",
      "m=dff/(ddf)\n",
      "mm=m*c\n",
      "print '(b)'\n",
      "print \"\\nthe largest step in the load if the frequency change by more than %.2f in steady state %dMW\"%(adl,mm)\n",
      "if mm<0:\n",
      "    print \"\\nthe minu sign is becose of the that if frequency is to increase by %f \\nthe change in load be negative.\"%(adl)\n",
      "else:\n",
      "    print \"\\nthe largest step in load if the frequency is to decrease by %f /n the change in load be positive\"%(adl)\n",
      "print '(c)'\n",
      "\n",
      "print 'when integral controller is used,static frequency error is zero'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)\n",
        "\n",
        "transfer function of governor gr= 1/(1+0.2*s) \n",
        " transfer function of turbine gt=1/(1+2*s)\n",
        "\n",
        "transfer function of power system \n",
        " Gp=(50/(1+10*s)\n",
        " Df=-gp/(1+(0.5*(gr*gt*gp)))\n",
        "(b)\n",
        "\n",
        "the largest step in the load if the frequency change by more than 0.01 in steady state -18765MW\n",
        "\n",
        "the minu sign is becose of the that if frequency is to increase by 0.010000 \n",
        "the change in load be negative.\n",
        "(c)\n",
        "when integral controller is used,static frequency error is zero\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 14.11 Page 312"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "pa=5000   #power of unit a\n",
      "pb=10000   #power of unit b\n",
      "r=2       #given speed regulation in p.uMW\n",
      "d=0.01   #d in p.u.MW/Hz\n",
      "dpa=0    #change in power  in unit a\n",
      "dpb=-100 #change in power in unit b \n",
      "pbas=10000  #assume base as 10000 \n",
      "ra=r*pbas/pa  #speed regulation of the unit a\n",
      "da=d*pa/pbas  #da of unit b\n",
      "rb=r*pbas/pb #speed regulation of unit b\n",
      "db=d*pb/pbas  #db of unit b\n",
      "ba=da+(1/ra)  #area frequency response of a\n",
      "bb=db+(1/rb)  #area frequency response of b\n",
      "ma=dpa/pbas   #change in power a in per unit in unit a \n",
      "mb=dpb/pbas   #change in power a in per unit in unit b\n",
      "df=(ma+mb)/(ba+bb) #change in frequency\n",
      "dpab=(ba*mb-bb*ma)/(ba+bb)  #change in power between ab\n",
      "print \"change in frequency is %.5fHz \\nchange in power %.6f p.u.MW\"%(df,dpab)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "change in frequency is -0.01307Hz \n",
        "change in power -0.003333 p.u.MW\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 14.12 page 314"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "pa=500   #power of unit a\n",
      "pb=2000  #power of unit b\n",
      "ra=2.5   #speed regulation of a\n",
      "rb=2     #speed regulation of b\n",
      "dl=0.01  #change in load\n",
      "df=0.01  # change in frequency\n",
      "pt=20     #change in tie line power \n",
      "ptl=0     #let other power station has zero \n",
      "pbas=2000  #assume base as 2000MW\n",
      "f=50        #assume frequency\n",
      "da=(dl*pa)/(df*f)  #change in power w.r.t frequency\n",
      "dapu=da/(pbas)  # change in power w.r.t frequency in per unit\n",
      "db=(dl*pb)/(df*f) #change in power in unit b\n",
      "dbpu=db/pbas      #change in power w.r.t frequency in per unit\n",
      "raa=ra*pbas/pa  #speed regulation with pbase\n",
      "rbb=rb*pbas/pb  #speed regulation with pbase\n",
      "ba=dapu+(1/raa)  #area frequency response a\n",
      "bb=dbpu+(1/rbb)  #area frequency response b\n",
      "ma=pt/pbas       #assume change in power in unit a alone due to tie power\n",
      "mb=ptl/pbas       #change in power in unit b\n",
      "df=-(ma+mb)/(ba+bb) #change in frequency\n",
      "dpp=(ba*mb-bb*ma)/(ba+bb)  #change in power\n",
      "print '(a)'\n",
      "print \"change in frequency is %.3fHz  \\n change in power between ab %.5fp.u.MW \\n \\t\\t%.2fMW\"%(df,dpp,dpp*pbas)\n",
      "ma2=ptl/pbas       #assume change in power in unit a alone due to tie power\n",
      "mb2=pt/pbas       #change in power in unit b\n",
      "df2=-(ma2+mb2)/(ba+bb) #change in frequency\n",
      "dpp2=(ba*mb2-bb*ma2)/(ba+bb)  #change in power\n",
      "print '(b)'\n",
      "dpba=dpp2*pbas\n",
      "print \" change in frequency is %.3fHz  \\n change in power between ab %.5fp.u.MW \\n\"%(df2,dpp2)\n",
      "print \" change in power %fMW\"%(dpba)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)\n",
        "change in frequency is -0.016Hz  \n",
        " change in power between ab -0.00832p.u.MW \n",
        " \t\t-16.64MW\n",
        "(b)\n",
        " change in frequency is -0.016Hz  \n",
        " change in power between ab 0.00168p.u.MW \n",
        "\n",
        " change in power 3.360000MW\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 14.13 Page 315"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import cos, pi\n",
      "p=4000 #power area\n",
      "n=2    #number of units\n",
      "r=2    #speed regulation\n",
      "h=5    \n",
      "pt=600    #given tie power\n",
      "pan=40   #power angle\n",
      "stp=100\n",
      "f=50\n",
      "t=(pt/p)*cos(pan*pi/180)\n",
      "wo=((2*pi*f*t/h)**2-(f/(4*r*h))**2)**(0.5)\n",
      "print '(a)'\n",
      "print \" the damped angular frequency is %.2fradians/sec if speed govenor loop is closed\"%(wo)\n",
      "print '(b)'\n",
      "print \" since the two area are imilier ,each area will supply half of increase in load .this also evident besause ba=bb  \\n change in power %dMW \\n speed regulation is infininy\"%(stp/2)\n",
      "wo1=(2*pi*f*t/h)**(0.5) #if govenor loop is open alpha is zero\n",
      "print \" damped angular frequency if speed governor loop is open %.3frad/sec \"%(wo1)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)\n",
        " the damped angular frequency is 7.11radians/sec if speed govenor loop is closed\n",
        "(b)\n",
        " since the two area are imilier ,each area will supply half of increase in load .this also evident besause ba=bb  \n",
        " change in power 50MW \n",
        " speed regulation is infininy\n",
        " damped angular frequency if speed governor loop is open 2.687rad/sec \n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example14.14 Page 325"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import cos, acos, sin\n",
      "Aa=0.98; Ap=3 #magnitude and angle of constant A\n",
      "Ba=110 ;Bp=75 #magnitude and angle of constant B\n",
      "p=50      #given power 50\n",
      "pf=0.8   #given power factor is 0.8\n",
      "vr=132   #voltage at reseving station\n",
      "vs=132  #voltage at source station to be maintained\n",
      "vsr1=p*pf+(Aa*(vr**2)/Ba)*cos(pi/180*(Bp-Ap))\n",
      "ph=vsr1*Ba/(vs*vr)\n",
      "phh=acos(ph)*180/pi\n",
      "Del=Bp-phh\n",
      "qrr=((vs*vr/Ba)*sin(phh*pi/180))-((Aa*(vr)**(2)/Ba)*sin((Bp-Ap)*pi/180))  #reactive power to maintain voltage equal\n",
      "qrre=p*sin(acos(pf)) #reactive power for the load\n",
      "qrc=qrre-qrr\n",
      "print \"the reactive power supply and reseving power is %dkV \\nreactive power %.2fMvar\"%(vs,qrr)\n",
      "print \"\\nthe required compensator network neeeded %.2fMvar\"%(qrc)\n",
      "print '(b)'\n",
      "cosb=(Aa*cos(pi/180*(Bp-Ap))*(vr)**(2)/Ba)*(Ba/(vs*vr)) #under no oad condition\n",
      "phb=acos(cosb)*180/pi\n",
      "qrb=(vs*vr*sin(phb*pi/180)/Ba)-(Aa*vr*vr*sin(pi/180*(Bp-Ap))/Ba)\n",
      "if qrb>0 :\n",
      "    print \"thus under no load condition the line delivers %.2fMvar at receiving end.the reactive power must be absorbed by shunt reactor at receving end. thus the capacity of shunt reactor, for no load condition is %.2fMvar. \"%(qrb,qrb)\n",
      "else:\n",
      "    print \"thus under no load condition the line absorbs %.2fMvar at receiving end.the reactive power must be delivered by shunt reactor at receving end. or reactive must suppiled by the source thus the capacity of shunt reactor, for no load condition is %.2fMvar. \"%(qrb,qrb)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the reactive power supply and reseving power is 132kV \n",
        "reactive power -15.91Mvar\n",
        "\n",
        "the required compensator network neeeded 45.91Mvar\n",
        "(b)\n",
        "thus under no load condition the line delivers 3.33Mvar at receiving end.the reactive power must be absorbed by shunt reactor at receving end. thus the capacity of shunt reactor, for no load condition is 3.33Mvar. \n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 14.15 Page 326"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt\n",
      "v=220  #line voltage\n",
      "ps=11 ; ss=220; pr=220 ;sr=11  #primer and secondary end terminal voltages of tapping transformer\n",
      "zr=20; zi=60  #impedence of line in real ndimagenary parts\n",
      "p=100  #power at recieving end is 100MVA\n",
      "pf=0.8  #power factor at recievin t=1   #prodect of 2 off terminal tap setting is  1\n",
      "vt=11  #tap setting for 11 kv voltage bus\n",
      "P=(p*pf*10**6)/3 #real power \n",
      "Q=(p*sin(acos(pf))*10**6)/3  #reactance power\n",
      "v1=v*(10**3)/sqrt(3)\n",
      "ts=(1/(1-(zr*P+zi*Q)/(v1**2)))**(0.5)\n",
      "print \" tapping ratio at the source %.3f  \\n tapping ratio at the receving end %.2f\"%(ts,1/ts)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " tapping ratio at the source 1.058  \n",
        " tapping ratio at the receving end 0.94\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 14.16 page 327"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "vp=132; vs=33; vt=11  #voltage at primary ,secondary ,teritiory\n",
      "pp=75; ps=50; pt=25  #MVA rating at prinary ,secondary,teritiory \n",
      "rpr=0.12 ;rv=132; rp=75  #reactance power of primary under rv and rp as voltage and power base\n",
      "poa=60 ;rea=50  #load real and reactive power a\n",
      "pva=125 ;svaa=33 #primary and secondary voltage a\n",
      "svsb=25 ;pvb=140; svbb=33  #primary and secondary voltage at no load\n",
      "print '(a)'\n",
      "vbas=132  ;mvabas=75  #assume voltage and MVA base   \n",
      "v1pu=pva/vbas   #voltage in per unit\n",
      "v1apu=round(v1pu*1000)/1000  #rounding off \n",
      "qre=rea/mvabas  #reactive power in per unit\n",
      "vn1a=(v1apu+sqrt(v1apu**2-4*rpr*qre))/2  #voltage using quadratic equation formulae\n",
      "vn2a=(v1apu-sqrt(v1apu**2-4*rpr*qre))/2\n",
      "vnaa=vn1a*vbas\n",
      "v12=pvb/vbas\n",
      "q=svsb/mvabas\n",
      "vn1b=(v12+sqrt(v12**2-4*rpr*q))/2  #voltage using quadratic equation formulae\n",
      "vn1b=round(vn1b*1000)/1000\n",
      "vnbb=vn1b*vbas    #vn in no load condition\n",
      "print \"vn=%.3f.p.u \\n vn=%.3fkV\"%(vn1a,vnaa)\n",
      "print '(b)'\n",
      "print \"vn=%.3f.p.u \\n vn=%.3fkV\"%(vn1b,vnbb)\n",
      "z=vnaa/svaa ;x=vnbb/svbb \n",
      "print \"\\n transformation ratio under load condition %.3f \\n transformation ratio under no load condition %.3f \\n the actual ratio can be taken as mean of the above value i.e.%.3fpercent\\n varying by (+/-)%.3fpercent\"%(z,x,(z+x)/2,x-(z+x)/2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)\n",
        "vn=0.853.p.u \n",
        " vn=112.628kV\n",
        "(b)\n",
        "vn=1.021.p.u \n",
        " vn=134.772kV\n",
        "\n",
        " transformation ratio under load condition 3.413 \n",
        " transformation ratio under no load condition 4.084 \n",
        " the actual ratio can be taken as mean of the above value i.e.3.748percent\n",
        " varying by (+/-)0.336percent\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 14.7 page 331"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "ca=200  #capacity of unit a\n",
      "cb=100   #capacity of unit b\n",
      "ra=1.5    #speed regulation of unit a   \n",
      "rb=3      #speed regulation of unit b\n",
      "f=50       #frequency\n",
      "pla=100    #load on each bus\n",
      "plb=100\n",
      "raa=ra*f/(pla*ca)\n",
      "rbb=rb*f/(plb*cb)\n",
      "pa=rbb*(pla+plb)/(raa+rbb)\n",
      "pb=pla+plb-pa\n",
      "tp=pa-pla\n",
      "print \" generation at the plant a is %dMW and \\n generation at the plant b is %dMW \\n transfer power from plant a to b is %dMW\"%(pa,pb,tp)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " generation at the plant a is 160MW and \n",
        " generation at the plant b is 40MW \n",
        " transfer power from plant a to b is 60MW\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 14.18 Page 332"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "za=1.5 ;zb=2.5 #impedence between two lines \n",
      "v=11  #plant operatio\\ng voltage\n",
      "l=20  ; pf=0.8  #load at 20 MW at 0.8 pf\n",
      "i=l*10**3/(v*pf*sqrt(3)) ;ph=-acos(pf)*180/pi #current and phase angle of transfrming current\n",
      "vd=complex(za,zb)*complex(i*cos(ph*pi/180),i*sin(ph*pi/180))  #voltage drop due to loss\n",
      "print \"the current transfer is %.1fA at an angle %.2f\"%(i,ph)\n",
      "print \"\\nvoltage drop in the interconnector is %.2f+j%.2fV \\nso voltage boost needed is %.2f+j%.2fV \"%(vd.real,vd.imag,vd.real,vd.imag)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the current transfer is 1312.2A at an angle -36.87\n",
        "\n",
        "voltage drop in the interconnector is 3542.83+j1443.38V \n",
        "so voltage boost needed is 3542.83+j1443.38V \n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 14.19 Page 332"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import atan, cos\n",
      "zaa=3 ;zbb=9  #impedence given between line\n",
      "pas=1   #power at two units are equal to 1p.u \n",
      "par=1    \n",
      "pbs=1.05  #power at sending end is 1.05 and power at receiving end is 1p.u\n",
      "pbr=1\n",
      "i=1 #assume current is 1p.u\n",
      "los=i*complex(zaa/100,zbb/100)\n",
      "csd=((abs(los)**2)-pas**2-par**2)/(2*pas*par)  #load angle between two stations\n",
      "csa=(pas**2+abs(los)**2-par**2)/(2*pas*abs(los))  #angle between source and loss\n",
      "ta=180-atan(zbb/zaa)*180/pi-acos(csa)*180/pi  #transfering power factor angle\n",
      "print \"(a)\"\n",
      "print \"load angle is %.2f\\n\"%(cos(csd*pi/180))\n",
      "if sin(ta*pi/180)<0:\n",
      "    print \"real power is %.3fp.u \\nreactive power %.3fp.u lagging\"%(cos(ta*pi/180),abs(sin(ta*pi/180)))\n",
      "else:\n",
      "    print \"real power is %.3fp.u \\nreactive power %.3fp.u leading\"%(cos(ta*pi/180),sin(ta*pi/180))\n",
      "\n",
      "csd2=(abs(los)**2-pbs**2-pbr**2)/(2*pbs*pbr)  #load angle between two stations\n",
      "csa2=(pbr**2-pbs**2+abs(los)**2)/(2*pbr*abs(los))  #angle between source and loss\n",
      "f=180-atan(zbb/zaa)*180/pi-acos(csa2)*180/pi  #transfering power factor angle\n",
      "print '(b)'\n",
      "\n",
      "print \"load angle is %.2f\\n\"%(cos(csd2*pi/180))\n",
      "if sin(f*pi/180)<0 :\n",
      "    print \"real power is %.3fp.u \\nreactive power %.3fp.u lagging\"%(cos(f*pi/180),abs(sin(f*pi/180)))\n",
      "else:\n",
      "    print \"real power is %.3fp.u \\nreactive power %.3fp.u leading\"%(cos(f*pi/180),sin(f*pi/180))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)\n",
        "load angle is 1.00\n",
        "\n",
        "real power is 0.933p.u \n",
        "reactive power 0.361p.u leading\n",
        "(b)\n",
        "load angle is 1.00\n",
        "\n",
        "real power is 0.981p.u \n",
        "reactive power 0.192p.u lagging\n"
       ]
      }
     ],
     "prompt_number": 19
    }
   ],
   "metadata": {}
  }
 ]
}