summaryrefslogtreecommitdiff
path: root/sample_notebooks/AshishKumar/Chapter2.ipynb
blob: 8d9af0c587583534761018601f2afa86a5fb5b5c (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
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 2 Switched communication systems"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2.2, page no 125"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "maximum auxillary current is:10.00 mA\n",
      "\n",
      "MMF in the auxillary winding is:2.00AT \n",
      "\n",
      "MMF in main winding is:40.00 AT \n",
      "\n",
      "net MMF required in main winding is:44.00 AT \n",
      "\n",
      "operating current needed is:4.40 mA \n",
      "\n",
      "working voltage is:2.84 volts \n",
      "\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "#given\n",
    "Io=4*10**-3 #rqueired operating current\n",
    "N1=10000 #no of turns in the main winding\n",
    "R1=645 #resistence of the main winding in ohms\n",
    "N2=200 #no of turns in auxillary winding\n",
    "B=2 #spacing bias\n",
    "Iaux=B/N2 #maximum auxillary current\n",
    "print \"maximum auxillary current is:%0.2f mA\\n\"%(Iaux*1e3)\n",
    "MMFaux=N2*Iaux #MMF in the auxillary winding\n",
    "print \"MMF in the auxillary winding is:%0.2fAT \\n\"%(MMFaux)\n",
    "MMFop=Io*N1 #operating MFF in main winding\n",
    "print \"MMF in main winding is:%0.2f AT \\n\"%(MMFop)\n",
    "MMFnet=MMFop+(0.1*MMFop) #net MMF required in main winding\n",
    "print \"net MMF required in main winding is:%0.2f AT \\n\"%(MMFnet)\n",
    "Iop=MMFnet/N1 #operating current needed\n",
    "print \"operating current needed is:%0.2f mA \\n\"%(Iop*1e3)\n",
    "V=Iop*R1 #working voltage in volts\n",
    "print \"working voltage is:%0.2f volts \\n\"%(V)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2.3,page no 125"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Busy hour calling rate is:1.20 \n",
      "\n",
      "Rate of traffic flow is 250.00 traffic unit \n"
     ]
    }
   ],
   "source": [
    "#given\n",
    "C=6000#Tatol no of call in busy hour\n",
    "SC=5000#no of subscribers\n",
    "CR=C/SC#busy hour calling rate\n",
    "print \"Busy hour calling rate is:%0.2f \\n\"%(CR)\n",
    "T=2.5/60#avarage duration of calls in hours\n",
    "\n",
    "A=C*T#rate of traffic flow\n",
    "print \"Rate of traffic flow is %0.2f traffic unit \"%(A)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2.4,page no 126"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "maxixmum current is 33.33 mamps \n",
      "\n",
      "operate lag is 1.83 msec \n",
      "\n",
      "release lag is 2.85 msec \n",
      "\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import log\n",
    "#given\n",
    "L=3#relay inductance in henry\n",
    "R=1500#relay resistance in ohm\n",
    "Io=20e-3#oparating current in amps\n",
    "Ir=8e-3#release current in amps\n",
    "\n",
    "V=50#supply volatage in volts\n",
    "Im=V/R#maxixmum current in amps\n",
    "print \"maxixmum current is %0.2f mamps \\n\"%(Im*1e3)\n",
    "to=(L/R)*log(1/(1-(Io/Im)))#operate lag in sec\n",
    "print \"operate lag is %0.2f msec \\n\"%(to*1000)\n",
    "tr=(L/R)*log(Im/Ir)#release lag in sec\n",
    "print \"release lag is %0.2f msec \\n\"%(tr*1000)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2.4.1,page no 126"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(a)\n",
      "periods per character is:150.00 msec\n",
      "\n",
      "period per element is:20.00 msec\n",
      "\n",
      "speed is:50.00 bauds\n",
      "\n",
      "\n",
      "(b)\n",
      "periods per character is:100.00 msec\n",
      "\n",
      "period per element is:13.33 msec\n",
      "\n",
      "speed is 75.00 bauds\n",
      "\n",
      "\n",
      "(c)\n",
      "periods per character is:100.00 msec\n",
      "\n",
      "period per element is:10.00 msec\n",
      "\n",
      "speed is 100.00 bauds\n",
      "\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "#given\n",
    "#a\n",
    "C_S1=20/3#speed in characters per second\n",
    "P_C1=1/C_S1#periods per character\n",
    "print \"(a)\\nperiods per character is:%0.2f msec\\n\"%(P_C1*1e3)\n",
    "E_C1=7.5#elements per character\n",
    "P_E1=P_C1/E_C1#period per element\n",
    "print \"period per element is:%0.2f msec\\n\"%(P_E1*1e3)\n",
    "Sb1=1/P_E1#speed in bauds\n",
    "print \"speed is:%0.2f bauds\\n\\n\"%(Sb1)\n",
    "#b\n",
    "C_S2=10#speed in characters per second\n",
    "P_C2=1/C_S2#periods per character\n",
    "print \"(b)\\nperiods per character is:%0.2f msec\\n\"%(P_C2*1e3)\n",
    "E_C2=7.5#elements per character\n",
    "P_E2=P_C2/E_C2#period per element\n",
    "print \"period per element is:%0.2f msec\\n\"%(P_E2*1e3)\n",
    "Sb2=1/P_E2#speed in bauds\n",
    "print \"speed is %0.2f bauds\\n\\n\"%( Sb2)\n",
    "#c\n",
    "C_S3=10#speed in characters per second\n",
    "P_C3=1/C_S3#periods per character\n",
    "print \"(c)\\nperiods per character is:%0.2f msec\\n\"%(P_C3*1e3)\n",
    "E_C3=10#elements per character\n",
    "P_E3=P_C3/E_C3#period per element\n",
    "print \"period per element is:%0.2f msec\\n\"%(P_E3*1e3)\n",
    "Sb3=1/P_E3#speed in bauds\n",
    "print \"speed is %0.2f bauds\\n\"%(Sb3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2.5,page no 127"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "total inductance is 0.05 H \n",
      "\n",
      "maximum current is 10.00 mA \n",
      "\n",
      "operating current is 5.00 mA \n",
      "\n",
      "operate lag is 0.35 msec \n",
      "\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "#given\n",
    "N=1000#no of turns\n",
    "L1=5e-8#inductance per turn\n",
    "L=N**2*L1#total inductance\n",
    "print \"total inductance is %0.2f H \\n\"%(L)\n",
    "R=100#resistance of winding in ohm\n",
    "MMF=5#operating MMF in amp. turn\n",
    "V=1#voltage of received signal in volts\n",
    "Im=V/R#maximum current\n",
    "print \"maximum current is %0.2f mA \\n\"%(Im*1e3)\n",
    "Io=MMF/N#operating current\n",
    "print \"operating current is %0.2f mA \\n\"%(Io*1e3)\n",
    "to=(L/R)*log(1/(1-(Io/Im)))#operate lag\n",
    "print \"operate lag is %0.2f msec \\n\"%(to*1e3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2.6,page no 128"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Busy hour calling rate is:1.60 \n",
      "\n",
      "Rate of traffic flow is 693.33 traffic unit \n"
     ]
    }
   ],
   "source": [
    "#given\n",
    "S=10000#no of subscribers\n",
    "C=16000#Tatol no of call in busy hour\n",
    "CR=C/S#busy hour calling rate\n",
    "print \"Busy hour calling rate is:%0.2f \\n\"%(CR)\n",
    "T=2.6#avarage duration of calls in min\n",
    "\n",
    "A=C*(T/60)#rate of traffic flow\n",
    "print \"Rate of traffic flow is %0.2f traffic unit \"%(A)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2.7,page no 135"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "duration of each element is:10.00 msec\n",
      "\n",
      "speed is 100.00 bauds\n",
      "\n",
      "total possible combinations are:128.00\n"
     ]
    }
   ],
   "source": [
    "#given\n",
    "N=7#no of character elements\n",
    "E_C=10#elements per character (1+7+1+1)\n",
    "To=100e-3#duration of one character\n",
    "Te=To/E_C#duration of each element\n",
    "print \"duration of each element is:%0.2f msec\\n\"%(Te*1e3)\n",
    "Sb=1/Te#speed in bauds\n",
    "print \"speed is %0.2f bauds\\n\"%(Sb)\n",
    "C=2**N#total possible combinations\n",
    "print \"total possible combinations are:%0.2f\"%(C)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2.8,page no 129"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Total no of call in busy hour is:1500.00 calls per Hour\n",
      "\n",
      "Busy hour calling rate is:1.50 \n",
      "\n",
      "grade of service is: 0.02\n"
     ]
    }
   ],
   "source": [
    "#given\n",
    "S=1000#no of subscribers\n",
    "T=2.4/60#avarage duration of calls in hours\n",
    "A=60#rate of traffic flow\n",
    "C=A/T#Tatol no of call in busy hour\n",
    "print \"Total no of call in busy hour is:%0.2f calls per Hour\\n\"%(C)\n",
    "CR=C/S#busy hour calling rate\n",
    "print \"Busy hour calling rate is:%0.2f \\n\"%(CR)\n",
    "SCL=30#no of call lost per hour\n",
    "\n",
    "B=SCL/(C+SCL)#grade of service\n",
    "print \"grade of service is: %0.2f\"%(B)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2.9,page no 129"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "grade of service is: 2.00e-03\n",
      "\n",
      "traffic lost is: 1.80e-03\n"
     ]
    }
   ],
   "source": [
    "from math import factorial\n",
    "#given\n",
    "N=5#no of switches\n",
    "A=0.9#traffic offered \n",
    "#grade of service B=(A**N/N!)/(1+A+A**2/2!+A**3/3!+...+A**N/N!)\n",
    "#here\n",
    "B=(A**N/factorial(N))/(1+A+(A**2/factorial(2))+(A**3/factorial(3))+(A**4/factorial(4))+(A**5/factorial(5)))\n",
    "print \"grade of service is: %0.2e\\n\"%(B)\n",
    "Tl=A*B#traffic lost\n",
    "print \"traffic lost is: %0.2e\"%(Tl)"
   ]
  }
 ],
 "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.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}