Debian Codegraph @

doc/source/examples/networktheory/Balanced Network De-embedding.ipynb

raw
1 {
2 "cells": [
3 {
4 "cell_type": "markdown",
5 "metadata": {},
6 "source": [
7 "# Balanced Network De-embedding"
8 ]
9 },
10 {
11 "cell_type": "markdown",
12 "metadata": {},
13 "source": [
14 "Demonstration of *balanced*, i.e. 2N-port, network de-embedding."
15 ]
16 },
17 {
18 "cell_type": "markdown",
19 "metadata": {},
20 "source": [
21 "## Setup"
22 ]
23 },
24 {
25 "cell_type": "code",
26 "execution_count": null,
27 "metadata": {},
28 "outputs": [],
29 "source": [
30 "import matplotlib.pyplot as plt\n",
31 "\n",
32 "import skrf as rf\n",
33 "from skrf.media import CPW\n",
34 "\n",
35 "rf.stylely()"
36 ]
37 },
38 {
39 "cell_type": "code",
40 "execution_count": null,
41 "metadata": {},
42 "outputs": [],
43 "source": [
44 "# base parameters\n",
45 "freq = rf.Frequency(1e-3,10,1001,'ghz')\n",
46 "cpw = CPW(freq, w=0.6e-3, s=0.25e-3, ep_r=10.6, z0_port=50)"
47 ]
48 },
49 {
50 "cell_type": "markdown",
51 "metadata": {},
52 "source": [
53 "## Build fixture network\n",
54 "* short length of mismatched line with connector-like input shunt capacitance\n",
55 "* some crosstalk added with nudge"
56 ]
57 },
58 {
59 "cell_type": "code",
60 "execution_count": null,
61 "metadata": {},
62 "outputs": [],
63 "source": [
64 "\"\"\"\n",
65 " l1\n",
66 " 0----+-=======-2\n",
67 " |\n",
68 " = c1\n",
69 " |\n",
70 " GND\n",
71 "\n",
72 " l1\n",
73 " 1----+-=======-3\n",
74 " |\n",
75 " = c1\n",
76 " |\n",
77 " GND\n",
78 "\"\"\"\n",
79 "\n",
80 "\n",
81 "l1 = cpw.line(20, unit='mm')\n",
82 "c1 = cpw.shunt_capacitor(C=0.15e-12)\n",
83 "l1 = rf.connect(c1, 1, l1, 0)\n",
84 "li = rf.concat_ports([l1, l1], port_order='second')\n",
85 "Fix = li\n",
86 "Fix.name = 'Fix'\n",
87 "Fix.nudge(1e-4)\n",
88 "Left = Fix\n",
89 "# flip fixture for right side\n",
90 "Right = Fix.flipped()"
91 ]
92 },
93 {
94 "cell_type": "markdown",
95 "metadata": {},
96 "source": [
97 "## Build DUT network\n",
98 "\n",
99 "* some length of mismatched lines\n",
100 "* some crosstalk added with nudge"
101 ]
102 },
103 {
104 "cell_type": "code",
105 "execution_count": null,
106 "metadata": {},
107 "outputs": [],
108 "source": [
109 "\"\"\"\n",
110 " l2\n",
111 " 0-=======-2\n",
112 " l2\n",
113 " 1-=======-3\n",
114 "\"\"\"\n",
115 "l2 = cpw.line(50, 'mm')\n",
116 "DUT = rf.concat_ports([l2, l2], port_order='second')\n",
117 "DUT.name = 'DUT'\n",
118 "DUT.nudge(1e-5)"
119 ]
120 },
121 {
122 "cell_type": "markdown",
123 "metadata": {},
124 "source": [
125 "## Build the measurement\n",
126 "\n",
127 "* cascade Left, DUT and Right\n",
128 "* add some noise"
129 ]
130 },
131 {
132 "cell_type": "code",
133 "execution_count": null,
134 "metadata": {},
135 "outputs": [],
136 "source": [
137 "\"\"\"\n",
138 " Left Meas Right\n",
139 " l1 l2 l1\n",
140 " 0----+-=======-2 0-=======-2 0-=======-+----2\n",
141 " | |\n",
142 " = c1 = c1\n",
143 " | |\n",
144 " GND GND\n",
145 "\n",
146 " l1 l2 l1\n",
147 " 1----+-=======-3 1-=======-3 1-=======-+----3\n",
148 " | |\n",
149 " = c1 = c1\n",
150 " | |\n",
151 " GND GND\n",
152 "\"\"\"\n",
153 "Meas = Left ** DUT ** Right\n",
154 "Meas.name = 'Meas'\n",
155 "Meas.add_noise_polar(1e-5, 2)"
156 ]
157 },
158 {
159 "cell_type": "markdown",
160 "metadata": {},
161 "source": [
162 "## Perform de-embedding"
163 ]
164 },
165 {
166 "cell_type": "code",
167 "execution_count": null,
168 "metadata": {},
169 "outputs": [],
170 "source": [
171 "DUTd = Left.inv ** Meas ** Right.inv\n",
172 "DUTd.name = 'DUTd'"
173 ]
174 },
175 {
176 "cell_type": "markdown",
177 "metadata": {},
178 "source": [
179 "## Display results"
180 ]
181 },
182 {
183 "cell_type": "code",
184 "execution_count": null,
185 "metadata": {},
186 "outputs": [],
187 "source": [
188 "\n",
189 "fig, axarr = plt.subplots(2,2, sharex=True, figsize=(10,6))\n",
190 "\n",
191 "ax = axarr[0,0]\n",
192 "Meas.plot_s_db(m=0, n=0, ax=ax)\n",
193 "DUTd.plot_s_db(m=0, n=0, ax=ax)\n",
194 "DUT.plot_s_db(m=0, n=0, ax=ax, ls=':', color='0.0')\n",
195 "ax.set_title('Return Loss')\n",
196 "ax.legend(loc='lower center', ncol=3)\n",
197 "ax.grid(True)\n",
198 "\n",
199 "ax = axarr[0,1]\n",
200 "Meas.plot_s_db(m=2, n=0, ax=ax)\n",
201 "DUTd.plot_s_db(m=2, n=0, ax=ax)\n",
202 "DUT.plot_s_db(m=2, n=0, ax=ax, ls=':', color='0.0')\n",
203 "ax.set_title('Insertion Loss')\n",
204 "ax.legend(loc='lower center', ncol=3)\n",
205 "ax.grid(True)\n",
206 "\n",
207 "ax = axarr[1,0]\n",
208 "Meas.plot_s_db(m=1, n=0, ax=ax)\n",
209 "DUTd.plot_s_db(m=1, n=0, ax=ax)\n",
210 "DUT.plot_s_db(m=1, n=0, ax=ax, ls=':', color='0.0')\n",
211 "ax.set_title('Isolation')\n",
212 "ax.legend(loc='lower center', ncol=3)\n",
213 "ax.grid(True)\n",
214 "\n",
215 "ax = axarr[1,1]\n",
216 "Meas.plot_s_deg(m=2, n=0, ax=ax)\n",
217 "DUTd.plot_s_deg(m=2, n=0, ax=ax, marker='o', markevery=25)\n",
218 "DUT.plot_s_deg(m=2, n=0, ax=ax, ls=':', color='0.0')\n",
219 "ax.set_title('Insertion Loss')\n",
220 "ax.legend(loc='lower center', ncol=3)\n",
221 "ax.grid(True)\n",
222 "\n",
223 "fig.tight_layout()"
224 ]
225 },
226 {
227 "cell_type": "code",
228 "execution_count": null,
229 "metadata": {},
230 "outputs": [],
231 "source": []
232 }
233 ],
234 "metadata": {
235 "anaconda-cloud": {},
236 "kernelspec": {
237 "display_name": "Python 3 (ipykernel)",
238 "language": "python",
239 "name": "python3"
240 },
241 "language_info": {
242 "codemirror_mode": {
243 "name": "ipython",
244 "version": 3
245 },
246 "file_extension": ".py",
247 "mimetype": "text/x-python",
248 "name": "python",
249 "nbconvert_exporter": "python",
250 "pygments_lexer": "ipython3",
251 "version": "3.8.10"
252 }
253 },
254 "nbformat": 4,
255 "nbformat_minor": 2
256 }