summaryrefslogtreecommitdiff
path: root/Electrical_Circuit_Theory_And_Technology/chapter_30.ipynb
blob: 6732d70c96352ceaef59a3aeadd2d861b08437ec (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:cc9bf89f9ef283e2e254a84fd5c837c0ed5af6c8784b676db04bdba61dcf814e"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h1>Chapter 30: Introduction to network analysis</h1>"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 1, page no. 536</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "rv1  =  100;#  in  volts\n",
      "rv2  =  50;#  in  volts\n",
      "thetav1  =  0;#  in  degrees\n",
      "thetav2  =  90;#  in  degrees\n",
      "R1  =  25;#  in  ohm\n",
      "R2  =  20;#  in  ohm\n",
      "R3  =  10;#  in  ohm\n",
      "\n",
      "#calculation:\n",
      " #voltage\n",
      "V1  =  rv1*math.cos(thetav1*math.pi/180)  +  1j*rv1*math.sin(thetav1*math.pi/180)\n",
      "V2  =  rv2*math.cos(thetav2*math.pi/180)  +  1j*rv2*math.sin(thetav2*math.pi/180)\n",
      " #The  branch  currents  and  their  directions  are  labelled  as  shown  in  Figure  30.4\n",
      " #Two  loops  are  chosen.  loop  ABEF,  and  loop  BCDE\n",
      " #using  kirchoff  rule  in  3  loops\n",
      " #two  eqns  obtained\n",
      " #(R1  +  R2)*I1  +  R2*I2  =  V1\n",
      " #R2*I1  +  (R2  +  R3)*I2  =  V2\n",
      "I1  =  (3*V1  -  2*V2)/(3*(R1  +  R2)  -  2*(R2))\n",
      "I2  =  (V2  -  R2*I1)/(R2  +  R3)\n",
      "I  =  I1  +  I2\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  current,  I1  is  \",round(I1.real,2),\"  +  (\",round( I1.imag,2),\")i  A,  \\n current,  I2  is    \",round(I2.real,2),\"  +  (\",round(  I2.imag,2),\")i  A and \"\n",
      "print   \" total  current,  I  is  \",round(I.real,2),\"  +  (\",round( I.imag,2),\")i  A\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  current,  I1  is   3.16   +  ( -1.05 )i  A,  \n",
        " current,  I2  is     -2.11   +  ( 2.37 )i  A and \n",
        " total  current,  I  is   1.05   +  ( 1.32 )i  A\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 2, page no. 537</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import numpy\n",
      "#initializing  the  variables:\n",
      "V  =  8;#  in  volts\n",
      "R1  =  1;#  in  ohm\n",
      "R2  =  2;#  in  ohm\n",
      "R3  =  3;#  in  ohm\n",
      "R4  =  4;#  in  ohm\n",
      "R5  =  5;#  in  ohm\n",
      "R6  =  6;#  in  ohm\n",
      "\n",
      "#calculation:\n",
      " #Currents  and  their  directions  are  assigned  as  shown  in  Figure  30.6.\n",
      " #Three  loops  are  chosen  since  three  unknown  currents  are  required.  The  choice  of  loop  directions  is  arbitrary.\n",
      "    #loop  ABCDE,  and  loop  EDGF  and  loop  DCHG\n",
      " #using  kirchoff  rule  in  3  loops\n",
      " #three  eqns  obtained\n",
      " #R5*I1  +  (R6  +  R4)*I2  -  R4*I3  =  V\n",
      " #-1*R1*I1  +  (R6  +  R1)*I2  +  R2*I3  =  0\n",
      " #  R3*I1  -  (R3  +  R4)*I2  +  (R2  +  R3  +  R4)*I3  =  0\n",
      "#using  determinants\n",
      "d1  =  [[V, (R6  +  R4), -1*R4],[0, (R6  +  R1),  R2], [0,  (-1*(R3  +  R4)), (R2  +  R3  +  R4)]]\n",
      "D1  =  numpy.linalg.det(d1)\n",
      "d2  =  [[R5, V,  -1*R4],[-1*R1,  0,  R2],[ R3,  0,  (R2  +  R3  +  R4)]]\n",
      "D2  =  numpy.linalg.det(d2)\n",
      "d3  =  [[R5,  (R6  +  R4),  V],[-1*R1,  (R6  +  R1),  0],[ R3,  (-1*(R3  +  R4)),  0]]\n",
      "D3  =  numpy.linalg.det(d3)\n",
      "d  =  [[R5,  (R6  +  R4),  -1*R4],[-1*R1,  (R6  +  R1),  R2],[ R3,  (-1*(R3  +  R4)),  (R2  +  R3  +  R4)]]\n",
      "D  =  numpy.linalg.det(d)\n",
      "I1  =  D1/D\n",
      "I2  =  D2/D\n",
      "I3  =  D3/D  \n",
      "#Current  in  the  2  ohm  resistance\n",
      "I  =  I1  -  I2  +  I3\n",
      "#power  dissipated  in  the  3  ohm  resistance\n",
      "P3  =  R3*I**2\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  (a)current  through  2  ohm  resistor  is  \",round(I2,3),\"  A\"\n",
      "print  \"\\n  (b)power  dissipated  in  the  3  ohm  resistor  is  \",round(P3,3),\"W\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  (a)current  through  2  ohm  resistor  is   0.203   A\n",
        "\n",
        "  (b)power  dissipated  in  the  3  ohm  resistor  is   1.267 W"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 3, page no. 539</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "E1  =  5  +  0j;#  in  volts\n",
      "E2  =  2  +  4j;#  in  volts\n",
      "Z1  =  3  +  4j;#  in  ohm\n",
      "Z2  =  2  -  5j;#  in  ohm\n",
      "Z3  =  6  +  8j;#  in  ohm\n",
      "\n",
      "#calculation:\n",
      " #Currents  I1  and  I2  with  their  directions  are  shown  in  Figure  30.8.\n",
      " #Two  loops  are  chosen  with  their  directions  both  clockwise.loop  ABEF  and  loop  BCDE,\n",
      " #using  kirchoff  rule  in  3  loops\n",
      " #two  eqns  obtained\n",
      " #(Z1  +  Z3)*I1  -  Z3*I2  =  E1\n",
      " #-1*Z3*I1  +  (Z2  +  Z3)*I2  =  E2\n",
      "I1  =  ((Z2  +  Z3)*E1  +  Z3*E2)/((Z2  +  Z3)*(Z1  +  Z3)  -  Z3*Z3)\n",
      "I2  =  -1*(E1  -  (Z1  +  Z3)*I1)/Z3\n",
      "I3  =  I1  -  I2\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"current,  I1  is  \",round(I1.real,2),\"  +  (\",round(  I1.imag,2),\")i  A,\\n current,  I2  is    \",round(I2.real,2),\"  +  (\",round( I2.imag,2),\")i  A and \"\n",
      "print   \" current,  I3  is  \",round(I3.real,2),\"  +  (\",round(  I3.imag,2),\")i  A\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "current,  I1  is   0.57   +  ( 0.62 )i  A,\n",
        " current,  I2  is     0.56   +  ( 1.33 )i  A and \n",
        " current,  I3  is   0.01   +  ( -0.71 )i  A\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 4, page no. 541</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import numpy\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "rv1  =  10;#  in  volts\n",
      "rv2  =  12;#  in  volts\n",
      "rv3  =  15;#  in  volts\n",
      "thetav1  =  0;#  in  degrees\n",
      "thetav2  =  0;#  in  degrees\n",
      "thetav3  =  0;#  in  degrees\n",
      "R1  =  4;#  in  ohm\n",
      "R2  =  -5j;#  in  ohm\n",
      "R3  =  8;#  in  ohm\n",
      "R4  =  4;#  in  ohm\n",
      "R5  =  3j;#  in  ohm\n",
      "\n",
      "#calculation:\n",
      " #voltages\n",
      "V1  =  rv1*math.cos(thetav1*math.pi/180)  +  1j*rv1*math.sin(thetav1*math.pi/180)\n",
      "V2  =  rv2*math.cos(thetav2*math.pi/180)  +  1j*rv2*math.sin(thetav2*math.pi/180)\n",
      "V3  =  rv3*math.cos(thetav3*math.pi/180)  +  1j*rv3*math.sin(thetav3*math.pi/180)\n",
      " #Currents  I1,  I2  and  I3  with  their  directions  are  shown  in  Figure  30.10.\n",
      " #Three  loops  are  chosen.  The  choice  of  loop  directions  is  arbitrary.  loop  ABGH,  and  loopBCFG  and  loop  CDEF\n",
      "Z4  =  R4  +  R5\n",
      " #using  kirchoff  rule  in  3  loops\n",
      " #three  eqns  obtained\n",
      " #R1*I1  +  R2*I2  =  V1  +  V2\n",
      " #-1*R3*I1  +  (R3  +  R2)*I2  +  R3*I3  =  V2  +  V3\n",
      " #  -1*R3*I1  +  R3*I2  +  (R3  +  Z4)*I3  =  V3\n",
      " #using  determinants\n",
      "d1  =  [[(V1  +  V2),  R2,  0],[(V2  +  V3),  (R3  +  R2),  R3],[V3,  R3,  (R3  +  Z4)]]\n",
      "D1  =  numpy.linalg.det(d1)\n",
      "d2  =  [[R1,  (V1  +  V2),  0],[-1*R3,  (V2  +  V3),  R3],[-1*R3,  V3,  (R3  +  Z4)]]\n",
      "D2  =  numpy.linalg.det(d2)\n",
      "d3  =  [[R1,  R2,  (V1  +  V2)],[-1*R3,  (R3  +  R2),  (V2  +  V3)],[-1*R3,  R3,  V3]]\n",
      "D3  =  numpy.linalg.det(d3)\n",
      "d  =  [[R1,  R2,  0],[-1*R3,  (R3  +  R2),  R3],[-1*R3,  R3,  (R3  +  Z4)]]\n",
      "D  =  numpy.linalg.det(d)\n",
      "I1  =  D1/D\n",
      "I2  =  D2/D\n",
      "I3  =  D3/D  \n",
      "I3mag  =  abs(I3)\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  magnitude  of  the  current  through  (4  +  i3)ohm  impedance  is  \",round(I3mag,2),\"  A\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  magnitude  of  the  current  through  (4  +  i3)ohm  impedance  is   1.84   A"
       ]
      }
     ],
     "prompt_number": 8
    }
   ],
   "metadata": {}
  }
 ]
}