summaryrefslogtreecommitdiff
path: root/Fundamental_Electrical_and_Electronic_Principles/ch6.ipynb
blob: d96755d027628f72bc81f9d1af1ec60236c06925 (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:b84f65369d0a7456fd5ada25a94ec2301f3722e12d3bfd972d934901296bd409"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 6: Alternating Quantities"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.1, Page 202"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Comparing alternating voltage v = 35*sin(314.2*t) with the standard Eq.\n",
      "# Part (a)\n",
      "V_m = 35;  # Maximum value of alternating voltage, volt\n",
      "\n",
      "# Part (b)\n",
      "#We know that v= vm8sin(2*pi*f*t)\n",
      "#Comparing the alternating voltage equation with the above one, we get,\n",
      "f = 314.2/(2*math.pi)     # Frequency of waveform, Hz\n",
      "\n",
      "# Part (c)\n",
      "T = 1/f;    # Time period of waveform, sec\n",
      "\n",
      "# Part (d)\n",
      "t = 3.5;    # Time with reference to zero crossing, sec\n",
      "v = 35*math.sin(2*math.pi*50*3.5*1e-03);    # Volatge value after the waveform passes through zero, going positive\n",
      "\n",
      "#Results\n",
      "print \"The maximum value of alternating voltage = %2d volt\"%V_m\n",
      "print \"The frequency of alternating voltage = %2d Hz\"%f\n",
      "print \"The time period of alternating voltage = %3.1f ms\"%(T/1e-03);\n",
      "print \"The volatge value after the waveform passes through zero = %5.2f volt\"%v\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum value of alternating voltage = 35 volt\n",
        "The frequency of alternating voltage = 50 Hz\n",
        "The time period of alternating voltage = 20.0 ms\n",
        "The volatge value after the waveform passes through zero = 31.19 volt\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.2, Page 202"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Part (a)\n",
      "#I = Im*sin(2*pi*f*t)\n",
      "# Given i = 75*sin(200*%pi*t) mA which on comparing with the general expression gives\n",
      "#Comparing the above two equations, we get,\n",
      "f = (200*math.pi)/(2*math.pi)   # Frequency of alternating current, Hz\n",
      "\n",
      "# Part(b)\n",
      "i = 35.;     # Alternating current after passing through zero, mA\n",
      "t = math.asin(i/75)/(200*math.pi*1e-03);   # Time taken for current to reach 35 mA, ms\n",
      "\n",
      "#Results\n",
      "print \"The frequency of alternating current = %2d Hz\"%f\n",
      "print \"The time taken for current to reach 35 mA = %5.3f mA\"%t\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The frequency of alternating current = 100 Hz\n",
        "The time taken for current to reach 35 mA = 0.773 mA\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.3, Page 204"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "V_av = 3.5;     # Average value of sinusoidal alternating voltage, V\n",
      "T = 6.67e-03;   # Time period of alternating current, s\n",
      "\n",
      "#Calculations\n",
      "V_m = V_av/0.637;   # Peak value of alternating current, V\n",
      "f = 1/T;    # Frequency of alternating volatge, Hz\n",
      "\n",
      "#Result\n",
      "print \"The standard expression for %3.1f voltage = %3.1f sin(%3d*pi*t) volt\"%(V_av, V_m,round(2*f))\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The standard expression for 3.5 voltage = 5.5 sin(300*pi*t) volt\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.4, Page 204"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "V_av = 3.5;     # Average value of sinusoidal alternating voltage, V\n",
      "T = 6.67e-03;   # Time period of alternating voltage, s\n",
      "\n",
      "#Calculations&Results\n",
      "V_m = V_av/0.637;   # Peak value of alternating voltage, V\n",
      "f = 1/T;    # Frequency of alternating volatge, Hz\n",
      "\n",
      "# Part (a)\n",
      "t = 0.5e-03;    # Time taken by the waveform after passing through zero, s\n",
      "v = V_m*math.sin(2*math.pi*f*t);     # Instantaneous value of alternating voltage, s\n",
      "print \"The instantaneous value of alternating voltage after %3.1f ms = %3.1f volt\"%(t/1e-03, v)\n",
      "\n",
      "# Part (b)\n",
      "t = 4.5e-03;    # Time taken by the waveform after passing through zero, s\n",
      "v = V_m*math.sin(2*math.pi*f*t);     # Instantaneous value of alternating voltage, s\n",
      "print \"The instantaneous value of alternating voltage after %3.1f ms = %3.1f volt\"%(t/1e-03, v);\n",
      "\n",
      "# Part (c)\n",
      "v = 3;     # Alternating voltage after passing through zero, mA\n",
      "t = math.asin(v/V_m)/(2*math.pi*f);   # Time taken for current to reach 3 V, s\n",
      "print \"The time taken for voltage to reach %1d volt = %5.3f ms\"%(v, t/1e-03);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The instantaneous value of alternating voltage after 0.5 ms = 2.5 volt\n",
        "The instantaneous value of alternating voltage after 4.5 ms = -4.9 volt\n",
        "The time taken for voltage to reach 3 volt = 0.613 ms\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.5, Page 206"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "V = 240;    # Rms vlaue of alternating voltage, volt\n",
      "\n",
      "#Calculations\n",
      "V_m = math.sqrt(2)*V;   # Peak value of alternating voltage, volt\n",
      "\n",
      "#Result\n",
      "print \"The amplitude of household %3d volt supply = %5.1f volt\"%(V, V_m);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The amplitude of household 240 volt supply = 339.4 volt\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6, Page 207"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "pf = 2.5;   # Peak factor of non-sinusoidal alternating voltage\n",
      "V = 240;    # Rms vlaue of alternating voltage, volt\n",
      "\n",
      "#Calculations\n",
      "V_m = pf*V;   # Peak value of alternating voltage, volt\n",
      "\n",
      "#Result\n",
      "print \"The absolute minimum working voltage = %3d volt\"%V_m\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The absolute minimum working voltage = 600 volt\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.7, Page 207"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "l = 0.25;   # Length of the rectangular coil, m\n",
      "d = 0.2;    # Width of rectangular coil, m\n",
      "N = 80;     # Number of turns of the rectangular coil\n",
      "B = 0.075;  # Magnetic flux density, tesla\n",
      "n = 3000/60;   # Frequency of revolution of the coil, rev/s\n",
      "v = n*math.pi*d;    # Linear speed with which the coil sides move, m/s\n",
      "t = 2e-03;      # Time after the emf crosses zero, s\n",
      "\n",
      "#Calculations\n",
      "# Part (a)\n",
      "# As e = 2*N*B*l*v*sin(2*pi*f*t) volt, and for maximum value of sin(2*pi*f*t) = 1\n",
      "E_m = 2*N*B*l*v*(1);  # Amplitude of emf, volt\n",
      "E = 0.707*E_m;      # rms value of emf, volt\n",
      "E_av = 0.637*E_m;   # Average value of emf, volt\n",
      "# For a two pole field system, \n",
      "f = n;      # Frequency of generated waveform, Hz\n",
      "\n",
      "# Part (b)\n",
      "T = 1./f;    # Time period of generated waveform, Hz\n",
      "\n",
      "# Part (c)\n",
      "e = E_m*math.sin(2*math.pi*f*t);     # Instantaneous value at time 2 ms after zero, volt\n",
      "\n",
      "#Results\n",
      "print \"The amplitude, rms and average value of emf = %5.2f V, %5.2f V and %5.2f V resp.\"%(E_m, E, E_av);\n",
      "print \"The frequency and time period of generated waveform = %2d Hz and %2d ms resp.\"%(f, T/1e-03);\n",
      "print \"The instantaneous value of emf at time 2 ms after crossing zero = %4.1f V\"%e\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The amplitude, rms and average value of emf = 94.25 V, 66.63 V and 60.04 V resp.\n",
        "The frequency and time period of generated waveform = 50 Hz and 20 ms resp.\n",
        "The instantaneous value of emf at time 2 ms after crossing zero = 55.4 V\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.8, Page 212"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "R_c = 50;   # Resistance of the coil of meter, ohm\n",
      "K = 10e+03;     # Figure of merit of the moving coil meter, ohm per volt\n",
      "V = 10;     # d.c. range of coil meter, volt\n",
      "\n",
      "#Calculations&Results\n",
      "# Part (a)\n",
      "I_fsd = 1/K;    # Full scale deflection for moving coil meter, ampere\n",
      "R = V/I_fsd;    # Total meter resistance, ohm\n",
      "# As R = R_m + R_c, solvign for R_m\n",
      "R_m = R - R_c;      # Multiplier resistance required by the meter, ohm\n",
      "print \"The multiplier resistance required for 10 V d.c. range = %5.2f k-ohm\"%(R_m/1e+03)\n",
      "\n",
      "# Part(b)\n",
      "I_av = I_fsd;   # Average value of ac current, A\n",
      "I_rms = math.pi/(2*math.sqrt(2))*I_av;    # rms value of ac current, A\n",
      "V = 10 ;     # a.c. range of coil meter, volt\n",
      "R = V/I_rms;    # Total meter resistance, ohm\n",
      "# As R = R_m + R_c, solvign for R_m\n",
      "R_m = R - R_c;      # Multiplier resistance required by the meter, ohm\n",
      "print \"The multiplier resistance required for 10 V a.c. range = %5.2f k-ohm\"%(R_m/1e+03);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The multiplier resistance required for 10 V d.c. range = 99.95 k-ohm\n",
        "The multiplier resistance required for 10 V a.c. range = 89.98 k-ohm\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.9, Page 213"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Case_I: Square_wave\n",
      "ff = 1.11;  #  Form factor of calibrated meter\n",
      "ff_square = 1;  # Form factor for square wave\n",
      "V_apparent = 5;     # Meter reading for sqaure wave, volt\n",
      "V_true = V_apparent*1*(ff_square/ff);    # True rms value of square wave voltage, volt\n",
      "print \"The true rms value of square wave voltage = %5.3f V\"%V_true\n",
      "\n",
      "# Case_II: Triangular_wave\n",
      "ff_triangle = 1.15;  # Form factor for triangular wave\n",
      "V_apparent = 5;     # Meter reading for triangular wave, volt\n",
      "V_true = V_apparent*(ff_triangle/ff);    # True rms value of triangular wave voltage, volt\n",
      "print \"The true rms value of triangular wave voltage = %4.2f V\"%V_true\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The true rms value of square wave voltage = 4.505 V\n",
        "The true rms value of triangular wave voltage = 5.18 V\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.10, Page 215"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "# The general expression for alternating current is I = Io*sin(2*pi*f*t + phi)\n",
      "#Comparing the given equations with the above, we get,\n",
      "f = (80*math.pi)/(2*math.pi)    # Frequency of alternating current, Hz\n",
      "\n",
      "#Calculations\n",
      "# I2 is the reference waveform with zero phase angle, so that\n",
      "phi2 = 0;   # Phase angle for reference waveform I2, degrees\n",
      "Im2 = 3;    # Current amplitude of reference waveform I2, A\n",
      "Im1 = 5;    # Current amplitude of reference waveform I1, A\n",
      "Im3 = 6;    # Current amplitude of reference waveform I3, A\n",
      "phi1 = math.pi/6*(180/math.pi); # Phase angle for reference waveform I1, degrees\n",
      "phi3 = math.pi/4*(180/math.pi); # Phase angle for reference waveform I3, degrees\n",
      "\n",
      "#Results\n",
      "print \"The frequency of all three waveforms = %2d Hz\"%f\n",
      "print \"I1 leads I2 by = %2.0f degrees\"%(phi1-phi2);\n",
      "print \"I3 lags I2 by = %2d degrees\"%(phi3-phi2);\n",
      "print \"Current amplitude of reference waveform I1 = %1d A\"%Im1\n",
      "print \"Current amplitude of reference waveform I2 = %1d A\"%Im2\n",
      "print \"Current amplitude of reference waveform I3 = %1d A\"%Im3\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The frequency of all three waveforms = 40 Hz\n",
        "I1 leads I2 by = 30 degrees\n",
        "I3 lags I2 by = 45 degrees\n",
        "Current amplitude of reference waveform I1 = 5 A\n",
        "Current amplitude of reference waveform I2 = 3 A\n",
        "Current amplitude of reference waveform I3 = 6 A\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.12, Page 218"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "Im1 = 7;    # Current amplitude of reference waveform I1, A\n",
      "Im2 = 6;    # Current amplitude of reference waveform I2, A\n",
      "Im3 = 5;    # Current amplitude of reference waveform I3, A\n",
      "Im4 = 4;    # Current amplitude of reference waveform I4, A\n",
      "\n",
      "#Calculations\n",
      "phi1 = 70*math.pi/180;   # Phase angle for reference waveform I1, rad\n",
      "phi2 = 0*math.pi/180;   # Phase angle for reference waveform I2, rad\n",
      "phi3 = -50*math.pi/180;   # Phase angle for reference waveform I3, rad\n",
      "phi4 = -90*math.pi/180;   # Phase angle for reference waveform I4, rad\n",
      "\n",
      "#Results\n",
      "print \"i1 = %dsin(wt + %4.2f) amp\"%(Im1, phi1)\n",
      "print \"i2 = %dsin wt amp\"%Im2;\n",
      "print \"i3 = %dsin(wt + %4.2f) amp\"%(Im3, phi3);\n",
      "print \"i4 = %dsin(wt + %4.2f) amp\"%(Im4, phi4);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i1 = 7sin(wt + 1.22) amp\n",
        "i2 = 6sin wt amp\n",
        "i3 = 5sin(wt + -0.87) amp\n",
        "i4 = 4sin(wt + -1.57) amp\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.13, Page 221"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "omega = 314.;    # Angular frequency of voltage, rad per sec\n",
      "Vm1 = 25.;   # Peak value of first phasor, V\n",
      "Vm2 = 15.;   # Peak value of second phasor, V\n",
      "\n",
      "#Calculations\n",
      "H_C = Vm1*math.cos(math.pi/3)+Vm2*math.cos(-math.pi/6); # Horizontal component of phasor sum, V\n",
      "V_C = Vm1*math.sin(math.pi/3)+Vm2*math.sin(-math.pi/6); # Vertical component of phasor sum, V\n",
      "Vm = math.sqrt(H_C**2+V_C**2); # Peak value of phasor sum, V\n",
      "phi = math.atan(V_C/H_C);   # Phase angle, degrees\n",
      "print \"v = %5.2fsin(%3dt + %5.3f) volt\"%(Vm, omega, phi);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "v = 29.15sin(314t + 0.507) volt\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.14, Page 222"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "Im1 = 6;   # Peak value of first phasor, A\n",
      "Im2 = 8;   # Peak value of second phasor, A\n",
      "Im3 = 4;   # Peak value of third phasor, A\n",
      "\n",
      "#Calculations\n",
      "H_C = Im1*math.cos(0)+Im2*math.cos(-math.pi/2)+Im3*math.cos(math.pi/6); # Horizontal component of phasor sum, A\n",
      "V_C = Im1*math.sin(0)+Im2*math.sin(-math.pi/2)+Im3*math.sin(math.pi/6); # Vertical component of phasor sum, A\n",
      "Im = math.sqrt(H_C**2+V_C**2); # Peak value of phasor sum, V\n",
      "phi = math.atan(V_C/H_C);   # Phase angle, rad\n",
      "\n",
      "\n",
      "print \"i = %4.1fsin(wt%5.3f) amp\"%(Im, phi);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i = 11.2sin(wt-0.565) amp\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.15, Page 222"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Part (a)\n",
      "omega = 628;    # Angular frequency of voltage, rad per sec\n",
      "f = omega/(2*math.pi);  # Frequency of the waveforms, Hz\n",
      "Vm1 = 10.;   # Peak value of first phasor, V\n",
      "Vm2 = 8.;   # Peak value of second phasor, V\n",
      "Vm3 = 12.;   # Peak value of third phasor, V\n",
      "phi1 = -math.pi/6*180/math.pi;      # Phase angle for first voltage, degrees\n",
      "phi2 = math.pi/3*180/math.pi;      # Phase angle for second voltage, degrees\n",
      "phi3 = math.pi/4*180/math.pi;      # Phase angle for third voltage, degrees\n",
      "print \"The frequency of all three waveforms = %3d Hz\"%f\n",
      "print \"The phase angle and frequency of first voltage : %2d degrees, %2d V\"%(phi1, Vm1);\n",
      "print \"The phase angle and frequency of second voltage : %2d degrees, %2d V\"%(phi2, Vm2);\n",
      "print \"The phase angle and frequency of third voltage : %2d degrees, %2d V\"%(phi3, Vm3);\n",
      "\n",
      "# Part (b)\n",
      "H_C = Vm1*math.cos(phi1)+Vm2*math.cos(phi2)+Vm3*math.cos(phi3); # Horizontal component of phasor sum, V\n",
      "V_C = Vm1*math.sin(phi1)+Vm2*math.sin(phi2)+Vm3*math.sin(phi3); # Horizontal component of phasor sum, V\n",
      "Vm = math.sqrt(H_C**2+V_C**2); # Peak value of phasor sum, V\n",
      "phi = math.atan(V_C/H_C);   # Phase angle, rad\n",
      "print \"v = %5.2fsin(%3dt + %5.3f) volt\"%(Vm, omega, phi);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The frequency of all three waveforms =  99 Hz\n",
        "The phase angle and frequency of first voltage : -29 degrees, 10 V\n",
        "The phase angle and frequency of second voltage : 59 degrees,  8 V\n",
        "The phase angle and frequency of third voltage : 45 degrees, 12 V\n",
        "v = 17.65sin(628t + 1.558) volt\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.16, Page 228"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "tb1 = 0.1e-03;  # Timebase of channel 1, s/cm\n",
      "tb2 = 10e-06;  # Timebase of channel 2, s/cm\n",
      "Y_amp1 = 5.; # Y-amp setting for channel 1, V/cm\n",
      "Y_amp2 = 0.5; # Y-amp setting for channel 2, V/cm\n",
      "\n",
      "#Calculations&Results\n",
      "# Channel 1\n",
      "V_pp = 3*Y_amp1;    # Peak-to-peak value of waveform in channel 1, V\n",
      "Vm = V_pp/2;    # Amplitude of waveform in channel 1, V\n",
      "V = Vm/math.sqrt(2); # rms value of sine wave in channel 1, V\n",
      "T = 4*tb1;  # Time period of sine wave, second\n",
      "f = 1./(T*1000);    # Frequency of sine wave, kHz\n",
      "print \"The amplitude of sine waveform in channel 1 = %3.1f V\"%Vm\n",
      "print \"The rms value of sine wave in channel 1 = %3.1f V\"%V\n",
      "print \"The frequency of sine wave in channel 1 = %3.1f kHz\"%f\n",
      "\n",
      "# Channel 2\n",
      "V_pp = 2*Y_amp2;    # Peak-to-peak value of waveform in channel 2, V\n",
      "Vm = V_pp/2;    # Amplitude of waveform in channel 2, V\n",
      "V = Vm; # rms value of square wave in channel 2, V\n",
      "T = 2./3*tb2;  # Time period of square wave, second\n",
      "f = 1./(T*1000);    # Frequency of square wave, kHz\n",
      "print \"The amplitude of square waveform in channel 2 = %3.1f V\"%Vm\n",
      "print \"The rms value of square wave in channel 2 = %3.1f V\"%V\n",
      "print \"The frequency of square wave in channel 2 = %3d kHz\"%f\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The amplitude of sine waveform in channel 1 = 7.5 V\n",
        "The rms value of sine wave in channel 1 = 5.3 V\n",
        "The frequency of sine wave in channel 1 = 2.5 kHz\n",
        "The amplitude of square waveform in channel 2 = 0.5 V\n",
        "The rms value of square wave in channel 2 = 0.5 V\n",
        "The frequency of square wave in channel 2 = 150 kHz\n"
       ]
      }
     ],
     "prompt_number": 27
    }
   ],
   "metadata": {}
  }
 ]
}