Debian Codegraph @

doc/source/examples/taper/tapered_transmission_lines.ipynb

raw
1 {
2 "cells": [
3 {
4 "cell_type": "markdown",
5 "id": "2c6154d4",
6 "metadata": {},
7 "source": [
8 "# Tapered Transmission Lines\n",
9 "\n",
10 "A tapered line (or simply a taper), is an impedance transformer that matches an impedance $Z_1$ to an impedance $Z_2$ using a gradually varying characteristic impedance $Z(z)$ along the line. \n",
11 "\n",
12 "There is an infinite number of ways one can define a profile $Z(z)$ along the transmission line. scikit-rf implements a generic 1D Taper [Taper1D](../../api/taper.rst), from which the following direct classes are derived: `Linear`, `Exponential` and `SmoothStep`."
13 ]
14 },
15 {
16 "cell_type": "code",
17 "execution_count": null,
18 "id": "f5e81006",
19 "metadata": {},
20 "outputs": [],
21 "source": [
22 "import matplotlib.pyplot as plt\n",
23 "import numpy as np\n",
24 "\n",
25 "import skrf as rf\n",
26 "from skrf.media import MLine\n",
27 "\n",
28 "rf.stylely()"
29 ]
30 },
31 {
32 "cell_type": "markdown",
33 "id": "aa11b39f",
34 "metadata": {},
35 "source": [
36 "## Geometry"
37 ]
38 },
39 {
40 "cell_type": "markdown",
41 "id": "3d4f05ad",
42 "metadata": {},
43 "source": [
44 "In this example, we compare a microstrip line which width $W$ is tapered and loaded with a 15 Ohm resistor:\n",
45 "\n",
46 "<img src=\"ANSYS_Circuit_reference.png\" width=\"1000\">\n",
47 "\n",
48 "Before comparing the taper profiles, let's define the other elements of the circuit, that is the piece of transmission lines and resistor:"
49 ]
50 },
51 {
52 "cell_type": "code",
53 "execution_count": null,
54 "id": "bc40cf5c",
55 "metadata": {},
56 "outputs": [],
57 "source": [
58 "# Model Parameters\n",
59 "freq = rf.Frequency(1, 20, unit='GHz', npoints=191)\n",
60 "w1 = 20*rf.mil # conductor width [m]\n",
61 "w2 = 90*rf.mil # conductor width [m]\n",
62 "h = 20*rf.mil # dielectric thickness [m]\n",
63 "t = 0.7*rf.mil # conductor thickness [m]\n",
64 "rho = 1.724138e-8 # Copper resistivity [Ohm.m]\n",
65 "ep_r = 10 # dielectric relative permittivity\n",
66 "rough = 1e-6 # conductor RMS roughtness [m]\n",
67 "taper_length = 200*rf.mil # [m]\n",
68 "\n",
69 "# Media definitions\n",
70 "microstrip_w1 = MLine(freq, w=w1, h=h, t=t, rho=rho, ep_r=ep_r, rough=rough,\n",
71 " disp='kobayashi', z0_port=50)\n",
72 "microstrip_w2 = MLine(freq, w=w2, h=h, t=t, rho=rho, ep_r=ep_r, rough=rough,\n",
73 " disp='kobayashi', z0_port=50)\n",
74 "\n",
75 "# piece of transmission lines connected to the taper\n",
76 "line1 = microstrip_w1.line(d=50, unit='mil', name='feeder')\n",
77 "line2 = microstrip_w2.line(d=50, unit='mil', name='feeder')\n",
78 "\n",
79 "# loading resistor\n",
80 "resistor = microstrip_w2.resistor(R=15)"
81 ]
82 },
83 {
84 "cell_type": "markdown",
85 "id": "05faf152",
86 "metadata": {},
87 "source": [
88 "The idea is hence to forge a transmission line of variable characteristic impedance. In this example, the width of the metallization $W$ is varied along the transmission line length. Most common profile are summarized in the figure below:"
89 ]
90 },
91 {
92 "cell_type": "code",
93 "execution_count": null,
94 "id": "8e682143",
95 "metadata": {},
96 "outputs": [],
97 "source": [
98 "fig, ax = plt.subplots()\n",
99 "z = np.linspace(0, taper_length)\n",
100 "ax.plot(z, (w2-w1)/taper_length*z + w1, lw=2, label='linear')\n",
101 "ax.plot(z, w1*np.exp(z/taper_length*(np.log(w2/w1))), lw=2, label='exponential')\n",
102 "ax.set_xticks([0, taper_length])\n",
103 "ax.set_xticklabels(['0', 'taper length'])\n",
104 "ax.set_yticks([w1, w2])\n",
105 "ax.set_yticklabels(['$W_1$', '$W_2$'])\n",
106 "ax.legend()\n",
107 "ax.set_title('Parameter profile along the taper length')"
108 ]
109 },
110 {
111 "cell_type": "markdown",
112 "id": "d5ba96ad",
113 "metadata": {},
114 "source": [
115 "### Linear Taper"
116 ]
117 },
118 {
119 "cell_type": "code",
120 "execution_count": null,
121 "id": "e0b721de",
122 "metadata": {},
123 "outputs": [],
124 "source": [
125 "# create a 2-port Network\n",
126 "taper_linear = rf.taper.Linear(med=MLine, param='w', start=w1, stop=w2,\n",
127 " length=taper_length, n_sections=50,\n",
128 " med_kw={'frequency': freq, 'h': h, 't':t, 'ep_r': ep_r,\n",
129 " 'rough': rough, 'rho': rho}).network\n",
130 "print(taper_linear)\n",
131 "\n",
132 "# build the full circuit\n",
133 "# equivalent to ntwk = line1 ** taper_linear ** resistor ** line2 ** microstrip_w2.short()\n",
134 "ntwk_linear = rf.cascade_list([line1, taper_linear, line2, resistor, microstrip_w2.short()])"
135 ]
136 },
137 {
138 "cell_type": "code",
139 "execution_count": null,
140 "id": "c2a58407",
141 "metadata": {},
142 "outputs": [],
143 "source": [
144 "fig, ax = plt.subplots()\n",
145 "ax.plot(ntwk_linear.frequency.f_scaled, ntwk_linear.s_mag[:,0], lw=2, label='scikit-rf - Linear')\n",
146 "\n",
147 "f_ref, s_mag_ref = np.loadtxt('ANSYS_Circuit_taper_linear_s_mag.csv', delimiter=',', skiprows=1, unpack=True)\n",
148 "ax.plot(f_ref, s_mag_ref, label='ANSYS Circuit - Linear Taper', lw=2, ls='--')\n",
149 "\n",
150 "ax.set_xlabel('f [GHz]')\n",
151 "ax.set_ylabel('$|s_{11}|$')\n",
152 "ax.set_ylim(0, 0.6)\n",
153 "ax.set_xlim(1, 20)\n",
154 "ax.legend()"
155 ]
156 },
157 {
158 "cell_type": "markdown",
159 "id": "1e0eee9e",
160 "metadata": {},
161 "source": [
162 "### Exponential Taper"
163 ]
164 },
165 {
166 "cell_type": "code",
167 "execution_count": null,
168 "id": "d213ae64",
169 "metadata": {},
170 "outputs": [],
171 "source": [
172 "taper_exp = rf.taper.Exponential(med=MLine, param='w', start=w1, stop=w2,\n",
173 " length=taper_length, n_sections=50,\n",
174 " med_kw={'frequency': freq, 'h': h, 't':t, 'ep_r': ep_r,\n",
175 " 'rough': rough, 'rho': rho}).network\n",
176 "\n",
177 "ntwk_exp = line1 ** taper_exp ** line2 ** resistor ** microstrip_w2.short()"
178 ]
179 },
180 {
181 "cell_type": "code",
182 "execution_count": null,
183 "id": "a67c366d",
184 "metadata": {},
185 "outputs": [],
186 "source": [
187 "fig, ax = plt.subplots()\n",
188 "ax.plot(ntwk_exp.frequency.f_scaled, ntwk_exp.s_mag[:,0], lw=2, label='scikit-rf - Exponential')\n",
189 "\n",
190 "f_ref, s_mag_ref = np.loadtxt('ANSYS_Circuit_taper_exponential_s_mag.csv', delimiter=',', skiprows=1, unpack=True)\n",
191 "ax.plot(f_ref, s_mag_ref, label='ANSYS Circuit - Exponential Taper', lw=2, ls='--')\n",
192 "\n",
193 "ax.set_xlabel('f [GHz]')\n",
194 "ax.set_ylabel('$|s_{11}|$')\n",
195 "ax.set_ylim(0, 0.6)\n",
196 "ax.set_xlim(1, 20)\n",
197 "ax.legend()"
198 ]
199 },
200 {
201 "cell_type": "code",
202 "execution_count": null,
203 "id": "1a58c142",
204 "metadata": {},
205 "outputs": [],
206 "source": []
207 }
208 ],
209 "metadata": {
210 "kernelspec": {
211 "display_name": "Python 3 (ipykernel)",
212 "language": "python",
213 "name": "python3"
214 },
215 "language_info": {
216 "codemirror_mode": {
217 "name": "ipython",
218 "version": 3
219 },
220 "file_extension": ".py",
221 "mimetype": "text/x-python",
222 "name": "python",
223 "nbconvert_exporter": "python",
224 "pygments_lexer": "ipython3",
225 "version": "3.9.12"
226 }
227 },
228 "nbformat": 4,
229 "nbformat_minor": 5
230 }