summaryrefslogtreecommitdiff
path: root/Electrical_Circuit_Theory_And_Technology/chapter_36-checkpoint.ipynb
blob: 39a16efe5a309e50ae7569bb9262457d831bfb48 (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
{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h1>Chapter 36: Complex Waveforms</h1>"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 1, page no. 643</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#(a) Write down an expression to represent voltage v.\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "V = 240; # in Volts\n",
      "f = 50; # in Hz\n",
      "x = 0.2;\n",
      "phi3 = 3*math.pi/4; # in Rad\n",
      "\n",
      " #calculation:\n",
      "Vamp = V*2**0.5\n",
      "w = 2*math.pi*f\n",
      "T = 1/f\n",
      "V3 = Vamp*x\n",
      "f3 = 3*f\n",
      "w3 = 3*w\n",
      "\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  voltage, V =\",round(Vamp,1),\"sin(\",round(w,1),\"t) + \",round(V3,1),\"sin(\", round(w3,1),\"t - \", round(phi3,1),\") volts\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  voltage, V = 339.4 sin( 314.2 t) +  67.9 sin( 942.5 t -  2.4 ) volts"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 3, page no. 648</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine the rms value of the current waveform\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "A1  =  0.100;#  in  amperes\n",
      "A3  =  0.020;#  in  amperes\n",
      "A5  =  0.010;#  in  amperes\n",
      "\n",
      " #calculation:\n",
      " #the  rms  value  of  current  is  given  by\n",
      "Irms  =  ((A1**2  +  A3**2  +  A5**2)/2)**0.5\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  the  rms  value  of  current  is  \",round(Irms*1000,2),\" mA\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  the  rms  value  of  current  is   72.46  mA"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 4, page no. 649</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine for the voltage, (a) the rms value, (b) the mean value and (c) the form factor.\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "A1  =  10;#  in  volts\n",
      "A3  =  3;#  in  volts\n",
      "A5  =  2;#  in  volts\n",
      "\n",
      "#calculation:\n",
      " #the  rms  value  of  voltage  is  given  by\n",
      "Vrms  =  ((A1**2  +  A3**2  +  A5**2)/2)**0.5\n",
      " #the  mean  value  of  voltage  is  given  by\n",
      " #x  =  wt\n",
      "Vav  =  (1/math.pi)*((10 + 1 + 2/5)-(-10 - 1 - 2/5))\n",
      " #form  factor  is  given  by\n",
      "ff  =  Vrms/Vav\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  (a)the  rms  value  of  voltage  is  \",round(Vrms,2),\"  V\"\n",
      "print  \"\\n  (b)the  mean  value  of  voltage  is  \",round(Vav,2),\"  V\"\n",
      "print  \"\\n  (c)form  factor  is  \",round(ff,3),\"  \""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  (a)the  rms  value  of  voltage  is   7.52   V\n",
        "\n",
        "  (b)the  mean  value  of  voltage  is   7.26   V\n",
        "\n",
        "  (c)form  factor  is   1.036   "
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 5, page no. 649</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#(a) Determine the rms value of the fundamental and each harmonic. \n",
      "#(b) Write down an expression to represent the complex voltage waveform if the frequency of the fundamental is 31.83 Hz.\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "V  =  240;#  in  volts\n",
      "x  =  0.3;#  for  third  harmonic\n",
      "y  =  0.1;#  for  fifth  harmonic\n",
      "f  =  31.83;#  in  Hz\n",
      "\n",
      " #calculation:\n",
      " #V3  =  x*V1\n",
      " #V5  =  y*V1\n",
      " #the  rms  value  of  the  fundamental,\n",
      "V1  =  ((V**2)/(1  +  x**2  +  y**2))**0.5\n",
      " #Rms  value  of  the  third  harmonic\n",
      "V3  =  x*V1\n",
      " #the  rms  value  of  the  fifth  harmonic,\n",
      "V5  =  y*V1\n",
      " #Maximum  value  of  the  fundamental,\n",
      "V1m  =  V1*2**0.5\n",
      " #Maximum  value  of  the  third  harmonic,\n",
      "V3m  =  V3*2**0.5\n",
      " #Maximum  value  of  the  fifth  harmonic,\n",
      "V5m  =  V5*2**0.5\n",
      "w  =  2*math.pi*f\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"v  =  \",round(V1m,2),\"sin\",round(w,2),\"t  +  \",round(V3m,2),\"sin\",round((3*w),2),\"t  +  \",round(V5m,2),\"sin\",round((5*w),2),\"t  Volts\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "v  =   323.62 sin 199.99 t  +   97.08 sin 599.98 t  +   32.36 sin 999.97 t  Volts\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 6, page no. 652</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine the average power in a 20 ohm resistance\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "A1  =  12;#  in  amperes\n",
      "A3  =  5;#  in  amperes\n",
      "A5  =  2;#  in  amperes\n",
      "R  =  20;#  in  ohms\n",
      "\n",
      "#calculation:\n",
      " #rms  current\n",
      "Irms  =  ((A1**2  +  A3**2  +  A5**2)/2)**0.5\n",
      " #average  power\n",
      "P  =  R*Irms**2\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  average  power  \",P,\"  W\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  average  power   1730.0   W"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 7, page no. 652</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine (a) the total active power supplied to the circuit, and (b) the overall power factor\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "Ia1  =  2;#  in  amperes\n",
      "Ia3  =  0.3;#  in  amperes\n",
      "Ia5  =  0.1;#  in  amperes\n",
      "Va1  =  60;#  in  volts\n",
      "Va3  =  15;#  in  volts\n",
      "Va5  =  10;#  in  volts\n",
      "Phii1  =  -1*math.pi/6;#  in  radians\n",
      "Phii3  =  -1*math.pi/12;#  in  radians\n",
      "Phii5  =  -8*math.pi/9;#  in  radians\n",
      "Phiv1  =  0;#  in  radians\n",
      "Phiv3  =  math.pi/4;#  in  radians\n",
      "Phiv5  =  -1*math.pi/2;#  in  radians\n",
      "\n",
      "\n",
      " #calculation:\n",
      " #rms  values;\n",
      "I1  =  Ia1/(2**0.5);#  in  amperes\n",
      "I3  =  Ia3/(2**0.5);#  in  amperes\n",
      "I5  =  Ia5/(2**0.5);#  in  amperes\n",
      "V1  =  Va1/(2**0.5);#  in  volts\n",
      "V3  =  Va3/(2**0.5);#  in  volts\n",
      "V5  =  Va5/(2**0.5);#  in  volts\n",
      " #total  power  supplied,\n",
      "P  =  V1*I1*math.cos(Phiv1  -  Phii1)  +  V3*I3*math.cos(Phiv3  -  Phii3)  +  V5*I5*math.cos(Phiv5  -  Phii5)\n",
      " #rms  current\n",
      "Irms  =  ((I1**2  +  I3**2  +  I5**2))**0.5\n",
      " #rms  voltage\n",
      "Vrms  =  ((V1**2  +  V3**2  +  V5**2))**0.5\n",
      " #overall  power  factor\n",
      "pf  =  P/(Vrms*Irms)\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n(a)the  total  active  power  supplied  to  the  circuit  \",round(P,2),\"  W\"\n",
      "print  \"\\n(b)overall  power  factor  \",round(pf,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "(a)the  total  active  power  supplied  to  the  circuit   53.26   W\n",
        "\n",
        "(b)overall  power  factor   0.84"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 8, page no. 655</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine for each case an expression for the current flowing if the fundamental frequency is 1 kHz.\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "R1  =  40;#  in  ohm\n",
      "L  =  7.96E-3;#  in  Henry\n",
      "C = 25E-6; # in Farad\n",
      "f = 1000; # in Hx\n",
      "\n",
      "#calculation:\n",
      "wL = 2*math.pi*1000*L\n",
      "wC = 2*math.pi*1000*C\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"(a)i  =  \",round(100/R1,2),\"sin(wt)  +\",round(30/R1,2),\"sin(3wt - pi/3)  +\",round(10/R1,2),\"sin(5wt - pi/6) A\"\n",
      "print  \"(b)i  =  \",round(100/wL,2),\"sin(wt - pi/2)  +\",round(30/(3*wL),2),\"sin(3wt - pi/6)  +\",round(10/(5*wL),2),\"sin(5wt - 2pi/3) A\"\n",
      "print  \"(c)i  =  \",round(100*wC,2),\"sin(wt + pi/2)  +\",round(30*3*wC,2),\"sin(3wt + 5pi/6)  +\",round(10*5*wC,2),\"sin(5wt + pi/3) A\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "(a)i  =   2.5 sin(wt)  + 0.75 sin(3wt - pi/3)  + 0.25 sin(5wt - pi/6) A\n",
        "(b)i  =   2.0 sin(wt - pi/2)  + 0.2 sin(3wt - pi/6)  + 0.04 sin(5wt - 2pi/3) A\n",
        "(c)i  =   15.71 sin(wt + pi/2)  + 14.14 sin(3wt + 5pi/6)  + 7.85 sin(5wt + pi/3) A\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 9, page no. 656</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine (a) an expression to represent the instantaneous value of the current, \n",
      "#(b) the rms voltage, (c) the rms current, (d) the power dissipated, and (e) the overall power factor.\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "V1m  =  240;#  in  volts\n",
      "V3m  =  40;#  in  volts\n",
      "V5m  =  30;#  in  volts\n",
      "w1  =  314;#  fundamental\n",
      "R  =  12;#  in  ohm\n",
      "L  =  0.00955;#  in  Henry\n",
      "\n",
      " #calculation:\n",
      " #fundamental  or  first  harmonic\n",
      " #inductive  reactance,\n",
      "XL1  =  w1*L\n",
      " #impedance  at  the  fundamental  frequency,\n",
      "Z1  =  R  +  1j*XL1\n",
      " #Maximum  current  at  fundamental  frequency\n",
      "I1m  =  V1m/Z1\n",
      "I1mag  =  abs(I1m)\n",
      "phii1  =  cmath.phase(complex(I1m.real,I1m.imag))\n",
      " #Third  harmonic\n",
      "XL3  =  3*XL1\n",
      " #impedance  at  the  third  harmonic  frequency,\n",
      "Z3  =  R  +  1j*XL3\n",
      " #Maximum  current  at  third  harmonic  frequency\n",
      "I3m  =  V3m/Z3\n",
      "I3mag  =  abs(I3m)\n",
      "phii3  =  cmath.phase(complex(I3m.real,I3m.imag))\n",
      " #fifth  harmonic\n",
      "XL5  =  5*XL1\n",
      " #impedance  at  the  third  harmonic  frequency,\n",
      "Z5  =  R  +  1j*XL5\n",
      " #Maximum  current  at  third  harmonic  frequency\n",
      "I5m  =  V5m/Z5\n",
      "I5mag  =  abs(I5m)\n",
      "phii5  =  cmath.phase(complex(I5m.real,I5m.imag))\n",
      " #rms  voltage\n",
      "Vrms  =  ((V1m**2  +  V3m**2  +  V5m**2)/2)**0.5\n",
      " #rms  current\n",
      "Irms  =  ((I1mag**2  +  I3mag**2  +  I5mag**2)/2)**0.5\n",
      " #power  dissipated\n",
      "P  =  R*Irms**2\n",
      " #overall  power  factor\n",
      "pf  =  P/(Vrms*Irms)\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n(a)i  =  \",round(I1mag,2),\"sin(\",round(w1,2),\"t  +  (\",round(phii1,2),\"))  +  \",round(I3mag,2),\"sin(\",round((w1*3),2),\"t  +  (\",round(phii3,2),\"))  +  \",round(I5mag,2),\"sin(\",round((w1*5),2),\"t  +  (\",round(phii5,2),\"))  A\"\n",
      "print  \"\\n(b)the  rms  value  of  current  is  \",round(Irms,2),\"  A\"\n",
      "print  \"\\n(c)the  rms  value  of  voltage  is  \",round(Vrms,2),\"  V\"\n",
      "print  \"\\n(d)the  total  power  dissipated  \",round(P,2),\"  W\"\n",
      "print  \"\\n(e)overall  power  factor  \",round(pf,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "(a)i  =   19.4 sin( 314.0 t  +  ( -0.24 ))  +   2.67 sin( 942.0 t  +  ( -0.64 ))  +   1.56 sin( 1570.0 t  +  ( -0.9 ))  A\n",
        "\n",
        "(b)the  rms  value  of  current  is   13.89   A\n",
        "\n",
        "(c)the  rms  value  of  voltage  is   173.35   V\n",
        "\n",
        "(d)the  total  power  dissipated   2316.26   W\n",
        "\n",
        "(e)overall  power  factor   0.96"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 10, page no. 658</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Obtain an expression for the current flowing and hence determine the rms value of current.\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "Vom  =  50;#  in  volts\n",
      "V1m  =  200;#  in  volts\n",
      "V2m  =  40;#  in  volts\n",
      "V4m  =  5;#  in  volts\n",
      "f  =  50;#  in  Hz\n",
      "R  =  50;#  in  ohm\n",
      "C  =  100E-6;#  in  farad\n",
      "phiv1  =  0;#  in  rad\n",
      "phiv2  =  -1*math.pi/2;#  in  rad\n",
      "phiv4  =  math.pi/4;#  in  rad\n",
      "\n",
      " #calculation:\n",
      " #voltage\n",
      "V1  =  V1m*math.cos(phiv1)  +  1j*V1m*math.sin(phiv1)\n",
      "V2  =  V2m*math.cos(phiv2)  +  1j*V2m*math.sin(phiv2)\n",
      "V4  =  V4m*math.cos(phiv4)  +  1j*V4m*math.sin(phiv4)\n",
      " #Inductance  has  no  effect  on  a  steady  current.  Hence  the  d.c.  component  of  the  current,  i0,  is  given  by\n",
      "Iom  =  0\n",
      " #fundamental  or  first  harmonic\n",
      "w1  =  2*math.pi*f\n",
      " #inductive  reactance,\n",
      "Xc1  =  1/(w1*C)\n",
      " #impedance  at  the  fundamental  frequency,\n",
      "Z1  =  R  +  1j*Xc1\n",
      " #Maximum  current  at  fundamental  frequency\n",
      "I1m  =  V1/Z1\n",
      "I1mag  =  abs(I1m)\n",
      "phii1  =  cmath.phase(complex(I1m.real,I1m.imag))\n",
      " #second  harmonic\n",
      "Xc2  =  Xc1/2\n",
      " #impedance  at  the  third  harmonic  frequency,\n",
      "Z2  =  R  +  1j*Xc2\n",
      " #Maximum  current  at  third  harmonic  frequency\n",
      "I2m  =  V2/Z2\n",
      "I2mag  =  abs(I2m)\n",
      "phii2  =  cmath.phase(complex(I2m.real,I2m.imag))\n",
      " #fourth  harmonic\n",
      "Xc4  =  Xc1/4\n",
      " #impedance  at  the  third  harmonic  frequency,\n",
      "Z4  =  R  +  1j*Xc4\n",
      " #Maximum  current  at  third  harmonic  frequency\n",
      "I4m  =  V4/Z4\n",
      "I4mag  =  abs(I4m)\n",
      "phii4  =  cmath.phase(complex(I4m.real,I4m.imag))\n",
      " #rms  current\n",
      "Irms  =  (Iom**2  +  (I1mag**2  +  I2mag**2  +  I4mag**2)/2)**0.5\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"(a)i = \",round(Iom,2),\" + \",round(I1mag,2),\"sin(\",round(w1,2),\"t  +  (\",round(phii1,2),\"))  +  \",round(I2mag,2),\"sin(\",round((w1*2),2),\"t  +  (\",round(phii2,2),\"))  +  \",round(I4mag,2),\"sin(\",round((w1*4),2),\"t  +  (\",round(phii4,2),\"))  A\"\n",
      "print  \"(b)the  rms  value  of  current  is  \",round(Irms,2),\"  A\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "(a)i =  0.0  +  3.37 sin( 314.16 t  +  ( -0.57 ))  +   0.76 sin( 628.32 t  +  ( -1.88 ))  +   0.1 sin( 1256.64 t  +  ( 0.63 ))  A\n",
        "(b)the  rms  value  of  current  is   2.45   A\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 11, page no. 659</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine (a) an expression to represent the current flowing in the circuit, \n",
      "#(b) the rms value of current, correct to two decimal places, and \n",
      "#(c) the power dissipated in the circuit, correct to three significant figures.\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "Vom  =  25;#  in  volts\n",
      "V1m  =  100;#  in  volts\n",
      "V3m  =  40;#  in  volts\n",
      "V5m  =  20;#  in  volts\n",
      "w1  =  10000;#  fundamental\n",
      "R  =  5;#  in  ohm\n",
      "L  =  500E-6;#  in  Henry\n",
      "phiv1  =  0;#  in  rad\n",
      "phiv3  =  math.pi/6;#  in  rad\n",
      "phiv5  =  math.pi/12;#  in  rad\n",
      "\n",
      " #calculation:\n",
      " #voltage\n",
      "V1  =  V1m*math.cos(phiv1)  +  1j*V1m*math.sin(phiv1)\n",
      "V3  =  V3m*math.cos(phiv3)  +  1j*V3m*math.sin(phiv3)\n",
      "V5  =  V5m*math.cos(phiv5)  +  1j*V5m*math.sin(phiv5)\n",
      " #Inductance  has  no  effect  on  a  steady  current.  Hence  the  d.c.  component  of  the  current,  i0,  is  given  by\n",
      "Iom  =  Vom/R\n",
      " #fundamental  or  first  harmonic\n",
      " #inductive  reactance,\n",
      "XL1  =  w1*L\n",
      " #impedance  at  the  fundamental  frequency,\n",
      "Z1  =  R  +  1j*XL1\n",
      " #Maximum  current  at  fundamental  frequency\n",
      "I1m  =  V1/Z1\n",
      "I1mag  =  abs(I1m)\n",
      "phii1  =  cmath.phase(complex(I1m.real,I1m.imag))\n",
      "#Third  harmonic\n",
      "XL3  =  3*XL1\n",
      " #impedance  at  the  third  harmonic  frequency,\n",
      "Z3  =  R  +  1j*XL3\n",
      " #Maximum  current  at  third  harmonic  frequency\n",
      "I3m  =  V3/Z3\n",
      "I3mag  =  abs(I3m)\n",
      "phii3  =  cmath.phase(complex(I3m.real,I3m.imag))\n",
      " #fifth  harmonic\n",
      "XL5  =  5*XL1\n",
      " #impedance  at  the  third  harmonic  frequency,\n",
      "Z5  =  R  +  1j*XL5\n",
      " #Maximum  current  at  third  harmonic  frequency\n",
      "I5m  =  V5/Z5\n",
      "I5mag  =  abs(I5m)\n",
      "phii5  =  cmath.phase(complex(I5m.real,I5m.imag))\n",
      " #rms  current\n",
      "Irms  =  (Iom**2  +  (I1mag**2  +  I3mag**2  +  I5mag**2)/2)**0.5\n",
      " #power  dissipated\n",
      "P  =  R*Irms**2\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n(a)i  =  \",round(Iom,2),\"  +  \",round(I1mag,2),\"sin(\",round(w1,2),\"t  +  (\",round(phii1,2),\"))  +  \",round(I3mag,2),\"sin(\",round((w1*3),2),\"t  +  (\",round(phii3,2),\"))  +  \",round(I5mag,2),\"sin(\",round((w1*5),2),\"t  +  (\",round(phii5,2),\"))  A\"\n",
      "print  \"\\n(b)the  rms  value  of  current  is  \",round(Irms,2),\"  A\"\n",
      "print  \"\\n(c)the  total  power  dissipated  \",round(P,3),\"  W\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "(a)i  =   5.0   +   14.14 sin( 10000.0 t  +  ( -0.79 ))  +   2.53 sin( 30000.0 t  +  ( -0.73 ))  +   0.78 sin( 50000.0 t  +  ( -1.11 ))  A\n",
        "\n",
        "(b)the  rms  value  of  current  is   11.34   A\n",
        "\n",
        "(c)the  total  power  dissipated   642.538   W\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 12, page no. 661</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine (a) the average power supplied, (b) the type of components present, and (c) the values of the components.\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "Vom  =  30;#  in  volts\n",
      "V1m  =  40;#  in  volts\n",
      "V2m  =  25;#  in  volts\n",
      "V4m  =  15;#  in  volts\n",
      "Iom  =  0;#  in  amperes\n",
      "I1m  =  0.743;#  in  Amperes\n",
      "I2m  =  0.781;#  in  Amperes\n",
      "I4m  =  0.636;#  in  Amperes\n",
      "phii1  =  1.190;#  in  rad\n",
      "phii2  =  0.896;#  in  rad\n",
      "phii4  =  0.559;#  in  rad\n",
      "w  =  1000;#  in  rad\n",
      "\n",
      " #calculation:\n",
      " #the  average  power  P  is  given  by\n",
      "P  =  Vom*Iom+(0.707*V1m)*(0.707*I1m)*math.cos(phii1)+(0.707*V2m)*(0.707*I2m)*math.cos(phii2) + (0.707*V4m)*(0.707*I4m)*math.cos(phii4)\n",
      " #rms  current\n",
      "Irms  =  (Iom**2  +  (I1m**2  +  I2m**2  +  I4m**2)/2)**0.5\n",
      " #resistance  R\n",
      "R  =  P/(Irms**2)\n",
      " #impedance\n",
      "Z1  =  V1m/I1m\n",
      " #Xc1\n",
      "Xc1  =  (Z1**2  -  R**2)**0.5\n",
      " #capacitance\n",
      "C  =  1/(w*Xc1)\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n(a)the  average  power  P  is  \",round(P,2),\"  W\"\n",
      "print  \"\\n(c)the  resistance  R  \",round(R,2),\"  ohm  and  capacitance  \",round(C*1E6,2),\"uF\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "(a)the  average  power  P  is   15.66   W\n",
        "\n",
        "(c)the  resistance  R   19.99   ohm  and  capacitance   20.01 uF\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 13, page no. 662</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine (a) an expression for the supply current, i, (b) the percentage harmonic content of the supply current, (c) the total power dissipated, (d) an expression for the p.d. shown as \t1, and (e) an expression for current ic.\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "V1m  =  300;#  in  volts\n",
      "V3m  =  120;#  in  volts\n",
      "phiv1  =  0;#  in  rad\n",
      "phiv2  =  0.698;#  in  rad\n",
      "w1  =  314;#  in  rad\n",
      "C  =  2.123E-6;#  in  farads\n",
      "R1  =  560;#  in  ohms\n",
      "R2  =  2000;#  in  Ohm\n",
      "\n",
      "#calculation:\n",
      " #voltage\n",
      "V1  =  V1m*math.cos(phiv1)  +  1j*V1m*math.sin(phiv1)\n",
      "V3  =  V3m*math.cos(phiv2)  +  1j*V3m*math.sin(phiv2)\n",
      " #capacitive  reactance,\n",
      "Xc1  =  1/(w1*C)\n",
      " #impedance  at  the  fundamental  frequency,\n",
      "Z1  =  R1  -  1j*Xc1*R2/(R2  -  1j*Xc1)\n",
      " #Maximum  current  at  fundamental  frequency\n",
      "I1m  =  V1/Z1\n",
      "I1mag  =  abs(I1m)\n",
      "phii1  =  cmath.phase(complex(I1m.real,I1m.imag))\n",
      " #Third  harmonic\n",
      "Xc3  =  Xc1/3\n",
      " #impedance  at  the  third  harmonic  frequency,\n",
      "Z3  =  R1  -  1j*Xc3*R2/(R2  -  1j*Xc3)\n",
      "I1m = V1m/Z1\n",
      "I1mag  =  abs(I1m)\n",
      "phii1  =  cmath.phase(complex(I1m.real,I1m.imag))\n",
      " #Maximum  current  at  third  harmonic  frequency\n",
      "I3m  =  V3/Z3\n",
      "I3mag  =  abs(I3m)\n",
      "phii3  =  cmath.phase(complex(I3m.real,I3m.imag))\n",
      " #Percentage  harmonic  content  of  the  supply  current  is  given  by\n",
      "percent  =  I3mag*100/I1mag\n",
      " #total  active  power\n",
      "P  =  (0.707*V1m)*(0.707*I1mag)*math.cos(phiv1  -  phii1)  +  (0.707*V3m)*(0.707*I3m)*math.cos(phiv2  -  phii3)\n",
      "\n",
      "I1 = I1m*R2/(R2 - 1j*Xc1)\n",
      "I3 = I3m*R2/(R2 - 1j*Xc3)\n",
      "\n",
      "I1nmag  =  abs(I1)\n",
      "phini1  =  cmath.phase(complex(I1.real,I1.imag))\n",
      "I3nmag  =  abs(I3)\n",
      "phini3  =  cmath.phase(complex(I3.real,I3.imag))\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n(a)supply current, i=\", round(I1mag,3),\"sin(\", w1,\"t +\",round(phii1,3),\") + \",round(I3mag,3),\"sin(\", 3*w1,\"t +\",round(phii3,3),\") A\"\n",
      "print  \"\\n(b)Percentage  harmonic  content  of  the  supply  current  is  \",round(percent,2),\"  percent\"\n",
      "print  \"\\n(c)total  active  power  is  \",round(abs(P),2),\"  W\"\n",
      "print  \"\\n(d)Voltage, v1 =\", round(I1mag*R1,3),\"sin(\", w1,\"t +\",round(phii1,3),\") + \",round(I3mag*R1,3),\"sin(\", 3*w1,\"t +\",round(phii3,3),\") A\"\n",
      "print  \"\\n(e)current, ic =\", round(I1nmag,3),\"sin(\", w1,\"t +\",round(phini1,3),\") + \",round(I3nmag,3),\"sin(\", 3*w1,\"t +\",round(phini3,3),\") A\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "(a)supply current, i= 0.187 sin( 314 t + 0.643 ) +  0.145 sin( 942 t + 1.305 ) A\n",
        "\n",
        "(b)Percentage  harmonic  content  of  the  supply  current  is   77.57   percent\n",
        "\n",
        "(c)total  active  power  is   25.34   W\n",
        "\n",
        "(d)Voltage, v1 = 104.996 sin( 314 t + 0.643 ) +  81.45 sin( 942 t + 1.305 ) A\n",
        "\n",
        "(e)current, ic = 0.15 sin( 314 t + 1.287 ) +  0.141 sin( 942 t + 1.55 ) A"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 14, page no. 664</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine (a) the fundamental frequency for resonance with the third harmonic, and \n",
      "#(b) the maximum value of the fundamental and third harmonic components of current\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "V1m  =  400;#  in  volts\n",
      "V3m  =  10;#  in  volts\n",
      "C  =  0.2E-6;#  in  farads\n",
      "R  =  2;#  in  ohms\n",
      "L  =  0.5;#  in  Henry\n",
      "\n",
      " #calculation:\n",
      " #Resonance  with  the  third  harmonic  means  that\n",
      "w  =  (1/(9*L*C))**0.5\n",
      " #fundamental  frequency,  f\n",
      "f  =  w/(2*math.pi)\n",
      " #At  the  fundamental  frequency,\n",
      " #impedance  Z1\n",
      "Z1  =  R  +  1j*(w*L  -  1/(w*C))\n",
      "Z1mag  =  abs(Z1)\n",
      "phiZ1  =  cmath.phase(complex(Z1.real,Z1.imag))\n",
      " #Maximum  value  of  current  at  the  fundamental  frequency,\n",
      "I1m  =  V1m/Z1mag\n",
      " #At  the  third  harmonic  frequency,\n",
      "Z3  =  R  +  1j*(3*w*L  -  1/(3*w*C))\n",
      "Z3mag  =  abs(Z3)\n",
      "phiZ3  =  cmath.phase(complex(Z3.real,Z3.imag))\n",
      " #Maximum  value  of  current  at  the  third  harmonic  frequency,\n",
      "I3m  =  V3m/Z3\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"(a)fundamental  frequency  for  resonance  with  the  third  harmonic  is  \",round(f,2),\"  Hz\"\n",
      "print  \"(b)Maximum value of current at fundamental freq. is\",round(abs(I1m),3),\"A \"\n",
      "print   \"and  at  the  third  harmonic  frequency  \",  abs(I3m),\"  A\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "(a)fundamental  frequency  for  resonance  with  the  third  harmonic  is   167.76   Hz\n",
        "(b)Maximum value of current at fundamental freq. is 0.095 A \n",
        "and  at  the  third  harmonic  frequency   5.0   A\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 15, page no. 665</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine (a) the value of n, (b) the maximum value of current at the nth harmonic, \n",
      "#(c) the p.d. across the capacitor at the nth harmonic and\n",
      "#(d) the maximum value of the fundamental current.\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "V1m  =  800;#  in  volts\n",
      "f  =  50;#  in  Hz\n",
      "x  =  0.015;\n",
      "C  =  0.122E-6;#  in  farads\n",
      "R  =  5;#  in  ohms\n",
      "L  =  0.369;#  in  Henry\n",
      "\n",
      " #calculation:\n",
      " #voltage  at  nth  harmonic\n",
      "Vnm  =  x*V1m\n",
      "w  =  2*math.pi*f\n",
      " #For  resonance  at  the  nth  harmonic  nwL  =  1/nwC\n",
      "n  =  1/(w*(L*C)**0.5)\n",
      " #At  resonance,  impedance\n",
      "Zn  =  R\n",
      " #the  maximum  value  of  current  at  the  nth  harmonic\n",
      "Inm  =  Vnm/Zn\n",
      " #capacitive  reactance,  at  nth  harmonic\n",
      "Xcn  =  1/(n*w*C)\n",
      " #the  p.d.  across  the  capacitor  at  the  nth  harmonic\n",
      "Vcn  =  Inm*Xcn\n",
      " #At  the  fundamental  frequency,  inductive  reactance,\n",
      "XL1  =  w*L\n",
      " #capacitive  reactance\n",
      "Xc1  =  1/(w*C)\n",
      " #Impedance  at  the  fundamental  frequency,\n",
      "Z1  =  R  +  1j*(XL1  -  Xc1)\n",
      "Z1mag  =  abs(Z1)\n",
      "phiZ1  =  cmath.phase(complex(Z1.real,Z1.imag))\n",
      " #Maximum  value  of  current  at  the  fundamental  frequency,\n",
      "I1m  =  V1m/Z1mag\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n(a)n  =  \",round(n,2),\"\"\n",
      "print  \"\\n(b)the  maximum  value  of  current  at  the  nth  harmonic  \",round(Inm,2),\"  A\"\n",
      "print  \"\\n(c)the  p.d.  across  the  capacitor  at  the  nth  harmonic  is  \",round(Vcn,2),\"\"\n",
      "print  \"\\n(d)the  maximum  value  of  the  fundamental  current.  \",round(I1m,2),\"  A\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "(a)n  =   15.0 \n",
        "\n",
        "(b)the  maximum  value  of  current  at  the  nth  harmonic   2.4   A\n",
        "\n",
        "(c)the  p.d.  across  the  capacitor  at  the  nth  harmonic  is   4173.92 \n",
        "\n",
        "(d)the  maximum  value  of  the  fundamental  current.   0.03   A"
       ]
      }
     ],
     "prompt_number": 14
    }
   ],
   "metadata": {}
  }
 ]
}