summaryrefslogtreecommitdiff
path: root/Generation_Of_Electrical_Energy_by_B._R._Gupta/Chapter4.ipynb
blob: 18d6d7fdc719df154b1acb37fc7737ef34236f6f (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
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
{
 "metadata": {
  "name": "",
  "signature": "sha256:fb68f886b3c2cdc28623218c177a66cd2a93d17c7bf83ed92891b0a04da2f4c6"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Ch-4, Tariffs & Power Factor Improvement"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 4.1 page 59"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "day=30 #days \n",
      "pll=40 ;nll=5; tll=3 #light load \n",
      "pfl=100; nfl=3 ;tfl=5 #fan load\n",
      "prl=1*1000 #refrigerator\n",
      "pml=1*1000; nml=1 #misc. load \n",
      "t1=2.74 ;t11=15#tariff\n",
      "t2=2.70 ;t22=25  #tariff on 25 units\n",
      "tr=2.32  #reamaining units\n",
      "tc=7.00 #constant charge\n",
      "dis=0.05#discount for prompt payment\n",
      "te=(pll*nll*tll+pfl*nfl*tfl)*day+prl*day+pml*day\n",
      "tee=te/1000\n",
      "mb=tc+tr*(tee-t11-t22)+t1*t11+t2*t22\n",
      "nmb=mb*(1-dis)\n",
      "print \"total energy consumption in %d day %dunits \\nthe monthly bill Rs%.2f \\nnet monthly bill Rs%.2f\"%(day,tee,mb,nmb)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "total energy consumption in 30 day 123units \n",
        "the monthly bill Rs308.16 \n",
        "net monthly bill Rs292.75\n"
       ]
      }
     ],
     "prompt_number": 75
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 4.2 Page 59"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "l=100 #connected load\n",
      "md=80 #maximum demand\n",
      "wt=0.6  #working time\n",
      "c=6000  #constant cost\n",
      "t=700  #cost on per kW\n",
      "re=1.8 #rate\n",
      "ec=l*wt*8760#electricity consumption per year\n",
      "teb=c+md*t+re*ec #total electricity bill per year\n",
      "print \" energy consumption %dkWh \\n total electricity bill per year Rs%d\"%(ec,teb)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " energy consumption 525600kWh \n",
        " total electricity bill per year Rs1008080\n"
       ]
      }
     ],
     "prompt_number": 76
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 4.3 Page 60"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "md=160 ;lff=0.7 ;dfc=1.7#maximum demand #load factor#diversity factor bt consumers\n",
      "ic=200 #installed capacity\n",
      "ccp=30000#capital cost of plant per kW\n",
      "ctds=1800*10**6 #capital cost of transmission and distribution\n",
      "idi=0.11 #interest,depreciation insurance and taxes on capital investiment\n",
      "fmc=30*10**6  #fixed managerial and general maintanance cost\n",
      "ol=236*10**6 #operating labour,maintanance and suppies\n",
      "cm=90*10**6 #cost of metering,billing and collection\n",
      "eca=0.05  #energy consumed by auxillary\n",
      "el=0.15#energy loss and maintanance\n",
      "p=0.25\n",
      "lf=0.8#load factor\n",
      "ap=0.5 #addition energy for profit\n",
      "print 'a'\n",
      "print \" capital cost of plant Rs%e \\n total capital cost Rs%e\\n interest,depereiation system Rs%e \"%(ccp*ic*10**3,ccp*ic*10**3+ctds,(ccp*ic*10**3+ctds)*idi)\n",
      "print \"\\n sum of maximum demand of consumers energy prodused %dMW \\n energy produced %ekWh \\n energy consumed by auxilliries %ekWh\\n energy output %ekWH \\n energy sold to consumer %ekWh\\n\"%(md*dfc,md*8760*lff*10**3,md*8760*lff*eca*10**3,md*8760*lff*10**3*(1-eca),md*8760*lff*10**3*(1-eca)*(1-el))\n",
      "print '(b)fixed cost'\n",
      "idetc=(ccp*ic*10**3+ctds)*idi\n",
      "tot=idetc+fmc \n",
      "print \" interest, deprecition etc Rs%e per year\\n managerial and maintence Rs%.eper year \\n total \\t Rs%e \"%(idetc,fmc,tot)\n",
      "pro=p*tot\n",
      "gtot=tot+pro\n",
      "print \"\\n profit@%d \\tRs%eper year \\n grand total Rs%e per year\"%(p*100,pro,gtot)\n",
      "print 'Operating cost'\n",
      "tot2=ol+cm\n",
      "pro2=tot2*p\n",
      "gtot2=tot2+pro2\n",
      "print \" Operating labour,supplies maintenance etc Rs.%eper year \\n metering,billing etc Rs%eper year\\n total\\t\\tRs%e per year\\n profit \\t Rs%eper year \\n grand total \\t Rs%e per year\"%(ol,cm,tot2,pro2,gtot2)\n",
      "print 'tariff'\n",
      "co=gtot/(md*dfc*1000)\n",
      "es=md*8760*lff*10**3*(1-eca)*(1-el)\n",
      "cs=gtot2/es\n",
      "print \" cost per kW \\tRs%e \\n cost per kWh \\tRs%e\"%(co,cs)\n",
      "print '(b)'\n",
      "ep=md*1000*8760*lf\n",
      "print \" energy produced %ekWh \\n energy consumed by auxiliaries %ekWh/year \\n energy output of plant %ekWh \\n energy sold to consumer %ekWh\"%(ep,ep*eca,ep*(1-eca),ep*(1-eca)*(1-el))\n",
      "estc=ep*(1-eca)*(1-el)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "a\n",
        " capital cost of plant Rs6.000000e+09 \n",
        " total capital cost Rs7.800000e+09\n",
        " interest,depereiation system Rs8.580000e+08 \n",
        "\n",
        " sum of maximum demand of consumers energy prodused 272MW \n",
        " energy produced 9.811200e+08kWh \n",
        " energy consumed by auxilliries 4.905600e+07kWh\n",
        " energy output 9.320640e+08kWH \n",
        " energy sold to consumer 7.922544e+08kWh\n",
        "\n",
        "(b)fixed cost\n",
        " interest, deprecition etc Rs8.580000e+08 per year\n",
        " managerial and maintence Rs3e+07per year \n",
        " total \t Rs8.880000e+08 \n",
        "\n",
        " profit@25 \tRs2.220000e+08per year \n",
        " grand total Rs1.110000e+09 per year\n",
        "Operating cost\n",
        " Operating labour,supplies maintenance etc Rs.2.360000e+08per year \n",
        " metering,billing etc Rs9.000000e+07per year\n",
        " total\t\tRs3.260000e+08 per year\n",
        " profit \t Rs8.150000e+07per year \n",
        " grand total \t Rs4.075000e+08 per year\n",
        "tariff\n",
        " cost per kW \tRs4.080882e+03 \n",
        " cost per kWh \tRs5.143550e-01\n",
        "(b)\n",
        " energy produced 1.121280e+09kWh \n",
        " energy consumed by auxiliaries 5.606400e+07kWh/year \n",
        " energy output of plant 1.065216e+09kWh \n",
        " energy sold to consumer 9.054336e+08kWh\n"
       ]
      }
     ],
     "prompt_number": 77
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 4.4 Page 61"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "v=230 ;ec=2020 #voltage #energy consumption\n",
      "i=40; pf=1 ;t=2; c=3.5; rc=1.8 ;mon=30 #current/power factor/time/cost/reamining cost/month\n",
      "ecd=v*i*pf*t*mon/1000 #energy corresponding to maximum demand\n",
      "cost=ecd*c\n",
      "ren=ec-ecd\n",
      "rcost=ren*rc\n",
      "tmb=cost+rcost\n",
      "at=tmb/ec\n",
      "print \" energy corresponding to maximum demand %dkWh \\n cost of above energy Rs%d \\n remaining energy %dkWh \\n cost of reamaining energy Rs%.1f \\n total monthly bill Rs.%.1f\\n avarage tariff Rs%.3fper kWh\"%(ecd,cost,ren,rcost,tmb,at)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " energy corresponding to maximum demand 552kWh \n",
        " cost of above energy Rs1932 \n",
        " remaining energy 1468kWh \n",
        " cost of reamaining energy Rs2642.4 \n",
        " total monthly bill Rs.4574.4\n",
        " avarage tariff Rs2.265per kWh\n"
       ]
      }
     ],
     "prompt_number": 78
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 4.5 Page 62"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "t1=3000 ;t11=0.9 #cost equation \n",
      "t2=3  #rate\n",
      "x=t1/(t2-t11)\n",
      "print \"if energy consumption per month is more than %.1fkWh,\\ntariff is more suitable\"%(x)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "if energy consumption per month is more than 1428.6kWh,\n",
        "tariff is more suitable\n"
       ]
      }
     ],
     "prompt_number": 79
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 4.6 Page 62"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "aec=201500 #annual energy consumption\n",
      "lf=0.35#load factor constnt\n",
      "t=4000#tariff\n",
      "tmd=1200#tariff for maximum demand\n",
      "t3=2.2\n",
      "lfb=0.55 #load factor improved\n",
      "ecd=0.25#energy consumption reduced\n",
      "md=aec/(8760*lf)\n",
      "yb=t+md*tmd+t3*aec\n",
      "mdb=aec/(8760*lfb)\n",
      "ybb=t+mdb*tmd+t3*aec\n",
      "ne=aec*(1-ecd)\n",
      "md3=ne/(8760*lf)\n",
      "ybc=t+md3*tmd+t3*ne\n",
      "aeca=yb/aec\n",
      "aecb=ybb/aec\n",
      "aecc=ybc/ne\n",
      "print 'a'\n",
      "print \"maximum demand %.2fkW \\n yearly bill Rs.%d per year \\n(b)\\n maximum demand %.2fkW \\n yearly bill Rs.%dper year\"%(md,yb,mdb,ybb)\n",
      "print \"c\"\n",
      "print \" new energy %dkWh \\n maximum demand %.2fkW \\n yearly bill Rs.%dper year \\n average energy cost in case a Rs%.4fper kWh \\n average energy cost in case b Rs%.3fper kWh\\n average energy cost in case c Rs%.3fper kWh \"%(ne,md3,ybc,aeca,aecb,aecc)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "a\n",
        "maximum demand 65.72kW \n",
        " yearly bill Rs.526164 per year \n",
        "(b)\n",
        " maximum demand 41.82kW \n",
        " yearly bill Rs.497486per year\n",
        "c\n",
        " new energy 151125kWh \n",
        " maximum demand 49.29kW \n",
        " yearly bill Rs.395623per year \n",
        " average energy cost in case a Rs2.6112per kWh \n",
        " average energy cost in case b Rs2.469per kWh\n",
        " average energy cost in case c Rs2.618per kWh \n"
       ]
      }
     ],
     "prompt_number": 80
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 4.7 Page 66"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "pl1=20 ;pf1=0.8; t1=2000#load in MVA #power factor #duration\n",
      "pl2=10 ;pf2=0.8 ;t2=1000#load in MVA #power factor #duration\n",
      "pl3=2 ;pf3=0.8 ;t3=500#load in MVA #power factor #duration\n",
      "pt=20 #/transformar power rating\n",
      "fte=0.985 ;ste=0.99 #/full load efficiency for first and second transformer\n",
      "ftl=120 ;stl=90 #core  loss inKW for first and  second transformer\n",
      "cst=200000 #cost of second transformer with compared with first transformer\n",
      "aid=0.15 #annual  interest and depreciation\n",
      "ce=0.8 #cost of energy\n",
      "tfl=pt*(1-fte)*1000#total full load\n",
      "fle=tfl-ftl #full load copper loss\n",
      "elc=fle*t1+(fle*t2/(pt/pl2)**2)+(fle*t3/(pt/pl3)**2) #energy loss due to copper loss\n",
      "eli=ftl*(t1+t2+t3)#energy loss due to iron loss\n",
      "celo=(elc+eli)*ce #cost of energy loss\n",
      "print \" \\nfirst transformer : \"\n",
      "print \" total full load losses %dkW \\n full load copper losses %dkW \\n energy loss due to copper losses %dkWh/year\\n energy loss due to iron losses %dkWh/year \\n cost of energy losses Rs%dper year\"%(tfl,fle,elc,eli,celo)\n",
      "stfl=pt*(1-ste)*1000#total full load\n",
      "sle=stfl-stl#full load copper loss\n",
      "selc=sle*t1+(sle*t2/(pt/pl2)**2)+(sle*t3/(pt/pl3)**2)#energy loss due to copper loss\n",
      "seli=stl*(t1+t2+t3)#energy loss due to iron loss\n",
      "scelo=(selc+seli)*ce#cost of energy loss\n",
      "print \" \\nsecond transformer  :\"\n",
      "print \" total full load losses %dkW \\n full load copper losses %dkW \\n energy loss due to copper losses %dkWh/year\\n energy loss due to iron losses %dkWh/year \\n cost of energy losses Rs%dper year\"%(stfl,sle,selc,seli,scelo)\n",
      "aidc=stfl*aid*1000\n",
      "tybc=aidc+scelo\n",
      "print \" additional interest and depreciation due to higher cost of second transformer Rs%d \\n total yearly charges for second transformer Rs%d per year\"%(aidc,tybc)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " \n",
        "first transformer : \n",
        " total full load losses 300kW \n",
        " full load copper losses 180kW \n",
        " energy loss due to copper losses 405900kWh/year\n",
        " energy loss due to iron losses 420000kWh/year \n",
        " cost of energy losses Rs660720per year\n",
        " \n",
        "second transformer  :\n",
        " total full load losses 200kW \n",
        " full load copper losses 110kW \n",
        " energy loss due to copper losses 248050kWh/year\n",
        " energy loss due to iron losses 315000kWh/year \n",
        " cost of energy losses Rs450440per year\n",
        " additional interest and depreciation due to higher cost of second transformer Rs30000 \n",
        " total yearly charges for second transformer Rs480440 per year\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 4.8 Page 67"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import asin, acos, tan, cos\n",
      "p=500 #load\n",
      "pf=0.8#power factor\n",
      "t=400 #tariff\n",
      "md=100 #maximum demand tariff\n",
      "ccb=600 #cost of capacitor bank\n",
      "id=0.11#interest and deprecistion\n",
      "sd=ccb*id/t#sin(ph2)\n",
      "d2=asin(sd)\n",
      "pf2=cos(d2)\n",
      "kva=p*(tan(acos(pf))-tan(d2))\n",
      "print \" the most economic power factor %.3f lagging \\n kvar requirement %.2fkVAR\"%(pf2,kva)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " the most economic power factor 0.986 lagging \n",
        " kvar requirement 291.35kVAR\n"
       ]
      }
     ],
     "prompt_number": 82
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 4.9 Page 68"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "l1=300 #load and power factor for three different loads\n",
      "pf1=1 \n",
      "l2=1000 \n",
      "pf2=0.9 \n",
      "l3=1500 \n",
      "pf3=0.8\n",
      "print \" for %dkW unit power factor load \\n power factor angle %.f\\n reactive power %.fkvr\"%(l1,acos(pf1),l1*(tan(acos(pf1))))\n",
      "print \" \\nfor %dkW unit power factor load \\n power factor angle %.2f\\n reactive power %.2fkvr\"%(l2,acos(pf2),l2*(tan(acos(pf2))))\n",
      "print \" \\nfor %dkW unit power factor load \\n power factor angle %.2f\\n reactive power %.2fkvr\"%(l3,acos(pf3),l3*(tan(acos(pf3))))\n",
      "tl=l1+l2+l3\n",
      "tt=l3*(tan(acos(pf3)))+l2*(tan(acos(pf2)))+l1*(tan(acos(pf1)))\n",
      "print \"\\n total kW \\t%dkW\\n total kVAR %.1fkVAR \\n total kVA %.2fkVA \\n overall power factor %.3flagging\"%(tl,tt,(tl**2+tt**2)**0.5,tl/(tl**2+tt**2)**0.5)\n",
      "print \"\\n the maximum unity power factor load which yhe station can supply is equal to the kVA i.e.%.2fkVR\"%((tl**2+tt**2)**0.5)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " for 300kW unit power factor load \n",
        " power factor angle 0\n",
        " reactive power 0kvr\n",
        " \n",
        "for 1000kW unit power factor load \n",
        " power factor angle 0.45\n",
        " reactive power 484.32kvr\n",
        " \n",
        "for 1500kW unit power factor load \n",
        " power factor angle 0.64\n",
        " reactive power 1125.00kvr\n",
        "\n",
        " total kW \t2800kW\n",
        " total kVAR 1609.3kVAR \n",
        " total kVA 3229.54kVA \n",
        " overall power factor 0.867lagging\n",
        "\n",
        " the maximum unity power factor load which yhe station can supply is equal to the kVA i.e.3229.54kVR\n"
       ]
      }
     ],
     "prompt_number": 83
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 4.10 Page 68"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt, pi\n",
      "v=400#voltage\n",
      "i=25#/current\n",
      "pf=0.8#at power factor\n",
      "pf2=0.9#over all power factor\n",
      "kw=v*i*pf*sqrt(3)/1000\n",
      "print \"kw rating of induction motor %.2fkW\"%(kw)\n",
      "dm=acos(pf)\n",
      "rp=kw*tan(dm)\n",
      "print \"\\n power factor angle %.2f \\n reactive power %.2fkVR\"%(dm,rp)\n",
      "fdm=acos(pf2)\n",
      "rp2=kw*tan(fdm)\n",
      "print \"\\n final power factor %.2f \\n final reactance power %.2fkVR\"%(fdm,rp2)\n",
      "ckvb=rp-rp2\n",
      "cc=ckvb*1000/(sqrt(3)*v)\n",
      "vc=v/sqrt(3)\n",
      "xc=vc/cc\n",
      "f=50\n",
      "cec=1*10**(6)/(xc*2*pi*f)\n",
      "print \"\\n kvar rating of capacitor bank %.4f \\n current through each capacitor %.2fA\\n voltage across each capacitor %.2f \\n reactance of each capacitor %.2fohm \\n capacitance of each capacitance %.2fuf\"%(ckvb,cc,vc,xc,cec)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "kw rating of induction motor 13.86kW\n",
        "\n",
        " power factor angle 0.64 \n",
        " reactive power 10.39kVR\n",
        "\n",
        " final power factor 0.45 \n",
        " final reactance power 6.71kVR\n",
        "\n",
        " kvar rating of capacitor bank 3.6813 \n",
        " current through each capacitor 5.31A\n",
        " voltage across each capacitor 230.94 \n",
        " reactance of each capacitor 43.46ohm \n",
        " capacitance of each capacitance 73.24uf\n"
       ]
      }
     ],
     "prompt_number": 84
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 4.11 Page 69"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "v=400#line voltage\n",
      "i=50 #line current\n",
      "pf=0.8 #at power factor\n",
      "pf2=0.95 # overall power factor\n",
      "sm=25 #hp of synchronous motor \n",
      "e=0.9#efficiency\n",
      "kwri=v*i*pf*sqrt(3)/1000\n",
      "kvari=v*i*sqrt(3)/1000\n",
      "karri=(-kwri**2+kvari**2)**0.5\n",
      "kwsm=sm*735.5/(e*1000)\n",
      "tkw=kwri+kwsm\n",
      "print \" kw rating of installation %.1fkW \\n kVA rating of installation %.2fkva \\n kVAR rating %.2fkvar \\n kw input to synchrounous motor %.2fkw \\n total kw=%.2f\\n\"%(kwri,kvari,karri,kwsm,tkw)\n",
      "pd=acos(pf2)\n",
      "tkr=tkw*tan(pd)\n",
      "krsm=tkr-karri\n",
      "kasm=(kwsm**2+krsm**2)**0.5\n",
      "pfsm=kwsm/kasm\n",
      "if krsm<0:\n",
      "    ch='capacitor'\n",
      "    ich='leading'\n",
      "else:\n",
      "    ch='inductive'\n",
      "    ich='lagging'\n",
      "\n",
      "print \" overall power factor angle %.2fkw \\n total kvar %.2fkvar \\n kvar of synchrounous motor %.2fkvar %s \\n kva of synchrounous motor %.2fkva \\n power factor of synchrounous motor %.2f %s\"%(pd,tkr,krsm,ch,kasm,pfsm,ich)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " kw rating of installation 27.7kW \n",
        " kVA rating of installation 34.64kva \n",
        " kVAR rating 20.78kvar \n",
        " kw input to synchrounous motor 20.43kw \n",
        " total kw=48.14\n",
        "\n",
        " overall power factor angle 0.32kw \n",
        " total kvar 15.82kvar \n",
        " kvar of synchrounous motor -4.96kvar capacitor \n",
        " kva of synchrounous motor 21.02kva \n",
        " power factor of synchrounous motor 0.97 leading\n"
       ]
      }
     ],
     "prompt_number": 85
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 4.12 page 69"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sin, atan\n",
      "psm=100 #power of synchrounous motors\n",
      "pim=200 #power of inducion motor\n",
      "v=400 #voltage \n",
      "pff=0.71; pp=-1#power factor\n",
      "rsm=0.1 #resistance of synchrounous motor\n",
      "rt=0.03 #resistance of cable\n",
      "#pf(1)=1 ;p(1)=1 #power factor in a\n",
      "#pf(2)=0.8 ;p(2)=1 #power factor in b\n",
      "#pf(3)=0.6 ;p(3)=1 #power factor in c\n",
      "pf =[1,0.8,0.6]\n",
      "p = [1,1,1]\n",
      "\n",
      "i1=pim*1000/(v*pff*sqrt(3))\n",
      "i11=i1*(complex(pff,pp*sin(acos(pff))))\n",
      "i2f=psm*1000/(v*sqrt(3))\n",
      "ch=['a', 'b', 'c']\n",
      "it = range(0,3)\n",
      "opf = range(0,3)\n",
      "for i in range(0,3):\n",
      "    print \"\\n (%s)\"%(ch[i])\n",
      "    d=acos(pf[i])\n",
      "    #it(i)=i11(1)+complex(i2f,(p(i)*i2f*tand(d)))\n",
      "    it[i]=i11+complex(i2f,(p[i]*i2f*tan(d)))\n",
      "    opf[i]=cos(atan((it[i]).imag/(it[i]).real))\n",
      "    clsm=3*((i2f)**2)*rsm\n",
      "    clt=3*(abs(it[i])**2)*rt/1000\n",
      "    print \"\\n total current =\",it[i]\n",
      "    print \"\\n overall power factor %.3f lagging \\n copper losses in synchrounous motor %.fW \\n copper losses in cable %.2fKW\"%(opf[i],clsm,clt)\n",
      "\n",
      "print \"(d)\"\n",
      "print \"copper loss of synchronous motor this is evidently minimum when tand=%d cosd=%d\"%(0,1)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        " (a)\n",
        "\n",
        " total current = (433.012701892-286.317624651j)\n",
        "\n",
        " overall power factor 0.834 lagging \n",
        " copper losses in synchrounous motor 6250W \n",
        " copper losses in cable 24.25KW\n",
        "\n",
        " (b)\n",
        "\n",
        " total current = (433.012701892-178.064449178j)\n",
        "\n",
        " overall power factor 0.925 lagging \n",
        " copper losses in synchrounous motor 6250W \n",
        " copper losses in cable 19.73KW\n",
        "\n",
        " (c)\n",
        "\n",
        " total current = (433.012701892-93.8675349216j)\n",
        "\n",
        " overall power factor 0.977 lagging \n",
        " copper losses in synchrounous motor 6250W \n",
        " copper losses in cable 17.67KW\n",
        "(d)\n",
        "copper loss of synchronous motor this is evidently minimum when tand=0 cosd=1\n"
       ]
      }
     ],
     "prompt_number": 86
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 4.13 Page 71"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import atan\n",
      "p=2#constant output in MW\n",
      "pf=0.9#power factor\n",
      "pa=10#load\n",
      "pb=5\n",
      "pfb=0.8#power factor at load of 5MW\n",
      "td=tan(acos(pf))\n",
      "go=p*(1-td*1J)\n",
      "op=0.8\n",
      "tp=tan(acos(pfb))\n",
      "print \"power factor of indection generator is leading therefor induction generator output %d%.2fiMVA /n (a) \\n\"%(go.real,go.imag)\n",
      "tl=pa*(1+tp*1J)\n",
      "sg=tl-go\n",
      "da=atan(sg.imag/sg.real)\n",
      "print \" total load %d+%.1fiMW \\n synchronous generator load %d+%.3fiMW \\n\\t\\t=%.2fMW at angle %.2f \\n power factor of synchronous generator is %.2flagging\"%(tl.real,tl.imag,sg.real,sg.imag,abs(sg),da,cos(da))\n",
      "tl1=pb*(1+tp*1J)\n",
      "sg1=tl1-go\n",
      "da1=atan(sg1.imag/sg1.real)\n",
      "print \"(b)\"\n",
      "print \" total load %d+%.1fiMW \\n synchronous generator load %d+%.3fiMW \\n\\t\\t=%.2fMW at angle %.2f \\n power factor of synchronous generator is %.2flagging\"%(tl1.real,(tl1).imag,sg1.real,(sg1).imag,abs(sg1),da1,cos(da1))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "power factor of indection generator is leading therefor induction generator output 2-0.97iMVA /n (a) \n",
        "\n",
        " total load 10+7.5iMW \n",
        " synchronous generator load 8+8.469iMW \n",
        "\t\t=11.65MW at angle 0.81 \n",
        " power factor of synchronous generator is 0.69lagging\n",
        "(b)\n",
        " total load 5+3.7iMW \n",
        " synchronous generator load 3+4.719iMW \n",
        "\t\t=5.59MW at angle 1.00 \n",
        " power factor of synchronous generator is 0.54lagging\n"
       ]
      }
     ],
     "prompt_number": 87
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 4.14 page 71"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "c=40*10**(-6) #bank of capacitors in farads\n",
      "v=400 #line voltage\n",
      "i=40#/line current\n",
      "pf=0.8#power factor\n",
      "f=50#line frequency\n",
      "xc=1/(2*pi*f*c)\n",
      "ic=v/(sqrt(3)*xc)\n",
      "il=i*(pf-sin(acos(pf))*1J)\n",
      "til=il+1J*ic\n",
      "od=atan(til.imag/til.real)\n",
      "opf=cos(od)\n",
      "nlol=(abs(od)/i)**2\n",
      "print \"(a)\"\n",
      "print \" line current of capacitor bank %.1fA \\n load current %d%diA \\n total line current %d%.1fjA \\n overall p.f %.3f \\n new line loss to old line loss  %.3f\"%(ic,il.real,il.imag,(til).real,(til).imag,opf,nlol)\n",
      "pcb=(v/xc)\n",
      "print \"\\n phase current of capacitor bank %.3fA\"%(pcb)\n",
      "lcb=pcb*sqrt(3)\n",
      "print \"\\n line current of capacitor bank %.1fA\"%(lcb)\n",
      "tcu=il+lcb*1J\n",
      "print \"\\n total current =\",tcu\n",
      "print \"%.1fjA =%.2fA at an angle %.2f\"%(tcu.imag,abs(tcu),atan(tcu.imag/tcu.real))\n",
      "pf2=cos(atan(tcu.imag/(tcu).real))\n",
      "print \"\\n power factor %.1f \\n ratio of new line loss to original loss %.3f\"%(pf2,(abs(tcu)/i)**2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)\n",
        " line current of capacitor bank 2.9A \n",
        " load current 32-23iA \n",
        " total line current 32-21.1jA \n",
        " overall p.f 0.835 \n",
        " new line loss to old line loss  0.000\n",
        "\n",
        " phase current of capacitor bank 5.027A\n",
        "\n",
        " line current of capacitor bank 8.7A\n",
        "\n",
        " total current = (32-15.2937630517j)\n",
        "-15.3jA =35.47A at an angle -0.45\n",
        "\n",
        " power factor 0.9 \n",
        " ratio of new line loss to original loss 0.786\n"
       ]
      }
     ],
     "prompt_number": 88
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 4.15 Page 72"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "p=30 #b.h.p of induction motor\n",
      "f=50#line frequency\n",
      "v=400#line voltage\n",
      "e=0.85#effiency\n",
      "pf=0.8 #power factor\n",
      "i=p*746/(v*e*pf*sqrt(3))\n",
      "i=i*complex(pf,-sin(acos(pf)))\n",
      "ccb=(i).imag/sqrt(3)\n",
      "xc=v/ccb\n",
      "c=10**6/(2*f*pi*xc)\n",
      "prl=((abs(i)**2-i.real**2)/abs(i)**2)*100\n",
      "print \" current drawn by motor is %.1fA \\n \"%abs(i)\n",
      "print \"the line loss will be minimum when i is munimum.the minimum value of i is\",i,\"A\"\n",
      "print \" and occurs when the capacitor bank draws a line current of %djA \\n capacitor C %.2fuf \\n percentage loss reduction %d\"%(i.imag,abs(c),prl)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " current drawn by motor is 47.5A \n",
        " \n",
        "the line loss will be minimum when i is munimum.the minimum value of i is (38.0032324249-28.5024243187j) A\n",
        " and occurs when the capacitor bank draws a line current of -28jA \n",
        " capacitor C 130.95uf \n",
        " percentage loss reduction 35\n"
       ]
      }
     ],
     "prompt_number": 89
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 4.16 page 72"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "po=666.66 #power\n",
      "f=50 #frequency\n",
      "v=400 #voltage\n",
      "pf=0.8  ;p=-1#power factor\n",
      "pf2=0.95 ;p2=-1#improved power factor\n",
      "vc=2200 #capacitor voltage \n",
      "rc=vc\n",
      "il=po*1000/(v*pf*sqrt(3))\n",
      "il1=il*(complex(pf,p*sin(acos(pf))))\n",
      "i2c=il*pf\n",
      "tad=tan(acos(pf2))\n",
      "i2=complex(i2c,i2c*tad*p2)\n",
      "print \" load current i1 =\",il1,\"A \"\n",
      "print \"\\n load current current on improved power factor =\",i2,\"A\"\n",
      "print \"(a)\"\n",
      "ic=abs(il1-i2)\n",
      "ilc=ic*v/vc\n",
      "pic=ilc/sqrt(3)\n",
      "xc=vc/pic\n",
      "ca=10**6/(2*pi*f*xc)\n",
      "print \" line current of %dV capacitor bank %.2fA\\n line current of %d capacitor bank %.2fA \\n phase current of capacitor bank %.2fA \\n reactance %.2f \\n capacitance %.2fF*10**(-6)\"%(v,ic,vc,ilc,pic,xc,ca)\n",
      "print \"(b)\"\n",
      "kr=3*vc*pic/1000\n",
      "print \" kVA rating %.1fkVA \\n kVA rating of transformer to convert %dV to %dV will be the same as the kVA rating of capacitor bank\"%(kr,v,vc)\n",
      "pl=100*(abs(il1)**2-abs(i2)**2)/abs(il1)**2\n",
      "print \"percentage reduction in losses %d percent\"%(pl)\n",
      "print \"(d)\"\n",
      "pi=ic/sqrt(3)\n",
      "xcc=v/pi\n",
      "cc=1*10**6/(2*pi*f*xcc)\n",
      "roc=ca/cc\n",
      "print \" phase current %.1fA \\n reactance %.2fohm \\n capasitance %.2f*10**-6F \\n ratio of capacitance %.3f\"%(pi,xcc,cc,roc)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " load current i1 = (962.240826145-721.680619609j) A \n",
        "\n",
        " load current current on improved power factor = (962.240826145-316.273264908j) A\n",
        "(a)\n",
        " line current of 400V capacitor bank 405.41A\n",
        " line current of 2200 capacitor bank 73.71A \n",
        " phase current of capacitor bank 42.56A \n",
        " reactance 51.70 \n",
        " capacitance 61.57F*10**(-6)\n",
        "(b)\n",
        " kVA rating 280.9kVA \n",
        " kVA rating of transformer to convert 400V to 2200V will be the same as the kVA rating of capacitor bank\n",
        "percentage reduction in losses 29 percent\n",
        "(d)\n",
        " phase current 234.1A \n",
        " reactance 1.71ohm \n",
        " capasitance 25.00*10**-6F \n",
        " ratio of capacitance 2.463\n"
       ]
      }
     ],
     "prompt_number": 90
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 4.17 Page 74"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "v1=132#line voltage at primary\n",
      "v2=11#line voltage at secondary\n",
      "p=10 #power\n",
      "pf=0.8 #power factor\n",
      "mva=p*(complex(pf,sin(acos(pf))))\n",
      "print \" MVA rating of secondary = %dMVA =%d+%djMVA \\n \"%(p,abs(mva),mva.imag)\n",
      "print \"\\n since the power factor at primary terminals is unity,rating of primary need be %dMVA only \\n the tertiary will supply capacitor curren.since p.f is to be raised to 1 ,the mav compensation needed is 6MVA so rating of teritiary is %dMVA\"%(abs(mva),mva.imag)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " MVA rating of secondary = 10MVA =9+5jMVA \n",
        " \n",
        "\n",
        " since the power factor at primary terminals is unity,rating of primary need be 9MVA only \n",
        " the tertiary will supply capacitor curren.since p.f is to be raised to 1 ,the mav compensation needed is 6MVA so rating of teritiary is 5MVA\n"
       ]
      }
     ],
     "prompt_number": 91
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 4.18 Page 74"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "v=11 #line voltage\n",
      "f=50#line frequency\n",
      "l=400 #load of alternator\n",
      "pf=0.8 #power factor\n",
      "e=0.85#efficiency\n",
      "p=l/pf\n",
      "lo=l+p*sin(acos(pf))*1J\n",
      "print \"a\"\n",
      "print \"when pf is rased to 1 the alternator can supply %dkW for the same value of armture current hence it can supply %dKW to synchronous motor\"%(p,p-l)\n",
      "print \"b\"\n",
      "print \"b.h.p =%.2fHP\"%(100*e/0.746)\n",
      "kvam=p-lo\n",
      "td=atan((kvam).imag/(kvam).real)\n",
      "pff=cos(td)\n",
      "print \"\\ncosd=%.3fleading\"%(pff)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "a\n",
        "when pf is rased to 1 the alternator can supply 500kW for the same value of armture current hence it can supply 100KW to synchronous motor\n",
        "b\n",
        "b.h.p =113.94HP\n",
        "\n",
        "cosd=0.316leading\n"
       ]
      }
     ],
     "prompt_number": 92
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 4.19 Page 74"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "kw=100  #let kw=100kw\n",
      "pf=0.6 #power foctor\n",
      "pf2=0.8 #power factor\n",
      "kvar=kw*tan(acos(pf))\n",
      "kvar2=kw*tan(acos(pf2))\n",
      "ckar=((kvar-kvar2))/10\n",
      "ck=round(ckar)*10\n",
      "print \" capacitor kVAR required for %dkW\\n load for same power factor improvement %dKVAR\"%(round(ckar),ck)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " capacitor kVAR required for 6kW\n",
        " load for same power factor improvement 60KVAR\n"
       ]
      }
     ],
     "prompt_number": 93
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 4.20 Page 75"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "p=160 #kva for transformer \n",
      "pf=0.6 #power factor\n",
      "el=96 #effective load\n",
      "eli=120 #effective load increase\n",
      "rc=eli*(tan(acos(pf))-tan(acos(eli/p)))\n",
      "opf=eli/p\n",
      "print \" required capacitor kVAR %dKVAR \\n overall power factor %.2f \\n it is seen that point d is on %.2f line\"%(rc,opf,opf)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " required capacitor kVAR 54KVAR \n",
        " overall power factor 0.75 \n",
        " it is seen that point d is on 0.75 line\n"
       ]
      }
     ],
     "prompt_number": 94
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 4.21 page 76"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "md=800 #maximum demand\n",
      "pf=0.707 #power factor\n",
      "c=80 #cost\n",
      "p=200 #power\n",
      "e=0.99#efficiency\n",
      "pff=0.8 #fulload pf\n",
      "ikva=md/pf\n",
      "iafc=(round(ikva*100)*(c)/100)\n",
      "rsm=ikva*pf\n",
      "act=p*(0.7355)/e\n",
      "at=-act*sin(acos(pff))\n",
      "tkw=rsm+act\n",
      "tkvr=rsm+at\n",
      "tkva=(tkw**2+tkvr**2)**0.5\n",
      "ikvad=tkva-ikva\n",
      "infc=ikvad*c\n",
      "print \" initial kVA %.2fkVA \\n initial annual fixed charges Rs%.1f \\n after installation of synchronous motor reactive power of induction motor %dkVars\\n active power input of synchrounous motor %.2fkW\\n reactive power input to synchrounous motor %.2fKVAR \\n total kW %.2fKW \\n total kVars %.2fkVARS \\n total kVA %.2fkVA \\n increase in KVA demand %.2fkVA\\n increase in annual fixed charges Rs%.1f \"%(ikva,iafc,rsm,act,at,tkw,tkvr,tkva,ikvad,infc)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " initial kVA 1131.54kVA \n",
        " initial annual fixed charges Rs90523.2 \n",
        " after installation of synchronous motor reactive power of induction motor 800kVars\n",
        " active power input of synchrounous motor 148.59kW\n",
        " reactive power input to synchrounous motor -89.15KVAR \n",
        " total kW 948.59KW \n",
        " total kVars 710.85kVARS \n",
        " total kVA 1185.38kVA \n",
        " increase in KVA demand 53.84kVA\n",
        " increase in annual fixed charges Rs4306.9 \n"
       ]
      }
     ],
     "prompt_number": 95
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 4.22 Page 77"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "t=16#working  time\n",
      "d=300 #working days\n",
      "hv=1 ;hvmd=50 #tariff on high voltage\n",
      "lv=1.1 ;lvmd=60 #tariff on low voltage\n",
      "al=250#avarage load\n",
      "pf=0.8#power factor\n",
      "md=300 #maximum demand\n",
      "hvec=500#cost of hv equipment\n",
      "l=0.05 #loss of hv equipment\n",
      "id=0.12  #interest and deprecistion\n",
      "ter=al*md*t \n",
      "mdv=md/pf\n",
      "print \" total energy requirement %2.2ekWH \\n maximum demand %dKVA\"%(ter,mdv)\n",
      "print \"(a)HV supply\"\n",
      "chv=mdv*hvec\n",
      "idc=chv*id\n",
      "ere=ter/(1-l)\n",
      "dch=mdv*hvmd\n",
      "ech=round(ere*hv/1000)*1000\n",
      "tanc=ech+dch+idc\n",
      "print \" cost of HV equipment Rs%e\\n interest and depreciation charges Rs%d \\n energy received %ekWh\\n demand charges Rs%d \\n energy charges Rs%2e \\n total annual cost Rs%d\"%(chv,idc,ere,dch,ech,tanc)\n",
      "print \"(b) LV supply\"\n",
      "lvdc=mdv*lvmd\n",
      "lvec=ter*lv\n",
      "lvtac=lvec+lvdc\n",
      "lvdac=lvtac-tanc\n",
      "print \" demand charges Rs%d \\n energy charges Rs%2.e \\n total annual cost Rs%d \\n difference in annual cost Rs%d\"%(lvdc,lvec,lvtac,lvdac)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " total energy requirement 1.20e+06kWH \n",
        " maximum demand 375KVA\n",
        "(a)HV supply\n",
        " cost of HV equipment Rs1.875000e+05\n",
        " interest and depreciation charges Rs22500 \n",
        " energy received 1.263158e+06kWh\n",
        " demand charges Rs18750 \n",
        " energy charges Rs1.263000e+06 \n",
        " total annual cost Rs1304250\n",
        "(b) LV supply\n",
        " demand charges Rs22500 \n",
        " energy charges Rs1e+06 \n",
        " total annual cost Rs1342500 \n",
        " difference in annual cost Rs38250\n"
       ]
      }
     ],
     "prompt_number": 96
    }
   ],
   "metadata": {}
  }
 ]
}