summaryrefslogtreecommitdiff
path: root/Electric_Circuits_by_M._Navhi_And_J._A._Edminister/ch15.ipynb
blob: b4e2fcadf2655c814ddbadf1a2a88bb913c40ea3 (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:573d3c26bc06249cf2f9f4748e6d10f443e0ca37c6357e39541ace7a1534cbe6"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 15 : Mutual Inductance and Transformers"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.4  Page No : 306"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "#Example 15.4\")\n",
      "\n",
      "# Given\n",
      "#L1 = 0.1H L2 = 0.2H\")\n",
      "#i1 = 4A i2 = 10A\")\n",
      "L1 = 0.1;L2 = 0.2\n",
      "i1 = 4;i2 = 10;\n",
      "#The energy stored in coupled coils is\n",
      "#W = (L1*i1**2)/2+(L2*i2**2)/2+M*i1*i2\")\n",
      "\n",
      "#a)\")\n",
      "M = 0.1;\n",
      "W = (L1*i1**2)/2+(L2*i2**2)/2+M*i1*i2;\n",
      "print \"Total Energy in the coils = %3.2fJ\"%(W);\n",
      "\n",
      "#b)\")\n",
      "M = math.sqrt(2)/10;\n",
      "W = (L1*i1**2)/2+(L2*i2**2)/2+M*i1*i2;\n",
      "print \"Total Energy in the coils = %3.2fJ\"%(W);\n",
      "\n",
      "#c)\")\n",
      "M = -0.1;\n",
      "W = (L1*i1**2)/2+(L2*i2**2)/2+M*i1*i2;\n",
      "print \"Total Energy in the coils = %3.2fJ\"%(W);\n",
      "\n",
      "#a)\")\n",
      "M = -math.sqrt(2)/10;\n",
      "W = (L1*i1**2)/2+(L2*i2**2)/2+M*i1*i2;\n",
      "print \"Total Energy in the coils = %3.2fJ\"%(W);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total Energy in the coils = 14.80J\n",
        "Total Energy in the coils = 16.46J\n",
        "Total Energy in the coils = 6.80J\n",
        "Total Energy in the coils = 5.14J\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.7  Page No : 311"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from scipy.linalg import polar\n",
      "\n",
      "#Example 15.7\")\n",
      "\n",
      "# Given\n",
      "#N1 = 20 N2 = N3 = 10\")\n",
      "#I2 = 10(-53.13 deg) I3 = 10(-45 deg)\")\n",
      "N1 = 20;\n",
      "N2 = 10;\n",
      "N3 = 10;\n",
      "I2mag = 10;\n",
      "I2ph = -53.13;\n",
      "I3mag = 10;\n",
      "I3ph = -45;\n",
      "#From figure 15.14\n",
      "#N1*I1-N2*I2-N3*I3 = 0\")\n",
      "#Solving for I1\n",
      "Xmag = N2*I2mag \n",
      "Xph = I2ph\n",
      "x = Xmag*math.cos((Xph*math.pi)/180);\n",
      "y = Xmag*math.sin((Xph*math.pi)/180);\n",
      "z = complex(x,y)\n",
      "\n",
      "Ymag = N3*I3mag \n",
      "Yph = I3ph\n",
      "x1 = Ymag*math.cos((Yph*math.pi)/180);\n",
      "y1 = Ymag*math.sin((Yph*math.pi)/180);\n",
      "z1 = complex(x1,y1)\n",
      "\n",
      "I1 = (z+z1)/N1\n",
      "R,Theta = polar([[I1]]);\n",
      "R = R[0][0].real\n",
      "Theta = Theta[0][0].real\n",
      "\n",
      "print \"I1 = %3.2f%3.2f deg) A\"%(R,(Theta*180)/math.pi);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "I1 = 0.66571.52 deg) A\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.8  Page No : 316"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from scipy.linalg import polar\n",
      "#Example 15.8\")\n",
      "\n",
      "# Given\n",
      "#L1 = 0.2H L2 = 0.1H\")\n",
      "#M = 0.1H R = 10ohm\")\n",
      "#v1 = 142.3*math.sin(100*t)\")\n",
      "L1 = 0.2;L2 = 0.1\n",
      "M = 0.1;R = 10;\n",
      "v1mag = 142.3;\n",
      "w = 100;\n",
      "#Let Input impedance be Z1 and can be calculated as\n",
      "#From the equations in 15.10\n",
      "#Z1 = 1j*w*L1+((M*w)**2)/(Z2+1j*w*L2)\")\n",
      "Z1 = 1j*w*L1+((M*w)**2)/(R+1j*w*L2)\n",
      "R,Theta = polar([[Z1]])\n",
      "R = R[0][0].real\n",
      "Theta = Theta[0][0].real\n",
      "\n",
      "#If I1 is the input current\n",
      "I1mag = v1mag/R\n",
      "I1ph = -(Theta*180)/math.pi\n",
      "#In time domain form\n",
      "print \"i1 = %3.1f*math.sin%d*t%3.1f deg) A)\"%(I1mag,w,I1ph);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i1 = 450.0*math.sin100*t-905.9 deg) A)\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.9  Page No : 318"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from sympy import Symbol\n",
      "\n",
      "s = Symbol('s')\n",
      "# Given\n",
      "#L1 = 0.2H L2 = 0.1H\")\n",
      "#M = 0.1H R = 10ohm\")\n",
      "#v1 = u(t) a unit step function\")\n",
      "L1 = 0.2;\n",
      "L2 = 0.1\n",
      "M = 0.1;\n",
      "R = 10;\n",
      "v1 = 1;\n",
      "w = 100;\n",
      "#Let Input impedance be Z1 and can be calculated as\n",
      "#From the equations in 15.10\n",
      "#Z1(s) = L1*s-((M*s)**2)/(R+L2*s)\")\n",
      "Z1 = L1*s-(((M*s)**2)/(R+L2*s))\n",
      "#Proper rearranging of co-efficients\n",
      "Num = Z1/0.01\n",
      "Den = Z1*100\n",
      "\n",
      "print \"Z1(s)\",Num/Den\n",
      "Y1 = 1./Z1\n",
      "print \"Y1(s)\",Den/Num\n",
      "\n",
      "#As the input is unit step function the value is 1V for t>0\n",
      "#In exponential form the value is represented as exp(s*t) with s = 0 as the pole of Y1(s)\n",
      "\n",
      "#Therefore forced response\n",
      "k = 1/L1;\n",
      "print \"Forced response i1,f = %d*t) A)\"%(k);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Z1(s) 1\n",
        "Y1(s) 1\n",
        "Forced response i1,f = 5*t) A)\n"
       ]
      }
     ],
     "prompt_number": 8
    }
   ],
   "metadata": {}
  }
 ]
}