| 1 |
{ |
| 2 |
"cells": [ |
| 3 |
{ |
| 4 |
"cell_type": "markdown", |
| 5 |
"metadata": {}, |
| 6 |
"source": [ |
| 7 |
"# DefinedAEpTandZ0 media example" |
| 8 |
] |
| 9 |
}, |
| 10 |
{ |
| 11 |
"cell_type": "code", |
| 12 |
"execution_count": null, |
| 13 |
"metadata": {}, |
| 14 |
"outputs": [], |
| 15 |
"source": [ |
| 16 |
"%load_ext autoreload\n", |
| 17 |
"%autoreload 2\n", |
| 18 |
"import matplotlib.pyplot as plt\n", |
| 19 |
"import numpy as np\n", |
| 20 |
"from matplotlib.ticker import AutoMinorLocator\n", |
| 21 |
"from numpy import log, sum\n", |
| 22 |
"from scipy.optimize import minimize\n", |
| 23 |
"\n", |
| 24 |
"import skrf as rf\n", |
| 25 |
"import skrf.mathFunctions as mf\n", |
| 26 |
"\n", |
| 27 |
"rf.stylely()" |
| 28 |
] |
| 29 |
}, |
| 30 |
{ |
| 31 |
"cell_type": "markdown", |
| 32 |
"metadata": {}, |
| 33 |
"source": [ |
| 34 |
"## Measurement of two CPWG lines with different lengths\n", |
| 35 |
"\n", |
| 36 |
"The measurement where performed the 21th March 2017 on a Anritsu MS46524B 20GHz Vector Network Analyser. The setup is a linear frequency sweep from 1MHz to 10GHz with 10'000 points. Output power is 0dBm, IF bandwidth is 1kHz and neither averaging nor smoothing are used.\n", |
| 37 |
"\n", |
| 38 |
"CPWGxxx is a L long, W wide, with a G wide gap to top ground, T thick copper coplanar waveguide on ground on a H height substrate with top and bottom ground plane. A closely spaced via wall is placed on both side of the line and the top and bottom ground planes are connected by many vias.\n", |
| 39 |
"\n", |
| 40 |
"| Name | L (mm) | W (mm) | G (mm) | H (mm) | T (um) | Substrate |\n", |
| 41 |
"| :--- | ---: | ---: | ---: | ---: | ---: | :--- |\n", |
| 42 |
"| MSL100 | 100 | 1.70 | 0.50 | 1.55 | 50 | FR-4 |\n", |
| 43 |
"| MSL200 | 200 | 1.70 | 0.50 | 1.55 | 50 | FR-4 |\n", |
| 44 |
"\n", |
| 45 |
"The milling of the artwork is performed mechanically with a lateral wall of 45°.\n", |
| 46 |
"\n", |
| 47 |
"The relative permittivity of the dielectric was assumed to be approximately 4.5 for design purpose.\n", |
| 48 |
"\n", |
| 49 |
"" |
| 50 |
] |
| 51 |
}, |
| 52 |
{ |
| 53 |
"cell_type": "code", |
| 54 |
"execution_count": null, |
| 55 |
"metadata": {}, |
| 56 |
"outputs": [], |
| 57 |
"source": [ |
| 58 |
"# Load raw measurements\n", |
| 59 |
"TL100 = rf.Network('CPWG100.s2p')\n", |
| 60 |
"TL200 = rf.Network('CPWG200.s2p')\n", |
| 61 |
"TL100_dc = TL100.extrapolate_to_dc(kind='linear')\n", |
| 62 |
"TL200_dc = TL200.extrapolate_to_dc(kind='linear')\n", |
| 63 |
"\n", |
| 64 |
"plt.figure()\n", |
| 65 |
"plt.suptitle('Raw measurement')\n", |
| 66 |
"TL100.plot_s_db()\n", |
| 67 |
"TL200.plot_s_db()\n", |
| 68 |
"\n", |
| 69 |
"plt.figure()\n", |
| 70 |
"t0 = -2\n", |
| 71 |
"t1 = 4\n", |
| 72 |
"plt.suptitle('Time domain reflexion step response (DC extrapolation)')\n", |
| 73 |
"ax = plt.subplot(1, 1, 1)\n", |
| 74 |
"TL100_dc.plot_z_time_step(0, 0, ax=ax, color='0.0')\n", |
| 75 |
"TL200_dc.plot_z_time_step(0, 0, ax=ax, color='0.2')\n", |
| 76 |
"ax.set_xlim(t0, t1)\n", |
| 77 |
"ax.xaxis.set_minor_locator(AutoMinorLocator(10))\n", |
| 78 |
"ax.yaxis.set_minor_locator(AutoMinorLocator(5))\n", |
| 79 |
"ax.patch.set_facecolor('1.0')\n", |
| 80 |
"ax.grid(True, color='0.8', which='minor')\n", |
| 81 |
"ax.grid(True, color='0.4', which='major')\n", |
| 82 |
"plt.show()\n" |
| 83 |
] |
| 84 |
}, |
| 85 |
{ |
| 86 |
"cell_type": "markdown", |
| 87 |
"metadata": {}, |
| 88 |
"source": [ |
| 89 |
"Impedance from the line and from the connector section may be estimated on the step response.\n", |
| 90 |
"The line section is not flat, there is some variation in the impedance which may be induced by manufacturing tolerances and dielectric inhomogeneity.\n", |
| 91 |
"\n", |
| 92 |
"Note that the delay on the reflexion plot are twice the effective section delays because the wave travel back and forth on the line.\n", |
| 93 |
"\n", |
| 94 |
"Connector discontinuity is about 50 ps long. TL100 line plateau (flat impedance part) is about 450 ps long." |
| 95 |
] |
| 96 |
}, |
| 97 |
{ |
| 98 |
"cell_type": "code", |
| 99 |
"execution_count": null, |
| 100 |
"metadata": {}, |
| 101 |
"outputs": [], |
| 102 |
"source": [ |
| 103 |
"Z_conn = 53.2 # ohm, connector impedance\n", |
| 104 |
"Z_line = 51.4 # ohm, line plateau impedance\n", |
| 105 |
"d_conn = 0.05e-9 # s, connector discontinuity delay\n", |
| 106 |
"d_line = 0.45e-9 # s, line plateau delay, without connectors" |
| 107 |
] |
| 108 |
}, |
| 109 |
{ |
| 110 |
"cell_type": "markdown", |
| 111 |
"metadata": {}, |
| 112 |
"source": [ |
| 113 |
"## Dielectric effective relative permittivity extraction by multiline method" |
| 114 |
] |
| 115 |
}, |
| 116 |
{ |
| 117 |
"cell_type": "code", |
| 118 |
"execution_count": null, |
| 119 |
"metadata": {}, |
| 120 |
"outputs": [], |
| 121 |
"source": [ |
| 122 |
"#Make the missing reflect measurement\n", |
| 123 |
"#This is possible because we already have existing calibration\n", |
| 124 |
"#and know what the open measurement would look like at the reference plane\n", |
| 125 |
"#'refl_offset' needs to be set to -half_thru - connector_length.\n", |
| 126 |
"reflect = TL100.copy()\n", |
| 127 |
"reflect.s[:,0,0] = 1\n", |
| 128 |
"reflect.s[:,1,1] = 1\n", |
| 129 |
"reflect.s[:,1,0] = 0\n", |
| 130 |
"reflect.s[:,0,1] = 0\n", |
| 131 |
"\n", |
| 132 |
"# Perform NISTMultilineTRL algorithm. Reference plane is at the center of the thru.\n", |
| 133 |
"cal = rf.NISTMultilineTRL([TL100, reflect, TL200], [1], [0, 100e-3], er_est=3.0, refl_offset=[-56e-3])\n", |
| 134 |
"\n", |
| 135 |
"plt.figure()\n", |
| 136 |
"plt.title('Corrected lines')\n", |
| 137 |
"cal.apply_cal(TL100).plot_s_db()\n", |
| 138 |
"cal.apply_cal(TL200).plot_s_db()\n", |
| 139 |
"plt.show()" |
| 140 |
] |
| 141 |
}, |
| 142 |
{ |
| 143 |
"cell_type": "markdown", |
| 144 |
"metadata": {}, |
| 145 |
"source": [ |
| 146 |
"Calibration results shows a very low residual noise floor. The error model is well fitted." |
| 147 |
] |
| 148 |
}, |
| 149 |
{ |
| 150 |
"cell_type": "code", |
| 151 |
"execution_count": null, |
| 152 |
"metadata": {}, |
| 153 |
"outputs": [], |
| 154 |
"source": [ |
| 155 |
"from skrf.media import DefinedAEpTandZ0\n", |
| 156 |
"\n", |
| 157 |
"freq = TL100.frequency\n", |
| 158 |
"f = TL100.frequency.f\n", |
| 159 |
"f_ghz = TL100.frequency.f/1e9\n", |
| 160 |
"L = 0.1\n", |
| 161 |
"A = 0.0\n", |
| 162 |
"f_A = 1e9\n", |
| 163 |
"ep_r0 = 2.0\n", |
| 164 |
"tanD0 = 0.001\n", |
| 165 |
"f_ep = 1e9\n", |
| 166 |
"x0 = [ep_r0, tanD0]\n", |
| 167 |
"\n", |
| 168 |
"ep_r_mea = cal.er_eff.real\n", |
| 169 |
"A_mea = 20/log(10)*cal.gamma.real\n", |
| 170 |
"\n", |
| 171 |
"def model(x, freq, ep_r_mea, A_mea, f_ep):\n", |
| 172 |
" ep_r, tanD = x[0], x[1]\n", |
| 173 |
" m = DefinedAEpTandZ0(frequency=freq, ep_r=ep_r, tanD=tanD, z0=50,\n", |
| 174 |
" f_low=1e3, f_high=1e18, f_ep=f_ep, model='djordjevicsvensson')\n", |
| 175 |
" ep_r_mod = m.ep_r_f.real\n", |
| 176 |
" A_mod = m.alpha * log(10)/20\n", |
| 177 |
" return sum((ep_r_mod - ep_r_mea)**2) + 0.001*sum((20/log(10)*A_mod - A_mea)**2)\n", |
| 178 |
"\n", |
| 179 |
"res = minimize(model, x0, args=(TL100.frequency, ep_r_mea, A_mea, f_ep),\n", |
| 180 |
" bounds=[(2, 4), (0.001, 0.013)])\n", |
| 181 |
"ep_r, tanD = res.x[0], res.x[1]\n", |
| 182 |
"\n", |
| 183 |
"print(f'epr={ep_r:.3f}, tand={tanD:.4f} at {f_ep * 1e-9:.1f} GHz.')\n", |
| 184 |
"\n", |
| 185 |
"m = DefinedAEpTandZ0(frequency=freq, ep_r=ep_r, tanD=tanD, z0=50,\n", |
| 186 |
" f_low=1e3, f_high=1e18, f_ep=f_ep, model='djordjevicsvensson')\n", |
| 187 |
"\n", |
| 188 |
"plt.figure()\n", |
| 189 |
"plt.suptitle('Effective relative permittivity and attenuation')\n", |
| 190 |
"plt.subplot(2,1,1)\n", |
| 191 |
"plt.ylabel(r'$\\epsilon_{r,eff}$')\n", |
| 192 |
"plt.plot(f_ghz, ep_r_mea, label='measured')\n", |
| 193 |
"plt.plot(f_ghz, m.ep_r_f.real, label='model')\n", |
| 194 |
"plt.legend()\n", |
| 195 |
"\n", |
| 196 |
"plt.subplot(2,1,2)\n", |
| 197 |
"plt.xlabel('Frequency [GHz]')\n", |
| 198 |
"plt.ylabel('A (dB/m)')\n", |
| 199 |
"plt.plot(f_ghz, A_mea, label='measured')\n", |
| 200 |
"plt.plot(f_ghz, 20/log(10)*m.alpha, label='model')\n", |
| 201 |
"plt.legend()\n", |
| 202 |
"plt.show()\n" |
| 203 |
] |
| 204 |
}, |
| 205 |
{ |
| 206 |
"cell_type": "markdown", |
| 207 |
"metadata": {}, |
| 208 |
"source": [ |
| 209 |
"Relative permittivity $\\epsilon_{e,eff}$ and attenuation $A$ shows a reasonable agreement.\n", |
| 210 |
"\n", |
| 211 |
"A better agreement could be achieved by implementing the Kirschning and Jansen microstripline dispersion model or using a linear correction." |
| 212 |
] |
| 213 |
}, |
| 214 |
{ |
| 215 |
"cell_type": "markdown", |
| 216 |
"metadata": {}, |
| 217 |
"source": [ |
| 218 |
"## Connectors effects estimation" |
| 219 |
] |
| 220 |
}, |
| 221 |
{ |
| 222 |
"cell_type": "code", |
| 223 |
"execution_count": null, |
| 224 |
"metadata": {}, |
| 225 |
"outputs": [], |
| 226 |
"source": [ |
| 227 |
"# note: a half line is embedded in connector network\n", |
| 228 |
"coefs = cal.coefs\n", |
| 229 |
"r = mf.sqrt_phase_unwrap(coefs['forward reflection tracking'])\n", |
| 230 |
"s1 = np.array([[coefs['forward directivity'],r],\n", |
| 231 |
" [r, coefs['forward source match']]]).transpose()\n", |
| 232 |
"\n", |
| 233 |
"conn = TL100.copy()\n", |
| 234 |
"conn.name = 'Connector'\n", |
| 235 |
"conn.s = s1\n", |
| 236 |
"\n", |
| 237 |
"# delay estimation,\n", |
| 238 |
"phi_conn = (np.angle(conn.s[:500,1,0]))\n", |
| 239 |
"z = np.polyfit(f[:500], phi_conn, 1)\n", |
| 240 |
"p = np.poly1d(z)\n", |
| 241 |
"delay = -z[0]/(2*np.pi)\n", |
| 242 |
"print(f'Connector + half thru delay: {delay * 1e12:.0f} ps')\n", |
| 243 |
"print(f'TDR read half thru delay: {d_line/2 * 1e12:.0f} ps')\n", |
| 244 |
"d_conn_p = delay - d_line/2\n", |
| 245 |
"print(f'Connector delay: {d_conn_p * 1e12:.0f} ps')\n", |
| 246 |
"\n", |
| 247 |
"\n", |
| 248 |
"# connector model with guessed loss\n", |
| 249 |
"half = m.line(d_line/2, 's', z0=Z_line)\n", |
| 250 |
"mc = DefinedAEpTandZ0(m.frequency, ep_r=1, tanD=0.025, z0=50,\n", |
| 251 |
" f_low=1e3, f_high=1e18, f_ep=f_ep, model='djordjevicsvensson')\n", |
| 252 |
"left = mc.line(d_conn_p, 's', z0=Z_conn)\n", |
| 253 |
"right = left.flipped()\n", |
| 254 |
"check = mc.thru() ** left ** half ** mc.thru()\n", |
| 255 |
"\n", |
| 256 |
"plt.figure()\n", |
| 257 |
"plt.suptitle('Connector + half thru comparison')\n", |
| 258 |
"plt.subplot(2,1,1)\n", |
| 259 |
"conn.plot_s_deg(1, 0, label='measured')\n", |
| 260 |
"check.plot_s_deg(1, 0, label='model')\n", |
| 261 |
"plt.ylabel('phase (rad)')\n", |
| 262 |
"plt.legend()\n", |
| 263 |
"\n", |
| 264 |
"plt.subplot(2,1,2)\n", |
| 265 |
"conn.plot_s_db(1, 0, label='Measured')\n", |
| 266 |
"check.plot_s_db(1, 0, label='Model')\n", |
| 267 |
"plt.xlabel('Frequency (GHz)')\n", |
| 268 |
"plt.ylabel('Insertion Loss (dB)')\n", |
| 269 |
"plt.legend()\n", |
| 270 |
"plt.show()" |
| 271 |
] |
| 272 |
}, |
| 273 |
{ |
| 274 |
"cell_type": "markdown", |
| 275 |
"metadata": {}, |
| 276 |
"source": [ |
| 277 |
"Connector + thru plots shows a reasonable agreement between calibration results and model." |
| 278 |
] |
| 279 |
}, |
| 280 |
{ |
| 281 |
"cell_type": "markdown", |
| 282 |
"metadata": {}, |
| 283 |
"source": [ |
| 284 |
"## Final check" |
| 285 |
] |
| 286 |
}, |
| 287 |
{ |
| 288 |
"cell_type": "code", |
| 289 |
"execution_count": null, |
| 290 |
"metadata": {}, |
| 291 |
"outputs": [], |
| 292 |
"source": [ |
| 293 |
"DUT = m.line(d_line, 's', Z_line)\n", |
| 294 |
"DUT.name = 'model'\n", |
| 295 |
"\n", |
| 296 |
"Check = m.thru() ** left ** DUT ** right ** m.thru()\n", |
| 297 |
"Check.name = 'model with connectors'\n", |
| 298 |
"\n", |
| 299 |
"plt.figure()\n", |
| 300 |
"TL100.plot_s_db()\n", |
| 301 |
"Check.plot_s_db(1,0, color='k')\n", |
| 302 |
"Check.plot_s_db(0,0, color='k')\n", |
| 303 |
"plt.show()\n", |
| 304 |
"\n", |
| 305 |
"Check_dc = Check.extrapolate_to_dc(kind='linear')\n", |
| 306 |
"\n", |
| 307 |
"plt.figure()\n", |
| 308 |
"plt.suptitle('Time domain step-response')\n", |
| 309 |
"ax = plt.subplot(1,1,1)\n", |
| 310 |
"TL100_dc.plot_z_time_step(0, 0, ax=ax, color='k')\n", |
| 311 |
"Check_dc.plot_z_time_step(0, 0, ax=ax, color='b')\n", |
| 312 |
"t0 = -2\n", |
| 313 |
"t1 = 4\n", |
| 314 |
"ax.set_xlim(t0, t1)\n", |
| 315 |
"ax.xaxis.set_minor_locator(AutoMinorLocator(10))\n", |
| 316 |
"ax.yaxis.set_minor_locator(AutoMinorLocator(5))\n", |
| 317 |
"ax.patch.set_facecolor('1.0')\n", |
| 318 |
"ax.grid(True, color='0.8', which='minor')\n", |
| 319 |
"ax.grid(True, color='0.5', which='major')\n" |
| 320 |
] |
| 321 |
}, |
| 322 |
{ |
| 323 |
"cell_type": "markdown", |
| 324 |
"metadata": {}, |
| 325 |
"source": [ |
| 326 |
"The plots shows a reasonable agreement between model and measurement up to 4 GHz.\n", |
| 327 |
"\n", |
| 328 |
"Further works may include implementing CPWG medium or modeling the line by more sections to account the impedance variation vs. position." |
| 329 |
] |
| 330 |
}, |
| 331 |
{ |
| 332 |
"cell_type": "code", |
| 333 |
"execution_count": null, |
| 334 |
"metadata": {}, |
| 335 |
"outputs": [], |
| 336 |
"source": [] |
| 337 |
} |
| 338 |
], |
| 339 |
"metadata": { |
| 340 |
"kernelspec": { |
| 341 |
"display_name": "Python 3 (ipykernel)", |
| 342 |
"language": "python", |
| 343 |
"name": "python3" |
| 344 |
}, |
| 345 |
"language_info": { |
| 346 |
"codemirror_mode": { |
| 347 |
"name": "ipython", |
| 348 |
"version": 3 |
| 349 |
}, |
| 350 |
"file_extension": ".py", |
| 351 |
"mimetype": "text/x-python", |
| 352 |
"name": "python", |
| 353 |
"nbconvert_exporter": "python", |
| 354 |
"pygments_lexer": "ipython3", |
| 355 |
"version": "3.9.16" |
| 356 |
}, |
| 357 |
"vscode": { |
| 358 |
"interpreter": { |
| 359 |
"hash": "637c323cf467337602e9974a89cb4d3fc95fac3ef875a73e62754f8e768d8de7" |
| 360 |
} |
| 361 |
} |
| 362 |
}, |
| 363 |
"nbformat": 4, |
| 364 |
"nbformat_minor": 4 |
| 365 |
} |