summaryrefslogtreecommitdiff
path: root/sample_notebooks/VarunSakpal/chapter_2.ipynb
blob: 0a847bfbaa0e452c6d907559800866348b589305 (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
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
{
 "metadata": {
  "name": "chapter 2.ipynb"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 2: Fundamental Parameters of Antennas"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.1, Page 37"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from scipy.integrate import quad,dblquad\n",
      "\n",
      "#formula for beam solid angle theta_a=double_integration of d_omega\n",
      "theta_a=quad(lambda x:1,0,2*pi)[0]*quad(lambda x:sin(x),0,pi/6)[0]\n",
      "print 'Exact Beam Solid Angle:',theta_a,'steradians'\n",
      "\n",
      "#formula for approx angle=delta1*delta2\n",
      "delta1=pi/3\n",
      "delta2=pi/3\n",
      "theta_a1=delta1*delta2\n",
      "theta_a1=delta1**2\n",
      "print 'Approximate Beam Solid Angle:',theta_a1,'steradians'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Exact Beam Solid Angle: 0.841787214477 steradians\n",
        "Approximate Beam Solid Angle: 1.09662271123 steradians\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.7, Page 52"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import scipy\n",
      "\n",
      "#The half power point of the pattern occurs at 60 degrees. Therefore theta_1r=2*pi/3\n",
      "theta_1r=(2*pi)/3\n",
      "theta_2r=(2*pi)/3\n",
      "\n",
      "#Given U=B0*cos(theta)\n",
      "exact_theta_a=dblquad(lambda x,y:cos(x)*sin(x), 0, (2*pi), lambda x:0, lambda x:(pi/2))\n",
      "print 'Exact Beam Solid Angle:',exact_theta_a[0],'steradians'\n",
      "\n",
      "#Formula for approx theta = theta_1r*theta_2r\n",
      "approx_theta_a=theta_1r*theta_2r\n",
      "print 'Approximate Beam Solid Angle:',approx_theta_a,'steradians'\n",
      "\n",
      "#formula for exact directivity=4*pi/exact_beam_angle\n",
      "exact_direct=((4*pi)/(exact_theta_a[0]))\n",
      "\n",
      "#formula for approx directivity=4*pi/approx_beam_angle\n",
      "approx_direct=((4*pi)/(approx_theta_a))\n",
      "\n",
      "#exact directivity in dB\n",
      "exact_direct_db=10*log10(exact_direct)\n",
      "\n",
      "#approx directivity in dB\n",
      "approx_direct_db=10*log10(approx_direct)\n",
      "\n",
      "print 'Exact directivity:',exact_direct_db,'dB'\n",
      "print 'Approx. directivity:',approx_direct_db,'dB'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Exact Beam Solid Angle: 3.14159265359 steradians\n",
        "Approximate Beam Solid Angle: 4.38649084493 steradians\n",
        "Exact directivity: 6.02059991328 dB\n",
        "Approx. directivity: 4.57092636745 dB\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.8, Page 58"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import scipy\n",
      "\n",
      "#Maximum intensity\n",
      "u_max=1\n",
      "\n",
      "#Calculation of radiated power\n",
      "p_rad=dblquad(lambda x,y:(sin(x)**2)*sin(x),0,2*pi,lambda x:0,lambda x:pi)\n",
      "print 'Radiated Power:',p_rad[0],'W'\n",
      "\n",
      "#Calulation of maximum directivity\n",
      "D0=(4*pi)/(p_rad[0])\n",
      "\n",
      "#Directivity in dB\n",
      "D0_db=10*log10(D0)\n",
      "print 'Directivity:',D0_db,'dB'\n",
      "\n",
      "deg=90\n",
      "\n",
      "#Calculation od directivity\n",
      "D0_1=101/(deg-0.0027*deg**2)\n",
      "D0_1_db=10*log10(D0_1)\n",
      "print 'Directivity:',D0_1_db,'dB'\n",
      "\n",
      "#Calculation of directivity\n",
      "D0_2=(-172.4)+(191*sqrt((0.818+(1/deg))))\n",
      "D0_2_db=10*log10(D0_2)\n",
      "print 'Directivity:',D0_2,'dB'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Radiated Power: 8.37758040957 W\n",
        "Directivity: 1.76091259056 dB\n",
        "Directivity: 1.70982984843 dB\n",
        "Directivity: 0.346803154212 dB\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.9(a), Page 61"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import scipy\n",
      "\n",
      "B0=1\n",
      "#Maximum intensity\n",
      "u_max=1\n",
      "\n",
      "#Array containing angles in radians\n",
      "a=sin(array([10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180])*pi/180)**2\n",
      "\n",
      "#Calculation of radiated power\n",
      "p_rad1=B0*((pi/18)**2)*sum(a)*sum(a)\n",
      "print 'Power Radiated:',p_rad1,'W'\n",
      "\n",
      "#Calculation of directivity\n",
      "D0=(4*pi)/(p_rad1)\n",
      "\n",
      "print 'Directivity using numerical techniques:',D0\n",
      "\n",
      "#Calu=culation of radiated power\n",
      "a=quad(lambda x:sin(x)**2,0,pi)\n",
      "b=quad(lambda x:sin(x)**2,0,pi)\n",
      "p_rad2=a[0]*b[0]\n",
      "\n",
      "#Directivity\n",
      "D01=(4*pi)/(p_rad2)\n",
      "\n",
      "print 'Directivity:',D01"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Power Radiated: 2.46740110027 W\n",
        "Directivity using numerical techniques: 5.09295817894\n",
        "Directivity: 5.09295817894\n"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.9(b), Page 63"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import scipy\n",
      "\n",
      "\n",
      "B0=1\n",
      "\n",
      "#Maximum intensity\n",
      "u_max=1\n",
      "\n",
      "#Arrays containing angles in radians\n",
      "a=sin(array([5,15,25,35,45,55,65,75,85])*pi/180)**2\n",
      "b=sin(array([5,15,25,35,45,55,65,75,85])*pi/180)**2\n",
      "\n",
      "#Calculation of radiated power\n",
      "p_rad=B0*((pi/18)**2)*(2*sum(a))*(2*sum(b))\n",
      "\n",
      "#Calculation of directivity\n",
      "D0=(4*pi*u_max)/(p_rad)\n",
      "\n",
      "print 'Directivity using 18 divisions:',D0"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Directivity using 18 divisions: 5.09295817894\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.10, Page 68"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import scipy\n",
      "\n",
      "#maximum intensuty\n",
      "u_max=1\n",
      "B0=1\n",
      "\n",
      "#Input impedance in Ohms\n",
      "inp_imp=73\n",
      "#Characteristic impedance in Ohms\n",
      "char_imp=50\n",
      "\n",
      "#Calculation of radiated power\n",
      "p_rad=B0*quad(lambda x:1,0,2*pi)[0]*quad(lambda x:sin(x)**4,0,pi)[0]\n",
      "\n",
      "#Calulation of directivity\n",
      "D0=(4*pi*u_max)/(p_rad)\n",
      "\n",
      "#conduction & dielectric efficiency ecd=1 since antenna is loseless\n",
      "ecd=1\n",
      "\n",
      "#Maximum Gain\n",
      "G0=ecd*D0\n",
      "G0_db=10*log10(G0)\n",
      "\n",
      "#Reflection Coefficient Tau\n",
      "tau=float(inp_imp-char_imp)/float(inp_imp+char_imp)\n",
      "\n",
      "#Reflection efficiency=1-tau**2\n",
      "er=1-tau**2\n",
      "er_db=10*log10(er)\n",
      "\n",
      "#Total efficiency\n",
      "e0=er*ecd\n",
      "e0_db=10*log10(e0)\n",
      "\n",
      "#Absolute Gain\n",
      "G0_abs=e0*D0\n",
      "G0abs_db=10*log10(G0_abs)\n",
      "\n",
      "print 'Maximum Gain:',G0_db\n",
      "\n",
      "print 'Reflection efficiency:',er_db\n",
      "\n",
      "print 'Total efficiency:',e0_db\n",
      "\n",
      "print 'Absolute Gain:',G0abs_db"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum Gain: 2.29848855242\n",
        "Reflection efficiency: -0.154573670944\n",
        "Total efficiency: -0.154573670944\n",
        "Absolute Gain: 2.14391488148\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.11, Page 77"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import scipy\n",
      "\n",
      "#unit vector of the wave\n",
      "rho_w=array([1,0])\n",
      "\n",
      "#unit vector of the electric field\n",
      "rho_a=array([1/sqrt(2),1/sqrt(2)])\n",
      "\n",
      "#Polarization factor\n",
      "PLF=abs(dot(rho_w,rho_a))**2\n",
      "print 'Polarization Factor:',PLF"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "0.5\n"
       ]
      }
     ],
     "prompt_number": 56
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.12, Page 78"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import scipy\n",
      "\n",
      "#unit vector of the wave\n",
      "rho_w=array([1/sqrt(2),1/sqrt(2)])\n",
      "\n",
      "#unit vector of the electric field\n",
      "rho_a=array([1/sqrt(2),-1/sqrt(2)])\n",
      "\n",
      "#Polarization Factor\n",
      "PLF=abs(dot(rho_w,rho_a))**2\n",
      "\n",
      "print 'Polarization Factor:',PLF"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "0.0\n"
       ]
      }
     ],
     "prompt_number": 57
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.13, Page 86"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import scipy\n",
      "\n",
      "#Radiation Resistance\n",
      "rad_res=73\n",
      "\n",
      "#Frequency of antenna\n",
      "f=10**8\n",
      "\n",
      "#Velocity\n",
      "v=3*10**8\n",
      "\n",
      "#Wavelength\n",
      "lamda=v/f\n",
      "\n",
      "#Length of antenna\n",
      "l=lamda/2\n",
      "\n",
      "#Perimeter of the antenna\n",
      "b=(3*10**-4)*lamda\n",
      "C=2*pi*b\n",
      "\n",
      "#value of omega\n",
      "w=2*pi*f\n",
      "\n",
      "#Constant\n",
      "mu0=4*pi*10**-7\n",
      "\n",
      "#Conductivity\n",
      "sigma=5.7*10**7\n",
      "\n",
      "#High frequency resistance\n",
      "Rhf=(l/C)*(sqrt((w*mu0)/(2*sigma)))\n",
      "\n",
      "#Load resistance\n",
      "Rl=Rhf/2\n",
      "\n",
      "#calculation of conduction & dielectric efficiency\n",
      "ecd=(rad_res)/(rad_res+Rl)\n",
      "ecd_db=10*log10(ecd)\n",
      "\n",
      "print 'Conduction-dielectric efficiency:',ecd_db"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Conduction-dielectric efficiency: -0.0138216614754\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.16, Page 98 "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import scipy\n",
      "\n",
      "lamda=1\n",
      "\n",
      "#Maximum directivity of transmitter\n",
      "D0_t_db=16\n",
      "D0_t=10**(float(D0_t_db)/10)\n",
      "\n",
      "#Maximum directivity of receiver\n",
      "D0_r_db=20\n",
      "D0_r=10**(D0_r_db/10)\n",
      "\n",
      "#Reflection coeficients of transmitter and receiver\n",
      "tau_r=0.1\n",
      "tau_t=0.2\n",
      "\n",
      "#Power at transmitter\n",
      "P_t=2\n",
      "\n",
      "#Calculation of Power to the receiver\n",
      "P_r=(1-tau_r**2)*(1-tau_t**2)*((lamda/(4*pi*100*lamda))**2)*D0_t*D0_r*P_t\n",
      "print 'Power delivered to the load of receiver:',P_r,'W'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Power delivered to the load of receiver: 0.00479199874075 W\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.18, Page 108"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import scipy\n",
      "\n",
      "#antenna temp at receiver terminals\n",
      "Ta=150\n",
      "\n",
      "#physical temp of transmission line\n",
      "T0=300\n",
      "\n",
      "#thermal efficiency of the antennna\n",
      "eA=0.99\n",
      "\n",
      "#antenna physical temperature\n",
      "Tp=300\n",
      "l=1\n",
      "\n",
      "#antenna temp at antenna terminals due to physical temperature\n",
      "T_ap=Tp*(1/eA-1)\n",
      "\n",
      "#Loss of waveguide in dB/m\n",
      "alpha_db=0.13\n",
      "\n",
      "#Loss of waveguide in Np/m\n",
      "alpha_np=alpha_db/0.868\n",
      "\n",
      "#Calulation of effective temperature\n",
      "T_A=Ta*exp(-l*alpha_np*2)+T_ap*exp(-l*alpha_np*2)+T0*(1-exp(-l*alpha_np*2))\n",
      "print 'Effective temperature:',T_A,'K'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Effective temperature: 191.071984919 K\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}