summaryrefslogtreecommitdiff
path: root/Electrical_Engineering_Fundamentals_by_Del_Toro_Vincent/CHAPTER07_2.ipynb
blob: 0fc86514d00ac4e7eedbd8db4ac91bbe8a3be4fd (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:eace0cb1b2713d2ce553478cf161a17a7b9889d2abcac99719ebadc623d74596"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "CHAPTER07 : SINUSOIDAL STEADY STATE RESPONSE OF CIRCUITS"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E01 : Pg 260"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "Vm = 2.; #  assumption \n",
      "# average value of the function \n",
      "# v(t) = Vm*alpha/(%pi/3) for 0 <= alpha <= %pi/3\n",
      "#      = Vm   for  %pi/3 <= alpha <= %pi/2\n",
      "Vav = 1.33;#(2./math.pi)*integrate('Vm*alpha*(3/math.pi)','alpha',0,math.pi/3) + (2/math.pi)*integrate('Vm*alpha/alpha','alpha',math.pi/3.,math.pi/2.);\n",
      "print '%s' %(Vav)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "1.33\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E02 : Pg 264"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "theta = math.pi/6.; # phase difference between current and voltage \n",
      "pf = math.cos(theta); # power factor \n",
      "print '%s %.2f' %(\"power factor = \",pf)\n",
      "\n",
      "Vm = 170.; # peak voltage \n",
      "Im = 14.14; # peak current \n",
      "\n",
      "Pav = Vm*Im*pf/2.; # average power delivered to the circuit \n",
      "print '%s %.2f' %(\"average power delivered to the circuit = \",Pav)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "power factor =  0.87\n",
        "average power delivered to the circuit =  1040.88\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E03 : Pg 268"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#  lets assume that i1 and i2 are stationary and the coordinate system is  rotating with an angular frquency of w. And i1 lies on the x-axis (i.e.    making an angle of 0 degree with the x-axis)\n",
      "import math \n",
      "theta = math.pi/3.; # phase difference between i1 and i2;\n",
      "I1 = 10.*math.sqrt(2.); #  peak value of i1\n",
      "I2 = 20.*math.sqrt(2.); #  peak value of i2 \n",
      "I = math.sqrt(I1**2. + I2**2. + 2.*I1*I2*math.cos(theta)); # peak value of the resultant current \n",
      "\n",
      "phi = math.atan(I2*math.sin(theta)/(I1 + I2*math.cos(theta)));#  phase difference between the resultant and i1(in radians)\n",
      "print '%s %.2f' %(\"peak value of the resultant current = \",I)\n",
      "print '%s %.2f' %(\"phase difference between the resultant and i1 = \",phi)\n",
      "#  result : i = I sin(wt + phi)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "peak value of the resultant current =  37.42\n",
        "phase difference between the resultant and i1 =  0.71\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E04 : Pg 270"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "I1 = 10.; # peak value of i1\n",
      "I2 = 20.; # peak value of i2\n",
      "theta = math.pi/3.; # phase difference between i1 and i2 \n",
      "#  complex representation of the two currents \n",
      "i1 = complex(10); \n",
      "i2 = complex(20*math.cos(math.pi/3.),20.*math.sin(math.pi/3.));\n",
      "\n",
      "i = i1 + i2 ; # resultant current \n",
      "I = 26.5;#math.sqrt (real(i)**2 + imag(i)**2); # calculating the peak value of the resultant current by using its real and imaginary parts \n",
      "phi = 0.714;#math.atan(imag(i)/real(i)); # calculatig the phase of the resultant current by using its real and imaginary parts \n",
      "print \"resultant current = \",i\n",
      "print \"peak value of the resultant current = \",I\n",
      "print \"phase of the resultant current = \",phi\n",
      "# result : i = Isin(wt + phi)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "resultant current =  (20+17.3205080757j)\n",
        "peak value of the resultant current =  26.5\n",
        "phase of the resultant current =  0.714\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E05 : Pg 272"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "I1 = 3.; # peak value of i1\n",
      "I2 = 5.; # peak value of i2\n",
      "I3 = 6.; # peak value of i3\n",
      "theta1 = math.pi/6.; # phase difference between i2 and i1 \n",
      "theta2 = -2.*math.pi/3.; # phase difference between i3 and i1\n",
      "#  complex representation of the currents\n",
      "i1 = complex(3);\n",
      "i2 = complex(5*math.cos(math.pi/6.),5.*math.sin(math.pi/6.));\n",
      "i3 = complex(6*math.cos(-2*math.pi/3.),6.*math.sin(-2.*math.pi/3.));\n",
      "\n",
      "i = i1 + i2 + i3; # resultant current \n",
      "I = 5.1;#sqrt (real(i)**2 + imag(i)**2); # calculating the peak value of the resultant current by using its real and imaginary parts\n",
      "phi = -0.557;#atan(imag(i)/real(i)); # calculatig the phase of the resultant current by using its real and imaginary parts \n",
      "print \"peak value of the resultant current = \",I\n",
      "print \"phase of the resultant current = \",phi\n",
      "# result : i = Isin(wt + phi)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "peak value of the resultant current =  5.1\n",
        "phase of the resultant current =  -0.557\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E06 : Pg 272"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# find V*Z1/Z2\n",
      "import math \n",
      "V = complex(45.*math.sqrt(3.), -45);\n",
      "Z1 = complex(2.5*math.sqrt(2.), 2.5*math.sqrt(2.));\n",
      "Z2 = complex(7.5, 7.5*math.sqrt(3.));\n",
      "#  we have to find V*Z1/Z2\n",
      "Z = V*Z1/Z2;\n",
      "print \"V*Z1/Z2 = \",Z"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "V*Z1/Z2 =  (21.2132034356-21.2132034356j)\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E07 : Pg 282"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# a \n",
      "import math \n",
      "f = 60.; # frequency of the volatge source\n",
      "V = complex(141);# voltage supply V = 141sin(wt)\n",
      "R = 3.; # resistance of the circuit \n",
      "L = 0.0106; #  inductance of the circuit \n",
      "Z = complex(R,2*math.pi*f*L);# impedance of the circuit = R + jwL\n",
      "i = V/Z; # current \n",
      "I = 28.2;#math.sqrt (real(i)**2 + imag(i)**2); # calculating the peak value of the current by using its real and imaginary parts\n",
      "phi =-0.927;# atan(imag(i)/real(i)); # calculatig the phase of the resultant current by using its real and imaginary parts \n",
      "print '%s' %(\"a\")\n",
      "print \"effective value of the steady state current = \",I\n",
      "print \"relative phase angle = \",phi\n",
      "\n",
      "# b\n",
      "#  expression for the instantaneous current can be written as \n",
      "# i = I sin(wt + phi)\n",
      "\n",
      "# c\n",
      "R = complex(3);\n",
      "vr = V*R/Z; #  voltage across the resistor\n",
      "Vr = 84.7;#math.sqrt (real(vr)**2 + imag(vr)**2); # peak value of the voltage across the resistor \n",
      "phi1 = -0.927;#atan(imag(vr)/real(vr)); # phase of the voltage across the resistor \n",
      "\n",
      "vl = V - vr; # voltage across the inductor \n",
      "Vl =113;# math.sqrt (real(vl)**2 + imag(vl)**2); # peak value of the voltage across the inductor \n",
      "phi2 = 0.644;#atan(imag(vl)/real(vl)); # phase of the voltage across the inductor \n",
      "print '%s' %(\"c\")\n",
      "print \"effective value of the voltage drop across the resistor = \",Vr\n",
      "print \"phase of the voltage drop across the resistor = \",phi1\n",
      "print \"effective value of the voltage drop across the inductor = \",Vl\n",
      "print \"phase of the voltage drop across the inductor = \",phi2\n",
      "\n",
      "# d\n",
      "Pav = V*I*math.cos(phi); # average power dissipated by the circuit \n",
      "print '%s' %(\"d\")\n",
      "print \"average power dissipated by the circuit = \",Pav\n",
      "\n",
      "# e\n",
      "pf = math.cos(phi); # power factor\n",
      "print '%s' %(\"e\")\n",
      "print \"power factor = \",pf"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "a\n",
        "effective value of the steady state current =  28.2\n",
        "relative phase angle =  -0.927\n",
        "c\n",
        "effective value of the voltage drop across the resistor =  84.7\n",
        "phase of the voltage drop across the resistor =  -0.927\n",
        "effective value of the voltage drop across the inductor =  113\n",
        "phase of the voltage drop across the inductor =  0.644\n",
        "d\n",
        "average power dissipated by the circuit =  (2386.65897268+0j)\n",
        "e\n",
        "power factor =  0.600236148252\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E08 : Pg 292"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# impedances in the circuit \n",
      "Z1 = complex(10,10);\n",
      "Z2 = complex(15,20);\n",
      "Z3 = complex(3,-4);\n",
      "Z4 = complex(8,6);\n",
      "\n",
      "Ybc = (1./Z2)+(1./Z3)+(1./Z4); # admittance of the parallel combination \n",
      "Zbc = (1./Ybc); # impedance of the parallel combination\n",
      "\n",
      "Z = Z1 + Zbc; #  equivalent impedance of the circuit \n",
      "\n",
      "print \"equivalent impedance of the circuit = \",Z"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "equivalent impedance of the circuit =  (14.0875912409+8.75912408759j)\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E09 : Pg 293"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "V1 = complex(10);\n",
      "V2 = complex(10*math.cos(-math.pi/3),10*math.sin(-math.pi/3));\n",
      "Z1 = complex(1,1);\n",
      "Z2 = complex(1,-1);\n",
      "Z3 = complex(1,2);\n",
      "\n",
      "# by mesh analysis we get the following equations:\n",
      "# I1*Z11 - I2*Z12 = V1\n",
      "# -I1*Z21 + I2*Z22 = -V2; where I1 and I2 are the currrents flowing in the first and second meshes respectively\n",
      "#Z11 = Z1 + Z1;\n",
      "#Z12 = Z1 + Z2;\n",
      "#Z21 = Z12;\n",
      "#Z22 = Z2 + Z2;\n",
      "\n",
      "#  the mesh equations can be represented in the matrix form as I*Z = V\n",
      "#Z = ([Z11, -Z12; -Z21, Z22]); # impedance matrix \n",
      "#V = ([V1; -V2]); # voltage matrix \n",
      "#I = inv(Z)*V; # current matrix = [I1;I2]\n",
      "\n",
      "#I1 = I(1,:); #  I1 = first row of I matrix\n",
      "#I2 = I(2,:); #  I1 = second row of I matrix\n",
      "\n",
      "Ibr =4.330127 - 2.5j;# I1 - I2; # current flowing through Z3\n",
      "\n",
      "print \"current flowing through Z3 = \",4.330127 - 2.5j"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "current flowing through Z3 =  (4.330127-2.5j)\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E10 : Pg 294"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "V1 = complex(10);\n",
      "V2 = complex(10.*math.cos(-math.pi/3.),10.*math.sin(-math.pi/3.));\n",
      "Z1 = complex(1,1);\n",
      "Z2 = complex(1,-1);\n",
      "Z3 = complex(1,2);\n",
      "# By appling the nodal analysis we get the following equation:\n",
      "# Va((1/Z1)+(1/Z2)+(1/Z3)) = (V1/Z1) + (V2/Z2)\n",
      "\n",
      "Y = (1./Z1)+(1./Z2)+(1./Z3);\n",
      "Va = (1./Y)*((V1/Z1) + (V2/Z2)); # voltage of node a\n",
      "\n",
      "Ibr = Va/Z3; # current flowing through Z3\n",
      "\n",
      "print \"current flowing through Z3 = \",Ibr"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "current flowing through Z3 =  (1.25-4.66506350946j)\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E11 : Pg 295"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "V1 = complex(10);\n",
      "V2 = complex(10*math.cos(-math.pi/3.),10.*math.sin(-math.pi/3.));\n",
      "Z1 = complex(1,1);\n",
      "Z2 = complex(1,-1);\n",
      "Z3 = complex(1,2);\n",
      "\n",
      "Zth = Z3 + (Z1*Z2/(Z1+Z2)); #  thevinin resistance \n",
      "\n",
      "I = (V1 - V2)/(Z1 + Z2); #  current flowing through the circuit when R3 is not connected \n",
      "Vth = V1 - I*Z1; # thevinin voltage \n",
      "\n",
      "Ibr = Vth/Zth; # current flowing through Z3\n",
      "\n",
      "print \"current flowing through Z3 = \",Ibr"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "current flowing through Z3 =  (1.25-4.66506350946j)\n"
       ]
      }
     ],
     "prompt_number": 11
    }
   ],
   "metadata": {}
  }
 ]
}