summaryrefslogtreecommitdiff
path: root/sample_notebooks/Hrituraj/Chapter7.ipynb
blob: 71496b0e8b044d803a321c9e1a3ec263141905b4 (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
{
 "metadata": {
  "name": "",
  "signature": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter7 - Distribution systems"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 7.1 - page 174"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import cmath\n",
      "#Given data : \n",
      "l=1 #in km\n",
      "I=100 #in Ampere\n",
      "cosfi=0.8 #Power factor(lag) unitless\n",
      "VC=200 #in volt\n",
      "IL=60 #in Ampere\n",
      "cosfi_load=0.9 #Power factor(lag) unitless\n",
      "R=0.6 #in ohm\n",
      "XL=0.08 #in ohm\n",
      "IC=I*complex(0.8,-0.6) #in Ampere\n",
      "z=complex(0.06,0.08)/2 #in ohm\n",
      "VD_BC=z*IC #in volt\n",
      "VB=VC+VD_BC #in volt\n",
      "IB=IL*complex(0.9,-0.4357)+IC #in Ampere\n",
      "VD_AB=z*IB #in volt\n",
      "VD_AB=round(VD_AB.real,2)+round(VD_AB.imag,2)*1J\n",
      "print \"V.D. from sending end to mid point =\" ,VD_AB,\"Volt\"\n",
      "print \"V.D. from mid point to the far end =\",VD_BC,\"Volt\" "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "V.D. from sending end to mid point = (7.47+2.78j) Volt\n",
        "V.D. from mid point to the far end = (4.8+1.4j) Volt\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 7.2 - page 175"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from sympy import symbols\n",
      "#Given data : \n",
      "l=500 #in meter\n",
      "i=1 #in Ampere/meter\n",
      "IL1=200;IL2=150;IL3=50;IL4=100 #in Ampere\n",
      "l1=100;l2=200;l3=300;l4=400 #in meter\n",
      "r=0.1 #in ohm/km\n",
      "Vd=250 #in volt\n",
      "I=symbols('I')\n",
      "Drop_AC=100*(r/10**3)*(I-i*l1/2) \n",
      "Drop_CD=I \n",
      "Drop_DE=100*r*(I-550)-I*100/2 \n",
      "Drop_EF=100*r*(I-700-I*100/2) \n",
      "Drop_FB=100*r*(I-900-I*100/2) \n",
      "VD_tot=0.05*I-27 #in volts\n",
      "#both ends are fed with same voltage,\n",
      "#VD_tot should be equal to zero.\"\n",
      "I=27/0.05 #in Ampere\n",
      "print \"Curent = %0.2f Ampere\" %I\n",
      "Drop_AD=(0.01*I-0.5)+(0.01*I-3.5) \n",
      "print \"Value at minimum potential at D = %0.2f V\" %(Vd-Drop_AD)\n",
      "#Note : Ans in the book is wrong as 27/0.05 gives 540 instead of 54."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Curent = 540.00 Ampere\n",
        "Value at minimum potential at D = 243.20 V\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 7.3 - page 176"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "#Given data : \n",
      "l=250 #in meter\n",
      "VA=230 #in volt\n",
      "VB=232 #in volt\n",
      "r=0.5 #in ohm/km\n",
      "r=0.5/10**3 #in ohm/m\n",
      "RAC=r*50*2 #in ohm\n",
      "RCD=RAC;RDE=RAC;REF=RAC;RFB=RAC #in ohm\n",
      "#VA-VB=VAC+VCD+VDE+VEF+VFB #in volt\n",
      "Ia=(VA-VB+15)/(5*RAC) #Ampere\n",
      "IAC=Ia;ICD=IAC-20;IDE=IAC-60;IED=-IDE;IEF=IAC-100;IFE=-IEF;IFB=IAC-120;IBF=-IFB #in Ampere\n",
      "print \"IAC = %0.f A\" %IAC\n",
      "print \"ICD = %0.f A\" %ICD\n",
      "print \"IDE = %0.f A\" %IDE\n",
      "print \"IED = %0.f A\" %IED\n",
      "print \"IEF = %0.f A\" %IEF\n",
      "print \"IFE = %0.f A\" %IFE\n",
      "print \"IFB = %0.f A\" %IFB\n",
      "print \"IBF = %0.f A\" %IBF\n",
      "VAC=IAC*RAC #in volt\n",
      "VCD=ICD*RCD #in volt\n",
      "VD=VA-VAC-VCD #in volt\n",
      "print \"The minimum potential = %0.1f Volt\" %(VD)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "IAC = 52 A\n",
        "ICD = 32 A\n",
        "IDE = -8 A\n",
        "IED = 8 A\n",
        "IEF = -48 A\n",
        "IFE = 48 A\n",
        "IFB = -68 A\n",
        "IBF = 68 A\n",
        "The minimum potential = 225.8 Volt\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 7.4 - page 177"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "#Given data : \n",
      "VA=235 #in volt\n",
      "VB=236 #in volt\n",
      "l=200 #in meter\n",
      "IL1=20;IL2=40;IL3=25;IL4=30 #in Ampere\n",
      "l1=50;l2=75;l3=100;l4=50 #in meter\n",
      "r=0.4 #in ohm/km\n",
      "r=0.4/10**3 #in ohm/m\n",
      "RAC=r*l1*2 #in ohm\n",
      "RCD=r*(l2-l1)*2*RAC;RDE=r*(l2-l1)*2*RAC;REF=r*l1*2*RAC;RFB=r*l1*2*RAC #in ohm\n",
      "#VA-VB=VAC+VCD+VDE+VEF+VFB #in volt\n",
      "IA=(VA-VB+9.6)/(0.16) #in Ampere\n",
      "IAC=IA;ICD=IA-IL1;IDE=IA-IL1-IL2;IEF=IA-IL1-IL2-IL3;IFB=IA-IL1-IL2-IL3-IL4 #in Ampere\n",
      "print \"IAC = %0.2f A\" %IAC\n",
      "print \"ICD = %0.2f A\" %ICD\n",
      "print \"IED = %0.2f A\" %(-IDE)\n",
      "print \"IFE = %0.2f A\" %-IEF\n",
      "print \"IFB = %0.2f A\" %-IFB\n",
      "VAC=IAC*RAC #in volt\n",
      "VCD=ICD*RCD #in volt\n",
      "VD=VA-VAC-VCD #in volt\n",
      "print \"The minimum potential = %0.3f Volt\" %VD\n",
      "# Answer wrong in the textbook due to accuracy."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "IAC = 53.75 A\n",
        "ICD = 33.75 A\n",
        "IED = 6.25 A\n",
        "IFE = 31.25 A\n",
        "IFB = 61.25 A\n",
        "The minimum potential = 232.823 Volt\n"
       ]
      }
     ],
     "prompt_number": 43
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 7.5 - page 179"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "#Given data : \n",
      "VA=400 #in volt\n",
      "r=0.03 #in ohm/km\n",
      "r=0.03/1000 #in ohm/m\n",
      "RAB=r*500*2 #in ohm\n",
      "RBC=r*300*2 #in ohm\n",
      "RAB=r*700*2 #in ohm\n",
      "RAB=r*500*2 #in ohm\n",
      "#VA-VB=VAC+VCD+VDE+VEF+VFB #in volt\n",
      "IA=(17.4)/(0.09) #in Ampere\n",
      "VAB=(RAB)*IA #in volt\n",
      "VB=VA-VAB #in volt\n",
      "print \"Voltage at B = %0.2f Volts\" %VB\n",
      "VBC=(RBC)*(IA-150) #in volt\n",
      "VC=VB-VBC #in volt\n",
      "print \"Voltage at C = %0.2f Volts\" %VC\n",
      "IBC=IA-150 #in A\n",
      "print \"Current in section BC = %0.2f A \"%IBC \n",
      "#Note : Answer of VB is wrong in the book."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltage at B = 394.20 Volts\n",
        "Voltage at C = 393.42 Volts\n",
        "Current in section BC = 43.33 A \n"
       ]
      }
     ],
     "prompt_number": 46
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 7.6 - page 180"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "#Given data : \n",
      "VA=240 #in volt\n",
      "MAxVDrop=VA*5/100 #in volt\n",
      "rho=2.87*10**-6 #in ohm-cm \n",
      "#VAB+VBC+VCA=0 #in volt\n",
      "IA=(3200)/(26) #in Ampere\n",
      "IAB=IA #in Ampere\n",
      "IBC=IA-100 #in Ampere\n",
      "#Allowed voltage drop: IAB*RAB+IBC*RBC=12\n",
      "R=12/(1015.26) #in ohm\n",
      "RAB=R*300*2/100 #in ohm\n",
      "RBC=R*600*2/100 #in ohm\n",
      "RCA=R*400*2/100 #in ohm\n",
      "#formula : R=rho*l/a\n",
      "a=rho*(100*100)/R #in cm**2\n",
      "print \"Cross section area = %0.2f cm2 \" %a"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Cross section area = 2.43 cm2 \n"
       ]
      }
     ],
     "prompt_number": 47
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 7.7 - page 182"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from numpy import sqrt\n",
      "#Given data : \n",
      "R=0.2 #in ohm/km\n",
      "X=0.1 #in ohm/km\n",
      "ZAM=((R+X*1J)/1000)*200 #in ohm\n",
      "ZMB=((R+X*1J)/1000)*100 #in ohm\n",
      "I1=100*(0.707-0.707*1J) #in A\n",
      "I2=200*(0.8-0.6*1J) #in A\n",
      "IAM=I1+I2 #in Ampere\n",
      "VAM=ZAM*IAM #in volts\n",
      "VMB=ZMB*I2 #in volts\n",
      "VAB=VAM+VMB #in volts\n",
      "magVAB=sqrt(VAB.real**2+VAB.imag**2) \n",
      "print \"Total voltage drop = %0.2f Volts\" %magVAB"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total voltage drop = 17.85 Volts\n"
       ]
      }
     ],
     "prompt_number": 50
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 7.8 - page 183"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from numpy import sqrt, sin, pi, arctan, arccos, cos\n",
      "import cmath\n",
      "#Given data : \n",
      "VB=200 #in volts\n",
      "R=0.2 #in ohm/km\n",
      "X=0.3 #in ohm/km\n",
      "I=100 #in Ampere\n",
      "ZAB=(R+X*1J) #in ohm\n",
      "ZMB=ZAB/2 #in ohm\n",
      "ZAM=ZMB #in ohm\n",
      "cosfi_1=0.6 #unitless\n",
      "cosfi_2=0.8 #unitless\n",
      "IMB=I*(cosfi_2-cosfi_1*1J) #in A\n",
      "I2=IMB #in Ampere\n",
      "VMB=IMB*ZMB #in volts\n",
      "VM=VB+VMB #in volts\n",
      "print \"Voltage at M = %.2f\u2220%.2f\u00b0\" %(abs(VM),cmath.phase(VM)*180/pi)\n",
      "#print('Sending end voltage , V_S = %.2f\u2220%.2f\u00b0 kV/phase' %(abs(V_S*10**-3),cmath.phase(V_S)*180/math.pi))\n",
      "fi=arctan(VM.imag/VM.real)*180/pi #in degree\n",
      "fi_1=arccos(cosfi_1)*180/pi #in degree\n",
      "fi_VBandI1=fi_1-fi #in degree\n",
      "I1=I*(cos(fi_VBandI1*pi/180)-sin(fi_VBandI1*pi/180))*1J #in Ampere\n",
      "IAM=I1+I2 #inA Ampere\n",
      "VAM=ZAM*IAM #in volts\n",
      "VA=VM+VAM #in volts\n",
      "magVA=sqrt(VA.real**2+VA.imag**2) \n",
      "print \"Voltage at A, standing end voltage = %0.2f Volts\" %magVA\n",
      "#Answer wrong in the textbook."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltage at M = 217.08\u22201.58\u00b0\n",
        "Voltage at A, standing end voltage = 236.65 Volts\n"
       ]
      }
     ],
     "prompt_number": 63
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 7.9 - page 184"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given data : \n",
      "l=500 #in meter\n",
      "VA=200 #in volt\n",
      "MAxVDrop=6 #in % of declared voltage \n",
      "rho=0.014 #in ohm/m \n",
      "#VD in the distributor=53*10**3*r\n",
      "AllowedVD=VA*(6/100) #in volts\n",
      "r=AllowedVD*10**6/(53*10**3) #in ohm/meter\n",
      "#formula : R=rho*l/a\n",
      "a=rho*(2*l)/r #in m**2\n",
      "print \"Cross section area = %0.2f m2 \" %(a)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Cross section area = 0.06 m2 \n"
       ]
      }
     ],
     "prompt_number": 64
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 7.10 - page 185"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given data : \n",
      "l=300 #in meter\n",
      "I=0.75 #in A/m\n",
      "R=0.00018 #in ohm/m\n",
      "x=200 #in meter\n",
      "Vs=250 #in volt\n",
      "VD=I*R*(l*x-x**2/2) #in volt\n",
      "V_A=Vs-VD #in volt(Voltage at 200m from end A)\n",
      "print \"Voltage as 200m from supply end A = %0.1f Volts\" %V_A"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltage as 200m from supply end A = 244.6 Volts\n"
       ]
      }
     ],
     "prompt_number": 66
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 7.11 - page 185"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given data : \n",
      "l=600 #in meter\n",
      "VA=440 #in volt\n",
      "VB=400 #in volt\n",
      "R=0.01 #in ohm/100m\n",
      "RAC=(R/100)*300 #in ohm\n",
      "RCD=(R/100)*300 #in ohm\n",
      "RDE=(R/100)*100 #in ohm\n",
      "REF=(R/100)*200 #in ohm\n",
      "RFB=(R/100)*300 #in ohm\n",
      "#VA-VB=VAC+VCD+VDE+VEF+VFB #in volt\n",
      "IA=(VA-VB+42.5)/(0.12) #in Ampere\n",
      "IAC=IA;ICD=IA-100;IDE=IA-300;IFE=IA-550;IFB=IA-850 #in Ampere\n",
      "print \"Current fed at A, IA = %0.1f A  \"%IAC \n",
      "print \"Current fed at B, IB = %0.1f A  \"%-IFB"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Current fed at A, IA = 687.5 A  \n",
        "Current fed at B, IB = 162.5 A  \n"
       ]
      }
     ],
     "prompt_number": 69
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 7.12 - page 187"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given data : \n",
      "VA=220 #in volt\n",
      "VB=200 #in volt\n",
      "R=0.1 #in ohm/km\n",
      "I=1 #in A/m\n",
      "l=500 #in meter\n",
      "R=2*R/1000 #in ohm/m\n",
      "x=(VA-VB)/(I*R*l)+l/2 #in meter\n",
      "Vmin=VA-I*R*x**2/2 #in volts\n",
      "print \"Value of minimum potential = %0.2f V  \"%Vmin \n",
      "IA=I*x #in A\n",
      "print \"Current supplied from end A = %0.f A   \" %IA \n",
      "IB=I*(l-x) #in A\n",
      "print \"Current supplied from end B = %0.f A\"%IB"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of minimum potential = 199.75 V  \n",
        "Current supplied from end A = 450 A   \n",
        "Current supplied from end B = 50 A\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 7.13 - page 187"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given data : \n",
      "VL=240 #in volt\n",
      "Router=0.2 #in ohm\n",
      "I1=VL/5 #in Ampere\n",
      "I2=VL/6 #in Ampere\n",
      "Ineutral=I1-I2 #in Ampere\n",
      "#Applying KVL on +ve side\n",
      "V1=VL+I1*0.2+8*0.4 #in volt\n",
      "print \"Voltage at +ve side = %0.1f V\" %V1\n",
      "#Applying KVL on +ve side\n",
      "V2=VL-(8*0.4)+I2*0.2 #in volt\n",
      "print \"Voltage at -ve side = %0.1f V\" %V2"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltage at +ve side = 252.8 V\n",
        "Voltage at -ve side = 244.8 V\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 7.14 - page 188"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given data : \n",
      "#Applying KVL on +ve side\n",
      "V1=200-(600*0.015)-(100)*0.03 #in volt\n",
      "print \"Voltage at +ve side = %0.f V\" %V1\n",
      "#Applying KVL on -ve side\n",
      "V2=200-(-100*0.03)-500*0.0015 #in volt\n",
      "print \"Voltage at -ve side = %0.1f V\" %V2\n",
      "#Note : answer of 2nd part is wrong in the book."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltage at +ve side = 188 V\n",
        "Voltage at -ve side = 202.2 V\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 7.15 - page 189"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from sympy import symbols\n",
      "x=symbols('x')\n",
      "#Given data : \n",
      "#VD in section AC from RHS: \n",
      "VD1=(40+x)*0.02+0.17*x\n",
      "#VD in section AC from LHS: \n",
      "VD2=(350-x)*0.015+(150-x)*0.03\n",
      "#Equating two VDs we get\n",
      "#x*0.02+0.17*x+0.015*x+x*0.03=350*0.015+150*0.03-40*0.02\n",
      "x=(350*0.015+150*0.03-40*0.02)/0.082 #in A\n",
      "VB=500-(x+40)*0.02 #in volts\n",
      "print \"Potential at point B = %0.2f V\" %VB\n",
      "VC=VB-(x*0.017) #in volts\n",
      "print \"Potential at point C = %0.2f V\" %VC\n",
      "VD=500-(350-x)*0.015 #in volts\n",
      "print \"Potential at point D = %0.2f V\" %VD\n",
      "#Note : Answer of 3rd part is given wrong in the book."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Potential at point B = 497.02 V\n",
        "Potential at point C = 495.16 V\n",
        "Potential at point D = 496.39 V\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 7.16 - page 190"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from sympy import symbols\n",
      "x=symbols('x')\n",
      "#Given data : \n",
      "#Applying KVL in loop AFEDA: \n",
      "p1=((0.016*x)+0.09*(x-30)+0.14*(x-17)-0.1*y) #eqn(1) \n",
      "#Applying KVL in loop ADCBA: \n",
      "p2=(0.1*y-0.12*(95-x-y)-.01*(145-x-y)-0.008*(165-x-y)) #eqn(2)\n",
      "#Equating two equtions we get\n",
      "#3.9*x-125=97.75-0.75*x\n",
      "x=(97.75+125)/(3.9+0.75) #in A\n",
      "y=97.75-0.75*x #in A\n",
      "print \"x = %0.f A\" %x \n",
      "print \"y = %0.2f A\"%y \n",
      "print \"Point of minimum ppotential is E.\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "x = 48 A\n",
        "y = 61.82 A\n",
        "Point of minimum ppotential is E.\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 7.17 - page 190"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given data : \n",
      "V=200 #in volt\n",
      "I=1 #in A/m\n",
      "R=2*0.05/1000 #in ohm/m\n",
      "l=1*1000 #in meter\n",
      "IT=I*l #in Ampere\n",
      "RT=R*l #in ohm\n",
      "VD=IT*RT/8 #in volt\n",
      "Vmin=V-VD #in volt\n",
      "print \"Minimum potential occurs at mid point. It is %0.2f V\" %Vmin"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Minimum potential occurs at mid point. It is 187.50 V\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 7.19 - page 191"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given data : \n",
      "VB=400 #in volt\n",
      "ZAC=0.04+0.08*1J #in ohm\n",
      "ZCB=0.08+1J*0.12 #in ohm\n",
      "I1=60*(0.8-1J*0.6) \n",
      "I2=120*(0.8-1J*0.6) \n",
      "VCB=I2*ZCB #in Volt\n",
      "VAC=(I1+I2)*ZAC #in volt\n",
      "VC=VB+I2*ZCB #in Volt\n",
      "print \"Voltage at C =\",VC,\"Volt\"\n",
      "VA=VC+(I1+I2)*ZAC #in volt\n",
      "print \"Voltage at A =\",VA,\"Volt\"\n",
      "#Answer not accurate in the textbook."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltage at C = (416.32+5.76j) Volt\n",
        "Voltage at A = (430.72+12.96j) Volt\n"
       ]
      }
     ],
     "prompt_number": 20
    }
   ],
   "metadata": {}
  }
 ]
}