| 1 |
{ |
| 2 |
"cells": [ |
| 3 |
{ |
| 4 |
"cell_type": "markdown", |
| 5 |
"metadata": {}, |
| 6 |
"source": [ |
| 7 |
"# Properties of Rectangular Waveguide" |
| 8 |
] |
| 9 |
}, |
| 10 |
{ |
| 11 |
"cell_type": "markdown", |
| 12 |
"metadata": {}, |
| 13 |
"source": [ |
| 14 |
"## Introduction" |
| 15 |
] |
| 16 |
}, |
| 17 |
{ |
| 18 |
"cell_type": "markdown", |
| 19 |
"metadata": {}, |
| 20 |
"source": [ |
| 21 |
"This example demonstrates how to use [scikit-rf](http://www.scikit-rf.org) to calculate some properties of rectangular waveguide. For more information regarding the theoretical basis for these calculations, see the [References](#References)." |
| 22 |
] |
| 23 |
}, |
| 24 |
{ |
| 25 |
"cell_type": "markdown", |
| 26 |
"metadata": {}, |
| 27 |
"source": [ |
| 28 |
"## Object Creation" |
| 29 |
] |
| 30 |
}, |
| 31 |
{ |
| 32 |
"cell_type": "markdown", |
| 33 |
"metadata": {}, |
| 34 |
"source": [ |
| 35 |
"This first section imports necessary modules and creates several `RectangularWaveguide` objects for some standard waveguide bands. " |
| 36 |
] |
| 37 |
}, |
| 38 |
{ |
| 39 |
"cell_type": "code", |
| 40 |
"execution_count": null, |
| 41 |
"metadata": {}, |
| 42 |
"outputs": [], |
| 43 |
"source": [ |
| 44 |
"%matplotlib inline\n", |
| 45 |
"# imports\n", |
| 46 |
"import matplotlib.pyplot as plt\n", |
| 47 |
"import numpy as np\n", |
| 48 |
"from scipy.constants import c, mil\n", |
| 49 |
"\n", |
| 50 |
"import skrf as rf\n", |
| 51 |
"from skrf.frequency import Frequency\n", |
| 52 |
"from skrf.media import Freespace, RectangularWaveguide\n", |
| 53 |
"\n", |
| 54 |
"rf.stylely()\n", |
| 55 |
"# plot formatting\n", |
| 56 |
"plt.rcParams['lines.linewidth'] = 2" |
| 57 |
] |
| 58 |
}, |
| 59 |
{ |
| 60 |
"cell_type": "code", |
| 61 |
"execution_count": null, |
| 62 |
"metadata": {}, |
| 63 |
"outputs": [], |
| 64 |
"source": [ |
| 65 |
"# create frequency objects for standard bands\n", |
| 66 |
"f_wr5p1 = Frequency(140,220,1001, 'GHz')\n", |
| 67 |
"f_wr3p4 = Frequency(220,330,1001, 'GHz')\n", |
| 68 |
"f_wr2p2 = Frequency(330,500,1001, 'GHz')\n", |
| 69 |
"f_wr1p5 = Frequency(500,750,1001, 'GHz')\n", |
| 70 |
"f_wr1 = Frequency(750,1100,1001, 'GHz')\n", |
| 71 |
"\n", |
| 72 |
"# create rectangular waveguide objects\n", |
| 73 |
"wr5p1 = RectangularWaveguide(f_wr5p1.copy(), a=51*mil, b=25.5*mil, rho = 'au')\n", |
| 74 |
"wr3p4 = RectangularWaveguide(f_wr3p4.copy(), a=34*mil, b=17*mil, rho = 'au')\n", |
| 75 |
"wr2p2 = RectangularWaveguide(f_wr2p2.copy(), a=22*mil, b=11*mil, rho = 'au')\n", |
| 76 |
"wr1p5 = RectangularWaveguide(f_wr1p5.copy(), a=15*mil, b=7.5*mil, rho = 'au')\n", |
| 77 |
"wr1 = RectangularWaveguide(f_wr1.copy(), a=10*mil, b=5*mil, rho = 'au')\n", |
| 78 |
"\n", |
| 79 |
"# add names to waveguide objects for use in plot legends\n", |
| 80 |
"wr5p1.name = 'WR-5.1'\n", |
| 81 |
"wr3p4.name = 'WR-3.4'\n", |
| 82 |
"wr2p2.name = 'WR-2.2'\n", |
| 83 |
"wr1p5.name = 'WR-1.5'\n", |
| 84 |
"wr1.name = 'WR-1.0'\n", |
| 85 |
"\n", |
| 86 |
"# create a list to iterate through\n", |
| 87 |
"wg_list = [wr5p1, wr3p4,wr2p2,wr1p5,wr1]\n", |
| 88 |
"\n", |
| 89 |
"# creat a freespace object too\n", |
| 90 |
"freespace = Freespace(Frequency(125,1100, 1001, 'GHz'))\n", |
| 91 |
"freespace.name = 'Free Space'" |
| 92 |
] |
| 93 |
}, |
| 94 |
{ |
| 95 |
"cell_type": "markdown", |
| 96 |
"metadata": {}, |
| 97 |
"source": [ |
| 98 |
"## Conductor Loss" |
| 99 |
] |
| 100 |
}, |
| 101 |
{ |
| 102 |
"cell_type": "code", |
| 103 |
"execution_count": null, |
| 104 |
"metadata": {}, |
| 105 |
"outputs": [], |
| 106 |
"source": [ |
| 107 |
"fig, ax = plt.subplots()\n", |
| 108 |
"\n", |
| 109 |
"for wg in wg_list:\n", |
| 110 |
" wg.frequency.plot(rf.np_2_db(wg.alpha), label=wg.name)\n", |
| 111 |
"\n", |
| 112 |
"ax.legend()\n", |
| 113 |
"ax.set_xlabel('Frequency(GHz)')\n", |
| 114 |
"ax.set_ylabel('Loss (dB/m)')\n", |
| 115 |
"ax.set_title('Loss in Rectangular Waveguide (Au)');" |
| 116 |
] |
| 117 |
}, |
| 118 |
{ |
| 119 |
"cell_type": "code", |
| 120 |
"execution_count": null, |
| 121 |
"metadata": {}, |
| 122 |
"outputs": [], |
| 123 |
"source": [ |
| 124 |
"fig, ax = plt.subplots()\n", |
| 125 |
"resistivity_list = np.linspace(1,10,5)*1e-8 # ohm meter\n", |
| 126 |
"for rho in resistivity_list:\n", |
| 127 |
" wg = RectangularWaveguide(f_wr1.copy(), a=10*mil, b=5*mil,\n", |
| 128 |
" rho = rho)\n", |
| 129 |
" wg.frequency.plot(rf.np_2_db(wg.alpha),label=rf'$ \\rho $={rho:e}$ \\Omega m$')\n", |
| 130 |
"\n", |
| 131 |
"ax.legend()\n", |
| 132 |
"ax.set_xlabel('Frequency(GHz)')\n", |
| 133 |
"ax.set_ylabel('Loss (dB/m)')\n", |
| 134 |
"ax.set_title('Loss vs. Resistivity in\\nWR-1.0 Rectangular Waveguide');" |
| 135 |
] |
| 136 |
}, |
| 137 |
{ |
| 138 |
"cell_type": "markdown", |
| 139 |
"metadata": {}, |
| 140 |
"source": [ |
| 141 |
"## Phase and Group Velocity" |
| 142 |
] |
| 143 |
}, |
| 144 |
{ |
| 145 |
"cell_type": "code", |
| 146 |
"execution_count": null, |
| 147 |
"metadata": {}, |
| 148 |
"outputs": [], |
| 149 |
"source": [ |
| 150 |
"fig, ax = plt.subplots()\n", |
| 151 |
"for wg in wg_list:\n", |
| 152 |
" wg.frequency.plot(100*wg.v_p.real/c, label=wg.name )\n", |
| 153 |
"\n", |
| 154 |
"ax.legend()\n", |
| 155 |
"ax.set_ylim(50,200)\n", |
| 156 |
"ax.set_xlabel('Frequency(GHz)')\n", |
| 157 |
"ax.set_ylabel(r'Phase Velocity (\\%c)')\n", |
| 158 |
"ax.set_title('Phase Velocity in Rectangular Waveguide');" |
| 159 |
] |
| 160 |
}, |
| 161 |
{ |
| 162 |
"cell_type": "code", |
| 163 |
"execution_count": null, |
| 164 |
"metadata": {}, |
| 165 |
"outputs": [], |
| 166 |
"source": [ |
| 167 |
"fig, ax = plt.subplots()\n", |
| 168 |
"for wg in wg_list:\n", |
| 169 |
" plt.plot(wg.frequency.f_scaled[1:],\n", |
| 170 |
" 100/c*np.diff(wg.frequency.w)/np.diff(wg.beta),\n", |
| 171 |
" label=wg.name )\n", |
| 172 |
"\n", |
| 173 |
"ax.legend()\n", |
| 174 |
"ax.set_ylim(50,100)\n", |
| 175 |
"ax.set_xlabel('Frequency(GHz)')\n", |
| 176 |
"ax.set_ylabel(r'Group Velocity (\\%c)')\n", |
| 177 |
"ax.set_title('Group Velocity in Rectangular Waveguide');" |
| 178 |
] |
| 179 |
}, |
| 180 |
{ |
| 181 |
"cell_type": "markdown", |
| 182 |
"metadata": {}, |
| 183 |
"source": [ |
| 184 |
"## Propagation Constant" |
| 185 |
] |
| 186 |
}, |
| 187 |
{ |
| 188 |
"cell_type": "code", |
| 189 |
"execution_count": null, |
| 190 |
"metadata": {}, |
| 191 |
"outputs": [], |
| 192 |
"source": [ |
| 193 |
"fig, ax = plt.subplots()\n", |
| 194 |
"for wg in wg_list+[freespace]:\n", |
| 195 |
" wg.frequency.plot(wg.beta, label=wg.name)\n", |
| 196 |
"\n", |
| 197 |
"ax.legend()\n", |
| 198 |
"ax.set_xlabel('Frequency(GHz)')\n", |
| 199 |
"ax.set_ylabel('Propagation Constant (rad/m)')\n", |
| 200 |
"ax.set_title('Propagation Constant \\nin Rectangular Waveguide')\n", |
| 201 |
"ax.semilogy()" |
| 202 |
] |
| 203 |
}, |
| 204 |
{ |
| 205 |
"cell_type": "markdown", |
| 206 |
"metadata": {}, |
| 207 |
"source": [ |
| 208 |
"## References" |
| 209 |
] |
| 210 |
}, |
| 211 |
{ |
| 212 |
"cell_type": "markdown", |
| 213 |
"metadata": {}, |
| 214 |
"source": [ |
| 215 |
"\n", |
| 216 |
"* [1] https://www.microwaves101.com/encyclopedias/waveguide-mathematics\n", |
| 217 |
"* [2] http://en.wikipedia.org/wiki/Waveguide_(electromagnetism)\n", |
| 218 |
"* [3] R. F. Harrington, Time-Harmonic Electromagnetic Fields (IEEE Press Series on Electromagnetic Wave Theory). Wiley-IEEE Press, 2001.\n", |
| 219 |
"* [4] http://www.ece.rutgers.edu/~orfanidi/ewa (see Chapter 9)\n" |
| 220 |
] |
| 221 |
} |
| 222 |
], |
| 223 |
"metadata": { |
| 224 |
"anaconda-cloud": {}, |
| 225 |
"kernelspec": { |
| 226 |
"display_name": "Python 3 (ipykernel)", |
| 227 |
"language": "python", |
| 228 |
"name": "python3" |
| 229 |
}, |
| 230 |
"language_info": { |
| 231 |
"codemirror_mode": { |
| 232 |
"name": "ipython", |
| 233 |
"version": 3 |
| 234 |
}, |
| 235 |
"file_extension": ".py", |
| 236 |
"mimetype": "text/x-python", |
| 237 |
"name": "python", |
| 238 |
"nbconvert_exporter": "python", |
| 239 |
"pygments_lexer": "ipython3", |
| 240 |
"version": "3.8.10" |
| 241 |
}, |
| 242 |
"toc": { |
| 243 |
"nav_menu": {}, |
| 244 |
"number_sections": true, |
| 245 |
"sideBar": true, |
| 246 |
"skip_h1_title": false, |
| 247 |
"toc_cell": false, |
| 248 |
"toc_position": {}, |
| 249 |
"toc_section_display": "block", |
| 250 |
"toc_window_display": false |
| 251 |
} |
| 252 |
}, |
| 253 |
"nbformat": 4, |
| 254 |
"nbformat_minor": 1 |
| 255 |
} |