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
|
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Chapter 9:ALTERNATING CURRENT AND VOLTAGE"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 9.1,Page number: 237"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Question:\n",
"\"\"\"Finding the angle at which the instantaneous value of voltage is 10 V.\"\"\"\n",
"\n",
"from math import asin,degrees\n",
"\n",
"#Variable Declaration:\n",
"Vm=20.0 #Peak value of sinusoidal voltage(in Volts)\n",
"\n",
"\n",
"#Calculations:\n",
"v=10.0 #Instantaneous Voltage(in Volts)\n",
"angle=degrees(asin(v/Vm))\n",
"\n",
"\n",
"#Result:\n",
"print \"(a)The angle at which the instantaneous value of voltage is 10V is %.2f degrees.\" %(angle)\n",
"print \"(b)The maximum value of voltage is Vm=20 V.This occurs twice in one cycle at angles 90 degrees and 270 degrees.\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(a)The angle at which the instantaneous value of voltage is 10V is 30.00 degrees.\n",
"(b)The maximum value of voltage is Vm=20 V.This occurs twice in one cycle at angles 90 degrees and 270 degrees.\n"
]
}
],
"prompt_number": 3
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 9.2,Page number: 237"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Question:\n",
"\"\"\"Finding the time represented by a 60 degrees phase angle.\"\"\"\n",
"\n",
"from math import pi,sin,radians\n",
"\n",
"#Variable Declaration:\n",
"ang_freq=2000.0 #Angular Frequency(in radians per second)\n",
"\n",
"\n",
"#Calculations:\n",
"f=ang_freq/(2*pi)\n",
"T=1/f\n",
"t=160e-06\n",
"v=0.04*sin((2000*t)+radians(60))\n",
"t_60=(60.0/360)*T\n",
"\n",
"\n",
"#Result:\n",
"print \"(a)The frequency is %.2f Hz.\" %(f)\n",
"print \"(b)The angular frequency is %.2f rad/sec.\" %(ang_freq)\n",
"print \"(c)The instantaneous voltage when t=60 micro seconds, is %e V.\" %(v)\n",
"print \"(d)The time represented by 60 degrees phase angle is %e seconds.\" %(t_60)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(a)The frequency is 318.31 Hz.\n",
"(b)The angular frequency is 2000.00 rad/sec.\n",
"(c)The instantaneous voltage when t=60 micro seconds, is 3.917381e-02 V.\n",
"(d)The time represented by 60 degrees phase angle is 5.235988e-04 seconds.\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 9.3,Page number: 237"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Question:\n",
"\"\"\"Finding the equation for the instantaneous value of a sinusoidal voltage.\"\"\"\n",
"\n",
"from math import pi,sin,radians,degrees,asin\n",
"\n",
"#Variable Declaration:\n",
"V_peak_to_peak=20.0 #Peak-to-peak Voltage(in Volts)\n",
"\n",
"\n",
"#Calculations:\n",
"V_m=V_peak_to_peak/2\n",
"T=10.0e-03\n",
"f=1/T\n",
"ang_freq=2*pi*f\n",
"phi=180-degrees(asin(3.6/V_m))\n",
"t=12e-03\n",
"v_12=V_m*sin((ang_freq*t)-radians(phi))\n",
"\n",
"\n",
"#Result:\n",
"print \"(a)The equation of the given sinusoidal voltage is v(t)=%.2f sin(%.2ft+%.2f) V.\" %(V_m,ang_freq,phi)\n",
"print \"(b)The value of voltage at 12ms would be %.3f V.\" %(v_12)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(a)The equation of the given sinusoidal voltage is v(t)=10.00 sin(628.32t+158.90) V.\n",
"(b)The value of voltage at 12ms would be -9.985 V.\n"
]
}
],
"prompt_number": 6
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 9.4,Page number: 238"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Question:\n",
"\"\"\"Finding the equation for the instantaneous value of an alternating current.\"\"\"\n",
"\n",
"from math import pi,sin,asin\n",
"\n",
"#Variable Declaration:\n",
"f=60.0 #Frequency of alternating current(in Hertz)\n",
"i_m=12.0 #Peak value of the alternating current(in Amperes) \n",
"\n",
"\n",
"#Calculations:\n",
"ang_freq=2*pi*f\n",
"t1=1.0/360\n",
"i_t1=i_m*sin(ang_freq*t1)\n",
"i2=9.6\n",
"t2=(asin(9.6/12))/ang_freq\n",
"\n",
"\n",
"#Result:\n",
"print \"(a)The equation for the instantaneous value of alternating current is i= %d sin(%.2ft) A.\" %(i_m,ang_freq)\n",
"print \"(b)The value of current at t=1/360 second is %.2f A.\" %(i_t1)\n",
"print \"(c)The time taken to reach 9.6A for the first time is %e seconds.\" %(t2)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(a)The equation for the instantaneous value of alternating current is i= 12 sin(376.99t) A.\n",
"(b)The value of current at t=1/360 second is 10.39 A.\n",
"(c)The time taken to reach 9.6A for the first time is 2.459727e-03 seconds.\n"
]
}
],
"prompt_number": 3
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 9.5,Page number: 244"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Question:\n",
"\"\"\"Finding the phase difference between two sinusoidal currents.\"\"\"\n",
"\n",
"from math import pi\n",
"\n",
"#Calculations:\n",
"ang_freq=100.0*pi\n",
"f=ang_freq/(2.0*pi)\n",
"T=1/f\n",
"t=(30.0/360.0)*T\n",
"\n",
"\n",
"#Result:\n",
"print \"The phase difference in terms of time is %e seconds.\" %(t)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The phase difference in terms of time is 1.666667e-03 seconds.\n"
]
}
],
"prompt_number": 4
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 9.6,Page number: 248 "
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Question:\n",
"\"\"\"Finding the power consumed by a resistor.\"\"\"\n",
"\n",
"from cmath import phase\n",
"\n",
"#Variable Declaration:\n",
"R=10 #Resistance of resistance(in Ohms) \n",
"I=4+ 1j*3 #Alternating current phasor(in Amperes)\n",
"\n",
"\n",
"#Calculations:\n",
"I_mod=abs(I)\n",
"I_phase= phase(I)\n",
"I_rms=I_mod\n",
"P=pow(I_rms,2)*R\n",
"\n",
"\n",
"#Result:\n",
"print \"The power consumed by the 10 ohm resistor is %.2f W.\" %(P)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The power consumed by the 10 ohm resistor is 250.00 W.\n"
]
}
],
"prompt_number": 6
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 9.7,Page number: 250"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Question: \n",
"\"\"\"Finding the resultant current obtained by adding two alternating currents.\"\"\"\n",
"\n",
"from cmath import rect,phase\n",
"from math import radians,degrees,sqrt\n",
"\n",
"#Calculations:\n",
"I1=rect(10,0)\n",
"I2=rect(20,radians(60))\n",
"I=I1+I2\n",
"Im=abs(I)\n",
"I_phase=degrees(phase(I))\n",
"\n",
"\n",
"#Result:\n",
"print \"The resultant current is %.2f A at a phase angle of %.2f degrees.\" %(Im,I_phase)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The resultant current is 26.46 A at a phase angle of 40.89 degrees.\n"
]
}
],
"prompt_number": 5
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 9.8,Page number: 250"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Question:\n",
"\"\"\"Finding the rms value of the sum of two currents.\"\"\"\n",
"\n",
"from cmath import rect\n",
"from math import radians,sqrt\n",
"\n",
"#Calculations:\n",
"I1=rect((10*sqrt(2)),0)\n",
"I2=rect((20*sqrt(2)),radians(60))\n",
"I=I1+I2\n",
"Im=abs(I)\n",
"Irms=Im/(sqrt(2))\n",
"\n",
"\n",
"#Result:\n",
"print \"The rms value of the sum of the currents is %.2f A.\" %(Irms) "
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The rms value of the sum of the currents is 26.46 A.\n"
]
}
],
"prompt_number": 7
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 9.9,Page number: 250"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Question:\n",
"\"\"\"Finding the rms value of the resultant current.\"\"\"\n",
"\n",
"from cmath import rect,phase\n",
"from math import radians,sqrt,degrees\n",
"\n",
"#Calculations:\n",
"I1=rect(5,0)\n",
"I2=rect(5,radians(30))\n",
"I3=rect(5,radians(-120))\n",
"I=I1+I2+I3\n",
"Im=abs(I)\n",
"Irms=Im/(sqrt(2))\n",
"I_phase=degrees(phase(I))\n",
"\n",
"\n",
"#Result:\n",
"print \"The rms value of the resultant current that leaves the junction is %.2f A at a phase angle of %.2f degrees.\" %(Irms,I_phase) "
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The rms value of the resultant current that leaves the junction is 5.00 A at a phase angle of -15.00 degrees.\n"
]
}
],
"prompt_number": 8
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 9.10,Page number: 251"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Question:\n",
"\"\"\"Finding the average and rms value of the resultant cuurent in a wire.\"\"\"\n",
"\n",
"from math import sqrt\n",
"\n",
"#Variable Declaration: \n",
"I1rms=10.0 #Rms value of direct current(in Amperes) \n",
"\n",
"\n",
"#Calculations:\n",
"avg=10.0 \n",
"I2rms=10.0/sqrt(2)\n",
"I_rms=sqrt(pow(I1rms,2)+pow(I2rms,2))\n",
"\n",
"\n",
"#Result:\n",
"print \"The average value of the resultant current is %d A as the current goes as much positive as negative around the value of %d A.\" %(avg,avg) \n",
"print \"The rms value of the resultant current is %.3f A.\" %(I_rms)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The average value of the resultant current is 10 A as the current goes as much positive as negative around the value of 10 A.\n",
"The rms value of the resultant current is 12.247 A.\n"
]
}
],
"prompt_number": 9
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 9.11,Page number: 252"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Question:\n",
"\"\"\"Finding the average value of a voltage waveform.\"\"\"\n",
"\n",
"#Calculations:\n",
"area_0_to_1=10*(1e-03)\n",
"area_1_to_3=-5*(2e-03)\n",
"area_3_to_4=20*(1e-03)\n",
"area_4_to_5=0*(1e-03)\n",
"area_5_to_8=5*(3e-03)\n",
"total_area=(area_0_to_1+area_1_to_3+area_3_to_4+area_4_to_5+area_5_to_8)\n",
"total_period=8e-03\n",
"avg_value=total_area/total_period\n",
"\n",
"\n",
"#Result:\n",
"print \"The average value of the alternating voltage waveform is %.3f V.\" %(avg_value)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The average value of the alternating voltage waveform is 4.375 V.\n"
]
}
],
"prompt_number": 10
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 9.12,Page number: 252"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Question:\n",
"\"\"\"Finding the effective value of a voltage waveform.\"\"\"\n",
"\n",
"from math import sqrt\n",
"\n",
"#Calculations:\n",
"area_0_to_10=400*(10e-03)\n",
"area_10_to_20=100*(10e-03)\n",
"total_area=(area_0_to_10+area_10_to_20)\n",
"total_period=20e-03\n",
"avg_value_of_square=total_area/total_period\n",
"rms=sqrt(avg_value_of_square)\n",
"\n",
"\n",
"#Result:\n",
"print \"The effective(rms) value of the alternating voltage waveform is %.3f V.\" %(rms) "
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The effective(rms) value of the alternating voltage waveform is 15.811 V.\n"
]
}
],
"prompt_number": 11
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 9.13,Page number: 253"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Question:\n",
"\"\"\"Finding the rms value,the average value and the form factor for a current waveform.\"\"\"\n",
"\n",
"from math import sqrt\n",
"\n",
"#Variable Declaration:\n",
"period=3.0 #Time period of the current waveform(in seconds)\n",
"\n",
"\n",
"#Calculations:\n",
"Irms=sqrt( ((pow(10,2)*2)+(pow(0,2)*1))/3 )\n",
"Iavg=((10.0*2)+(0*1))/3.0\n",
"form_factor=Irms/Iavg\n",
"\n",
"\n",
"#Result:\n",
"print \"The rms value of current waveform is %.2f A.\" %(Irms) \n",
"print \"The average value of current waveform is %.2f A.\" %(Iavg) \n",
"print \"The form factor of the current waveform is %.2f.\" %(form_factor) "
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The rms value of current waveform is 8.12 A.\n",
"The average value of current waveform is 6.67 A.\n",
"The form factor of the current waveform is 1.22.\n"
]
}
],
"prompt_number": 12
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 9.14,Page number: 253"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Question:\n",
"\"\"\"Finding the form factor and the peak factor for a saw-tooth waveform.\"\"\"\n",
"\n",
"from math import sqrt\n",
"\n",
"#Variable Declaration:\n",
"T=5e-03 #Time period of saw-tooth waveform(in seconds) \n",
"V_m=10.0 #Peak value of the saw-tooth voltage(in Volts)\n",
"\n",
"\"\"\" Vav=(Area under the curve in one cycle)/(Duration of one cycle) \"\"\"\n",
"\n",
"\n",
"#Calculations:\n",
"Vav=((1.0/2)*V_m*T)/T\n",
"Vrms=V_m/(sqrt(3))\n",
"form_factor=Vrms/Vav\n",
"peak_factor=V_m/Vrms\n",
"\n",
"\n",
"#Result:\n",
"print \"The average value of the saw-tooth voltage waveform is %.3f V.\" %(Vav)\n",
"print \"The rms value of the saw-tooth voltage waveform is %.3f V.\" %(Vrms)\n",
"print \"The form factor for the saw-tooth voltage waveform is %.3f.\" %(form_factor)\n",
"print \"The peak factor for the saw-tooth voltage waveform is %.3f.\" %(peak_factor)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The average value of the saw-tooth voltage waveform is 5.000 V.\n",
"The rms value of the saw-tooth voltage waveform is 5.774 V.\n",
"The form factor for the saw-tooth voltage waveform is 1.155.\n",
"The peak factor for the saw-tooth voltage waveform is 1.732.\n"
]
}
],
"prompt_number": 13
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 9.15,Page number: 255 "
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Question:\n",
"\"\"\"Finding the average power,the apparent power,the instantaneous power and the power factor in percentage in an ac circuit.\"\"\"\n",
"\n",
"from math import cos,sqrt,pi\n",
"\n",
"#Variable Declaration:\n",
"phase_angle=pi/5 #Phase difference between the alternating current and alternating voltage(in radians) \n",
"Vm=55 #Peak value of the alternating voltage(in Volts) \n",
"Im=6.1 #Peak value of the alternating current(in Amperes)\n",
"\n",
"\n",
"#Calculations:\n",
"Vrms=Vm/sqrt(2)\n",
"Irms=Im/sqrt(2)\n",
"pf=cos(phase_angle)\n",
"P_avg=Vrms*Irms*cos(phase_angle)\n",
"P_app=Vrms*Irms\n",
"P_inst=P_avg-(Vrms*Irms*cos((2*0.3)-(pi/5)))\n",
"\n",
"\n",
"#Result:\n",
"print \"The average power is %.2f W.\" %(P_avg)\n",
"print \"The apparent power is %.2f VA.\" %(P_app)\n",
"print \"The instantaneous power at wt=0.3 is %.2f W.\" %(P_inst)\n",
"print \"The power factor is %.3f lagging.\" %(pf)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The average power is 135.71 W.\n",
"The apparent power is 167.75 VA.\n",
"The instantaneous power at wt=0.3 is -31.97 W.\n",
"The power factor is 0.809 lagging.\n"
]
}
],
"prompt_number": 14
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 9.16,Page number:262"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Question:\n",
"\"\"\"Finding the average and rms values of waveforms.\"\"\"\n",
"\n",
"from math import sqrt\n",
"\n",
"#Variable Declaration:\n",
"Vm1=10.0 #Peak voltage of first waveform(in Volts) \n",
"Vm2=10.0 #Peak voltage of second waveform(in Volts)\n",
"\n",
"\n",
"#Calculations:\n",
"Vav1=Vm1/2.0\n",
"Vrms1=Vm1/sqrt(3.0)\n",
"Vav2=Vm2/4.0\n",
"Vrms2=Vm2/sqrt(6.0)\n",
"\n",
"\n",
"#Result:\n",
"print \"(a)The average value of the voltage is %.2f V and the rms value of the voltage is %.2f V.\" %(Vav1,Vrms1) \n",
"print \"(b)The average value of the voltage is %.2f V and the rms value of the voltage is %.2f V.\" %(Vav2,Vrms2)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(a)The average value of the voltage is 5.00 V and the rms value of the voltage is 5.77 V.\n",
"(b)The average value of the voltage is 2.50 V and the rms value of the voltage is 4.08 V.\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 9.17,Page number:263"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Question:\n",
"\"Finding the value of current at a given instant.\"\"\"\n",
"\n",
"from math import pi,sin,asin\n",
"\n",
"#Variable Declaration:\n",
"Im=12.0 #Maximum value of the alternating current(in Amperes)\n",
"f=60.0 #Frequency of the alternating current(in Hertz)\n",
"\n",
"\n",
"#Calculations:\n",
"w=2*pi*f\n",
"t=1/360.0\n",
"i=Im*sin(w*t)\n",
"i1=9.6\n",
"t=asin(i1/Im)/w\n",
"\n",
"\n",
"#Result:\n",
"print \"(a)The equation for the instantaneous current is i(t)=%.2f sin(%.2f*t) A.\" %(Im,w)\n",
"print \"(b)The value of the current after (1/360) second is %.2f A.\" %round(i,2)\n",
"print \"(c)The time taken to reach 9.6 A for the first time is %e seconds.\" %(t)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(a)The equation for the instantaneous current is i(t)=12.00 sin(376.99*t) A.\n",
"(b)The value of the current after (1/360) second is 10.39 A.\n",
"(c)The time taken to reach 9.6 A for the first time is 2.459727e-03 seconds.\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 9.18,Page number:263"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Question:\n",
"\"\"\"Finding the expression of an alternating current in cosine form.\"\"\"\n",
"\n",
"from math import asin,pi\n",
"\n",
"#Variable Declaration:\n",
"Imax=10.0 #Maximum value of current(in Amperes)\n",
"Io=5.0 #Value of current at t=0(in Amperes)\n",
"\n",
"\n",
"#Calculations:\n",
"phi=asin(Io/Imax)\n",
"phi_new=(pi/2.0)-phi\n",
"\n",
"\n",
"#Result:\n",
"print \"The expression for current is i=%.2f cos(wt-%.2f) A.\" %(Imax,phi_new)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The expression for current is i=10.00 cos(wt-1.05) A.\n"
]
}
],
"prompt_number": 16
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 9.19,Page number:264"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Question:\n",
"\"\"\"Finding the time(from negative value) at which the instantaneous current is 10/sqrt(2.0) A.\"\"\"\n",
"\n",
"from math import pi,sqrt,radians,asin\n",
"\n",
"#Variable Declaration:\n",
"Irms=20.0 #Rms value of alternating current(in Amperes)\n",
"f=50.0 #Frequency of the alternating current(in Hertz)\n",
"\n",
"\n",
"#Calculations:\n",
"ang_freq=2*pi*f\n",
"Im=Irms*sqrt(2.0)\n",
"i=10.0*sqrt(2.0)\n",
"ph_lag=pi/2.0\n",
"t=(asin(i/Im)+ph_lag)/ang_freq\n",
"\n",
"\n",
"#Result:\n",
"print \"The time(measured from negative value) at which instantaneous current will be 10/sqrt(2.0) is %.2f ms.\" %round((t*1000),2)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The time(measured from negative value) at which instantaneous current will be 10/sqrt(2.0) is 6.67 ms.\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 9.20,Page number:264"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Question:\n",
"\"\"\"Finding the average and rms value of an alternating current.\"\"\"\n",
"\n",
"from math import pow,sqrt\n",
"\n",
"#Variable Declaration:\n",
"Idc=10.0 #Dc current(in Amperes)\n",
"Im=5.0 #Peak value of sinusoidal component(in Volts)\n",
"\n",
"\n",
"#Calculations:\n",
"Iav=Idc\n",
"Irms=sqrt((10*10)+pow((5.0/sqrt(2.0)),2))\n",
"\n",
"\n",
"#Result:\n",
"print \"The average value of current is %.2f A.\" %(Iav)\n",
"print \"The rms value of current is %.2f A.\" %(Irms)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The average value of current is 10.00 A.\n",
"The rms value of current is 10.61 A.\n"
]
}
],
"prompt_number": 9
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 9.21,Page number:264"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Question:\n",
"\"\"\"Finding the sum of three alternating voltages.\"\"\"\n",
"\n",
"from math import radians,degrees\n",
"from cmath import rect,phase\n",
"\n",
"#Calculations:\n",
"v1=rect(147.3,radians(188.1))\n",
"v2=rect(294.6,radians(45))\n",
"v3=rect(88.4,radians(135))\n",
"v_res=v1+v2+v3\n",
"\n",
"\n",
"#Result:\n",
"print \"The resultant voltage is v=%.2f sin(wt+(%.2f degrees)) V.\" %(abs(v_res),degrees(phase(v_res)))"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The resultant voltage is v=250.07 sin(wt+(90.01 degrees)) V.\n"
]
}
],
"prompt_number": 24
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 9.22,Page number:265"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Question:\n",
"\"\"\"Finding the reactance offered by an inductor and a capacitor.\"\"\"\n",
"\n",
"from math import pi\n",
"\n",
"#Variable Declaration:\n",
"L=0.2 #Inductance of the inductor(in Henry)\n",
"C=10e-06 #Capacitance of the capacitor(in Farads)\n",
"f=100 #Initial frequency of the ac input voltage(in Hertz)\n",
"f1=140 #New frequency of the ac input voltage(in Hertz)\n",
"\n",
"\n",
"#Calculations:\n",
"X_L=2*pi*f*L\n",
"X_C=1.0/(2*pi*f*C)\n",
"X_L1=2*pi*f1*L\n",
"X_C1=1.0/(2*pi*f1*C)\n",
"\n",
"\n",
"#Result:\n",
"print \"(a)For a frequency of 100Hz, X_L=%.2f Ohms and X_C=%.2f Ohms.\" %(X_L,X_C)\n",
"print \"(a)For a frequency of 140Hz, X_L=%.2f Ohms and X_C=%.2f Ohms.\" %(X_L1,X_C1)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(a)For a frequency of 100Hz, X_L=125.66 Ohms and X_C=159.15 Ohms.\n",
"(a)For a frequency of 140Hz, X_L=175.93 Ohms and X_C=113.68 Ohms.\n"
]
}
],
"prompt_number": 19
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 9.23,Page number:265"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Question:\n",
"\"\"\"Finding the currents in each case.\"\"\"\n",
"\n",
"from math import radians,degrees\n",
"from cmath import rect,phase\n",
"\n",
"#Calculations:\n",
"I1=rect(10,0)\n",
"I2=rect(10,0)\n",
"Ia=I1+I2\n",
"I1=rect(10,radians(90))\n",
"Ib=I1+I2\n",
"I1=rect(10,radians(-90))\n",
"I2=rect(10,radians(-90))\n",
"Ic=I1+I2\n",
"V=250.0+1j*0\n",
"X_L=1j*25.0\n",
"Id=V/X_L\n",
"X_C=-1j*25.0\n",
"I=5.0+1j*0\n",
"Ve=I*X_C\n",
"\n",
"\n",
"#Result:\n",
"print \"(a)The unknown current is %.2f A at a phase angle of %.2f degrees.\" %(abs(Ia),degrees(phase(Ia)))\n",
"print \"(a)The unknown current is %.2f A at a phase angle of %.2f degrees.\" %(abs(Ib),degrees(phase(Ib)))\n",
"print \"(a)The unknown current is %.2f A at a phase angle of %.2f degrees.\" %(abs(Ic),degrees(phase(Ic)))\n",
"print \"(a)The unknown current is %.2f A at a phase angle of %.2f degrees.\" %(abs(Id),degrees(phase(Id)))\n",
"print \"(a)The unknown voltage is %.2f A at a phase angle of %.2f degrees.\" %(abs(Ve),degrees(phase(Ve)))"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(a)The unknown current is 20.00 A at a phase angle of 0.00 degrees.\n",
"(a)The unknown current is 14.14 A at a phase angle of 45.00 degrees.\n",
"(a)The unknown current is 20.00 A at a phase angle of -90.00 degrees.\n",
"(a)The unknown current is 10.00 A at a phase angle of -90.00 degrees.\n",
"(a)The unknown voltage is 125.00 A at a phase angle of -90.00 degrees.\n"
]
}
],
"prompt_number": 6
}
],
"metadata": {}
}
]
}
|