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
|
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Chapter 2 : Electric Circuits"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 1 : pg 6"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"current in resistance Ra=1.0 ohm is ,(A)= 0.105\n"
]
}
],
"source": [
"# Example 2.1 :current\n",
"#calculate the current \n",
"# given :\n",
"import numpy\n",
"#15*I1-5*I2=10 loop 1 equation\n",
"#20*I2-5*I1-5*I3=0 loop 2 equation\n",
"#10*I3-5*I2=0 loop 3 equation\n",
"vs=10.;#voltage in volts\n",
"R1=10.;#resistance in ohm\n",
"R2=5.;#resistance in ohm\n",
"R3=10.;#resistance in ohm\n",
"R4=5.;#resistance in ohm\n",
"R5=4.;#resistance in ohm\n",
"Ra=1.;#resistance in ohm\n",
"#calculations\n",
"A=([[R1+R2, R2-R1, 0],[R2-R1, R2+R3+R4, -R4],[R4-(R5+Ra), -R4, R4+R5+Ra]]);#making equations\n",
"nb=7.;#number of branches\n",
"nn=5.;#number of nodes\n",
"nl=nb-(nn-1);#number of loops\n",
"nvs=1.;#number of voltage sources\n",
"nivs=nn-1-nvs;#number of independent voltage variables\n",
"B=([[vs],[0],[0]]);#making equations\n",
"X=numpy.dot(numpy.linalg.inv(A),B);#solving equations\n",
"I3=X[2,0];#calculating currrent\n",
"#results\n",
"print \"current in resistance Ra=1.0 ohm is ,(A)=\",round(I3,3)\n",
"#directions of the current are 2 to 3 and 3 to 4 respectively\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 2 : pg 6"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"current through Rx is(by node voltage method), (A)= 3.956\n",
"current through Rx is (by loop current method),(A) = 3.956\n"
]
}
],
"source": [
"# Example 2.2 :current\n",
"#calculate the current in both cases\n",
"import numpy\n",
"# given :\n",
"vs1=72.;#voltage in volts\n",
"vs2=40.;#voltage in volts\n",
"R1=36.;#resistance in ohm\n",
"R2=10.;#resistance in ohm\n",
"ig=2.;#current in amperes\n",
"Rx=8.;#resistance in ohm\n",
"#calculations\n",
"#(va-72)/36+(va-40)/10 -2 +va/8=0 node equation at 1\n",
"va=((R2*Rx*vs1)+(R1*Rx*vs2)+(R1*R2*Rx*ig))/((R2*Rx)+(R1*Rx)+(R1*R2));#voltage in volts\n",
"ix1=va/Rx;#current in amperes\n",
"#(R1+R2)*I1-R2*I2+vs2=vs1 loop equation 1\n",
"#R2*I2-R2*I1+Ix*Rx=vs2 loop equation 2\n",
"#Ix=I2+2\n",
"A=([[R1+R2, -R2],[-R2, R2+Rx]]);#making equations\n",
"B=([[vs1-vs2],[vs2-2*Rx]]);#making equations\n",
"X=numpy.dot(numpy.linalg.inv(A),B);#solving equations\n",
"ix2=X[1,0]+ig;#current in amperes\n",
"print \"current through Rx is(by node voltage method), (A)=\",round(ix1,3)\n",
"print \"current through Rx is (by loop current method),(A) =\",round(ix2,3)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 3 : pg 7"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"current through Rl is (from b to a),(A)= 0.359\n"
]
}
],
"source": [
"# Example 2.3 :current\n",
"#calculate the current\n",
"import numpy\n",
"# given :\n",
"vs1=10;#voltage in volts\n",
"i5=2;#current in amperes\n",
"i2=i5;#current\n",
"r1=1;#resistance in ohms\n",
"r2=5;#resistance in ohms\n",
"r3=5;#resistance in ohms\n",
"rl=10;#resistance in ohms\n",
"r4=5;#resistance ohms\n",
"#calculations\n",
"#(r1+r2+r3)*i1-r2*i2-r3*i3=vs1 loop equaion 1\n",
"#-r2*i1-(r1+r2)*i2+(rl+r2+r3)*i3=0 loop equation 2\n",
"A=([[4*(r1+r2+r3), -r2*4],[-r2, (rl+r2+r3)]]);#making equations\n",
"B=([[4*(vs1+r2*i2)],[i2*(r2+r3)]]);#making equations\n",
"X=numpy.dot(numpy.linalg.inv(A),B);#solving equations\n",
"il=i2-X[1,0];#calculating current\n",
"#results\n",
"print \"current through Rl is (from b to a),(A)=\",round(il,3)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 4 : pg 8"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Applying Thevenins Theorem \n",
"current through Rx is, (A) 3.956\n",
"Applying Nortons Theorem \n",
"current through Rx is, (A) = 3.956\n"
]
}
],
"source": [
"# Example 2.4 :current\n",
"#calculate the current\n",
"# given :\n",
"vs1=72.;#voltage in volts\n",
"vs2=40.;#voltage in volts\n",
"R1=36.;#resistance in ohms\n",
"R2=10.;#resistance in ohms\n",
"ig=2.;#current in amperes\n",
"Rx=8.;#resistance in ohms\n",
"#calculations and results\n",
"print \"Applying Thevenins Theorem \"\n",
"#(vs1-voc)/R1+(v40-voc)/R2 +2 =0 node equation at 1\n",
"voc=(R2*vs1+R1*vs2+R1*R2*ig)/(R1+R2);#voltage in volts\n",
"req=(R1*R2)/(R1+R2);#resistance in ohms\n",
"ix1=(voc)/(req+Rx);#resistance in ohms\n",
"print \"current through Rx is, (A)\",round(ix1,3)\n",
"print \"Applying Nortons Theorem \"\n",
"Is=(vs1/R1)+(vs2/R2)+ig;#current in amperes\n",
"ix2=(req*(Is/(Rx+req)));#current in amperes\n",
"print \"current through Rx is, (A) =\",round(ix2,3)\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 5 : pg 8"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(a) Applying Thevenins Theorem \n",
"Thevenin equivalent open circuit voltage is, (V)= 5.0\n",
"Thevenin equivalent resistance is,(Ohm)= 50.0\n",
"(b) Applying Nortons Theorem \n",
"Norton short circuit current is,(A)= 0.1\n",
"Norton equivalent resistance is,(Ohm)= 50.0\n"
]
}
],
"source": [
"# Example 2.5 :Thevenin's and Norton's Equivalent\n",
"#calculate the current in all cases\n",
"# given :\n",
"vs1=10.;#voltage in volts\n",
"R1=50.;#resistance in ohms\n",
"R2=50.;#resistance in ohms\n",
"R3=25.;#resistance in ohms\n",
"#calculations and results\n",
"print \"(a) Applying Thevenins Theorem \"\n",
"voc=(R1/(R1+R2))*vs1;#voltage in volts\n",
"req=((R1*R2)/(R1+R2))+R3;#resistance in ohms\n",
"print \"Thevenin equivalent open circuit voltage is, (V)=\",voc\n",
"print \"Thevenin equivalent resistance is,(Ohm)=\",req\n",
"print \"(b) Applying Nortons Theorem \"\n",
"Isc=((vs1)/(R1+(R1*R3)/(R1+R3)))*(R1/(R1+R3));#\n",
"req=((R1*R2)/(R1+R2))+R3;#resistance in ohms\n",
"print \"Norton short circuit current is,(A)=\",Isc\n",
"print \"Norton equivalent resistance is,(Ohm)=\",req\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 6 : pg 10"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"current through Rx is (from A to B),(mA)= 0.299\n"
]
}
],
"source": [
"# Example 2.6 :current\n",
"#calculate the current \n",
"# given :\n",
"vs1=10.;#voltage volts\n",
"r1=100.;#resistance in ohms\n",
"r2=600.;#resistance in ohms\n",
"r3=150.;#resistance in ohms\n",
"r4=850.;#resistance in ohms\n",
"rx=50.;#resistance in ohms\n",
"#calculations\n",
"voc=vs1*((r3/(r1+r3))-(r4/(r2+r4)));#open circuit voltage in volts\n",
"req=((r1*r3)/(r1+r3))+((r2*r4)/(r2+r4));#equivalent resistance in ohms\n",
"ix=voc/(req+rx)*10**3;#current in amperes\n",
"#results\n",
"print \"current through Rx is (from A to B),(mA)=\",round(ix,3)\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 7 : pg 11"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"current is,(A) -1.429\n",
"equivalent resistance is,(ohm)= 1.273\n"
]
}
],
"source": [
"# Example 2.7 :\n",
"#calculate the Norton's Equivalent\n",
"# given :\n",
"vs1=40.;#volts\n",
"vs2=20.;#volts\n",
"r1=2.;#resistance in ohms\n",
"r2=6.;#resistance in ohms\n",
"r3=2.;#resistance in ohms\n",
"r4=2.;#resistance in ohms\n",
"#calculations\n",
"iab=((r1*vs1)/(r2+(r1/2))*((r1+(r3/2))/(r1+r3)));#current in amperes\n",
"iab1=-vs2/r1;#current amperes\n",
"it=iab+iab1;#current amperes\n",
"req1=r1+((r1*r2)/(r1+r2));#equivalent resistance in ohms\n",
"req=(req1*r3)/(req1+r3);#equivalent resistance in ohms\n",
"#results\n",
"print \"current is,(A)\",round(it,3)\n",
"print \"equivalent resistance is,(ohm)=\",round(req,3)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 8 : pg 12"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"current is (when t=500 micro seconds),(A)= 0.221\n",
"time at which current will be zero is,(micro-seconds)= 1222.0\n"
]
}
],
"source": [
"# Example 2.8:equation of current and time\n",
"#calculate the current \n",
"from math import exp,ceil\n",
"# given :\n",
"v=100.;#voltage in volts\n",
"r=100.;#resistance in ohms\n",
"l=0.2;#inductance in henrty\n",
"#calculations and results\n",
"T=1/(l/r);#calculating time in seconds\n",
"t=500.;#time in micro seconds\n",
"i1=1-exp(-T*t*10**-6);#current in amperes\n",
"print \"current is (when t=500 micro seconds),(A)=\",round(i1,3)\n",
"v2=50.;#voltage in volts\n",
"x=v2/r;#variable\n",
"x1=x*((v2/r)+i1);#variable \n",
"t1=t+(10**6*(x1/500.));#time in seconds\n",
"print \"time at which current will be zero is,(micro-seconds)=\",ceil(t1)\n",
"#time is caluclated wrong in the textbook as they had not added the values\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 9 : pg 15"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"time is ,(seconds)= 0.025\n"
]
}
],
"source": [
"# Example 2.9 :time\n",
"#calculate the time required\n",
"from math import log\n",
"# given :\n",
"v=10.;#voltage in volts\n",
"r1=500.;#resistance in ohms\n",
"ix=0.;#current in amperes\n",
"r=700;#resistance in ohms\n",
"c=100;#capacitance in micro farads\n",
"#calculations\n",
"x=1/(r*c*10**-6);#variable\n",
"i=30;#current in mA\n",
"y=(i*10**-3)-(v/r1);#variable\n",
"t=-((log(y*(r/v))));#time in seconds\n",
"t1=t/x;#time in seconds\n",
"#results\n",
"print \"time is ,(seconds)=\",round(t1,3)\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 10 : pg 18"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"it= 2.697 *e^ -250.0 t*sin 370.81 t A\n"
]
}
],
"source": [
"# Example 2.10 :current equation\n",
"#calculate the current equation\n",
"# given :\n",
"from numpy import roots\n",
"v=100.;#volts\n",
"r=50.;#in ohms\n",
"l=0.1;#henry\n",
"c=50.;#mf\n",
"#calculations\n",
"p = ([1,500.0,2*10**5])\n",
"#p=2*10**5+500*d+d**2;\n",
"x=roots(p)\n",
"c1=0;#at t=0 i=0\n",
"c2=1000/x[0].imag;#\n",
"#results\n",
"print \"it= \",round(c2,3),\"*e^\",x[0].real,\"t*sin\",round(x[0].imag,3),\"t A\"\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 11 : pg 19"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"parts (a) saw tooth wave\n",
"rms value of e is ,(V)= 0.886\n",
"average value of e is ,(V)= 5\n",
"parts (b) half wave rectified sine wave form\n",
"rms value of e is ,(V)= 5.0\n",
"average value of e is ,(V)= 3.183\n"
]
}
],
"source": [
"# Example 2.11 :\n",
"#calculate the average & rms value\n",
"# given :\n",
"from numpy import linspace\n",
"from math import sin,pi,sqrt\n",
"from scipy import integrate\n",
"vm=10;#voltage in volts\n",
"e=vm/2;#voltage in volts\n",
"t=linspace(0,2, num=3);#time range\n",
"#x=intsplin(t,(5*t)**2);#variable\n",
"x=1.571;\n",
"#calculations and results\n",
"rms=sqrt(x/2);#rms value of voltage in volts\n",
"av=vm/2;#average value of voltage in volts\n",
"print \"parts (a) saw tooth wave\"\n",
"print \"rms value of e is ,(V)=\",round(rms,3)\n",
"print \"average value of e is ,(V)=\",av\n",
"t1=0;#initial time in seconds\n",
"t2=pi;#final time in seconds\n",
"t3=2*pi;#time interval\n",
"def function(t):\n",
" return sin(t) *sin(t);\n",
"\n",
"def function2(t):\n",
" return sin(t)\n",
" \n",
"x=integrate.quad(function,t1,t2)[0];#variable\n",
"rms=sqrt((1/(2*pi))*x*vm**2);#rms value of voltage in volts\n",
"av=(10/(2*pi))*integrate.quad(function2,t1,t2)[0];#average value of voltage in volts\n",
"print \"parts (b) half wave rectified sine wave form\"\n",
"print \"rms value of e is ,(V)=\",rms\n",
"print \"average value of e is ,(V)=\",round(av,3)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 12 : pg 20"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"part (a)\n",
"Impedance is ,(Ohm)= (16.4700606969+2.90411607477j)\n",
"part (b)\n",
"Impedance is ,(Ohm)= (3.53553390593+3.53553390593j)\n"
]
}
],
"source": [
"# Example 2.12 :\n",
"#calculate the Circuit constants\n",
"# given :\n",
"from math import sqrt, cos, sin,pi\n",
"#v=194*cos(800*t+150)V Voltage equation\n",
"#I=11.6*cos(800*t+140)A Current equation\n",
"vm=194/sqrt(2);#voltage in volts\n",
"va=150;#angle in degree\n",
"im=11.6/sqrt(2);#current in amperes\n",
"ia=140;#angle in degree\n",
"#calculations and results\n",
"zm=vm/im;#resistance in ohms\n",
"za=va-ia;#resistance in ohms\n",
"z1=zm*cos(za*pi/180.);#reactance in ohms\n",
"z2=zm*sin(za*pi/180.);#reactance in ohms\n",
"z=z1+1j*z2;#resistance in ohms\n",
"print \"part (a)\"\n",
"print \"Impedance is ,(Ohm)=\",z\n",
"print \"part (b)\"\n",
"#v=6*sin(1000*t+45)V Voltage equation\n",
"#I=12*cos(1000t-90)A current equation\n",
"vm1=60/sqrt(2);#voltage in volts\n",
"va1=45;#angle in degree\n",
"im1=12/sqrt(2);#current in amperes\n",
"ia1=0;#angle in degree\n",
"zm1=vm1/im1;#resistance in ohms\n",
"za1=va1-ia1;#resistance in ohms\n",
"z11=zm1*cos(za1*pi/180.);#reactance in ohms\n",
"z21=zm1*sin(za1*pi/180.);#reactance in ohms\n",
"z22=z11+1j*z21;#impedance in ohms\n",
"print \"Impedance is ,(Ohm)=\",z22\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 13 : pg 22"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"reading V2 is,(V) 207.123\n",
"reading V4 is 507.123 V or 92.877 V\n"
]
}
],
"source": [
"# Example 2.13 :reading\n",
"#calculate the voltage reading\n",
"# given :\n",
"from math import sqrt\n",
"v1=230.;#voltage in volts\n",
"v2=100.;#voltage in volts\n",
"#calculations\n",
"v2=sqrt(v1**2-v2**2);#voltage in volts\n",
"v3=300.;#voltage in volts\n",
"#results\n",
"print \"reading V2 is,(V)\",round(v2,3)\n",
"print \"reading V4 is \",round(v3+v2,3),\" V or \",round(v3-v2,3),\" V\"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 14 : pg 25"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Impedance is ,(Ohm)= (14.1877554161-14.1877554161j)\n",
"capacitance is ,(micro-farads)= 28.1933250377\n"
]
}
],
"source": [
"# Example 2.14 :circuit elements\n",
"#calculate the circuit elements\n",
"# given :\n",
"from math import sqrt,cos,sin,pi\n",
"#v=311*sin(2500*t+170) V voltage equation\n",
"#I=15.5*sin(2500*t-145)A current equation\n",
"vm=311/sqrt(2);#voltage in volts\n",
"va=170.;#angle in degree\n",
"im=15.5/sqrt(2);#current in amperes\n",
"ia=-145.;#angle in degree\n",
"#calculations\n",
"zm=vm/im;#resistance in ohms\n",
"za=(va-ia)-360.;#resistance ohms\n",
"z1=zm*cos(za*pi/180.);#resistance in ohms\n",
"z2=zm*sin(za*pi/180.);#resistance in ohms\n",
"z=z1+1j*z2;#resistance in ohms\n",
"t=2500;#time in seconds\n",
"c=(1/(z.real*t));#capacitance in farads\n",
"#results\n",
"print \"Impedance is ,(Ohm)=\",z\n",
"print \"capacitance is ,(micro-farads)=\",c*10**6\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 15 : pg 26"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"part (a) Star\n",
"phase voltage,(V)= 231.0\n",
"phase current,(A)= 5.0\n",
"line voltage ,(V)= 400\n",
"line current,(A)= 4.619\n",
"power ,(W)= 2560.0\n",
"part (b) Delta\n",
"phase voltage,(V)= 400.0\n",
"phase current,(A)= 8.0\n",
"line voltage ,(V)= 400.0\n",
"line current,(A)= 13.856\n",
"power ,(W)= 7680.0\n"
]
}
],
"source": [
"# Example 2.15 :parameters\n",
"#calculate the parameters of phase, line voltage and current, power\n",
"from math import sqrt\n",
"# given :\n",
"z=40+1j*30;#resistance in ohms\n",
"zph=sqrt(z.real**2+z.imag**2);#resistance in ohms\n",
"pf=z.real/zph;#power factor\n",
"v=400;#voltage in volts\n",
"#calculations and results\n",
"vp=v/(sqrt(3));#voltage in volts\n",
"pc=vp/zph;#current in amperes\n",
"lv=v;#voltage in volts\n",
"lc=pc;#current om amperes\n",
"p=sqrt(3)*v*lc*pf;#power in watts\n",
"print \"part (a) Star\"\n",
"print \"phase voltage,(V)=\",round(vp)\n",
"print \"phase current,(A)=\",round(pc)\n",
"print \"line voltage ,(V)=\",lv\n",
"print \"line current,(A)=\",round(lc,3)\n",
"print \"power ,(W)=\",p\n",
"z1=40+1j*30;#ohms\n",
"zph1=sqrt(z1.real**2+z1.imag**2);#ohms\n",
"pf1=z1.real/zph1;#power factor\n",
"v1=400.;#volts\n",
"vp1=v1;#volts\n",
"pc1=vp1/zph1;#amperes\n",
"lv1=v1;#volts\n",
"lc1=pc1*sqrt(3);#amperes\n",
"p1=sqrt(3)*v1*lc1*pf1;#watts\n",
"print \"part (b) Delta\"\n",
"print \"phase voltage,(V)=\",round(vp1)\n",
"print \"phase current,(A)=\",round(pc1)\n",
"print \"line voltage ,(V)=\",lv1\n",
"print \"line current,(A)=\",round(lc1,3)\n",
"print \"power ,(W)=\",p1\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.11"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
|