Debian Codegraph @

doc/source/examples/networktheory/Transmission Line Losses.ipynb

raw
1 {
2 "cells": [
3 {
4 "cell_type": "markdown",
5 "metadata": {},
6 "source": [
7 "# Transmission Line Losses on a Loaded Lossy Line "
8 ]
9 },
10 {
11 "cell_type": "markdown",
12 "metadata": {},
13 "source": [
14 "When dealing with RF power, for instance in radio, industry or scientific applications, a recurrent problem is to handle the inevitable RF losses correctly to avoid overheating of cables and components. \n",
15 "\n",
16 "## Matched Load\n",
17 "In this example, we will use `scikit-rf` to evaluate the losses in a 50 Ohm, 20 meters long, RG-8 cable (VF=0.84) charged with a resistive load $R_L=50\\Omega$ at 13.56 MHz. The cable losses are estimated to 1.483 dB/100 meters and the source power to 400W. \n"
18 ]
19 },
20 {
21 "cell_type": "markdown",
22 "metadata": {},
23 "source": [
24 "First, the usual Python imports:"
25 ]
26 },
27 {
28 "cell_type": "code",
29 "execution_count": null,
30 "metadata": {},
31 "outputs": [],
32 "source": [
33 "%matplotlib inline"
34 ]
35 },
36 {
37 "cell_type": "code",
38 "execution_count": null,
39 "metadata": {},
40 "outputs": [],
41 "source": [
42 "import numpy as np\n",
43 "\n",
44 "import skrf as rf"
45 ]
46 },
47 {
48 "cell_type": "code",
49 "execution_count": null,
50 "metadata": {},
51 "outputs": [],
52 "source": [
53 "rf.stylely()"
54 ]
55 },
56 {
57 "cell_type": "markdown",
58 "metadata": {},
59 "source": [
60 "Let's define the problem constants:"
61 ]
62 },
63 {
64 "cell_type": "code",
65 "execution_count": null,
66 "metadata": {},
67 "outputs": [],
68 "source": [
69 "Pin = 400 # W\n",
70 "z0 = 50 # Ohm\n",
71 "freq = rf.Frequency(13.56, npoints=1, unit='MHz')\n",
72 "VF = 0.84\n",
73 "RL = 50 # Ohm\n",
74 "L = 20 # m"
75 ]
76 },
77 {
78 "cell_type": "markdown",
79 "metadata": {},
80 "source": [
81 "The propagation constant of the transmission line $\\gamma=\\alpha+j\\beta$ is: "
82 ]
83 },
84 {
85 "cell_type": "code",
86 "execution_count": null,
87 "metadata": {},
88 "outputs": [],
89 "source": [
90 "alpha = rf.db_2_np(1.483/100) # Np/m\n",
91 "beta = freq.w/rf.c/VF\n",
92 "gamma = alpha + 1j*beta"
93 ]
94 },
95 {
96 "cell_type": "markdown",
97 "metadata": {},
98 "source": [
99 "The matched line loss (or power attenuation), $a=e^{2\\alpha L}$, is: "
100 ]
101 },
102 {
103 "cell_type": "code",
104 "execution_count": null,
105 "metadata": {},
106 "outputs": [],
107 "source": [
108 "a = np.exp(2*alpha*L) # also simply 2.84/100*20\n",
109 "print('Matched line loss: a=', rf.mag_2_db10(a), 'dB')"
110 ]
111 },
112 {
113 "cell_type": "markdown",
114 "metadata": {},
115 "source": [
116 "If the line is charged with a matched load, ie. $R_L=50\\Omega$, then the total line loss is $a$. The power lost in the cable will thus be:"
117 ]
118 },
119 {
120 "cell_type": "code",
121 "execution_count": null,
122 "metadata": {},
123 "outputs": [],
124 "source": [
125 "print('(Forward) Power delivered to the load:', Pin/a, 'W')\n",
126 "print('Power lost in the cable:', Pin *( 1 - 1/a), 'W')"
127 ]
128 },
129 {
130 "cell_type": "markdown",
131 "metadata": {},
132 "source": [
133 "Which can also be checked by the `scikit-rf` transmission line function `zl_2_total_loss`: "
134 ]
135 },
136 {
137 "cell_type": "code",
138 "execution_count": null,
139 "metadata": {},
140 "outputs": [],
141 "source": [
142 "a_skrf = rf.zl_2_total_loss(z0, zl=RL, theta=gamma*L)\n",
143 "print('Power lost in the cable:',\n",
144 " Pin * (1 - 1/a_skrf), 'W')"
145 ]
146 },
147 {
148 "cell_type": "markdown",
149 "metadata": {},
150 "source": [
151 "Another way to evaluate the total power dissipated in the circuit is to evaluate the power expression:\n",
152 "\n",
153 "$$\n",
154 "P_{delivered} = \\frac{1}{2} \\Re \\left[ V I^* \\right]\n",
155 "$$\n",
156 "\n",
157 "where $V$ and $I$ are the (peak) total voltage and current. They can be evaluate using the transmission line function `voltage_current_propagation`:"
158 ]
159 },
160 {
161 "cell_type": "code",
162 "execution_count": null,
163 "metadata": {},
164 "outputs": [],
165 "source": [
166 "# reflection coefficient and input impedance\n",
167 "Gamma_in = rf.zl_2_Gamma_in(z0, RL, theta=gamma*L)\n",
168 "Z_in = rf.zl_2_zin(z0, RL, theta=gamma*L)\n",
169 "\n",
170 "# voltage and current at the line input as a function of source power\n",
171 "V_in = np.sqrt(2*z0*Pin)*(1 + Gamma_in)\n",
172 "I_in = V_in/Z_in\n",
173 "\n",
174 "# voltage and current at z=L\n",
175 "V,I = rf.voltage_current_propagation(V_in, I_in, z0, gamma*L)\n",
176 "P_delivered = 1/2 * np.real(V * np.conj(I))\n",
177 "print('Power delivered to the load: ', P_delivered, 'W')\n",
178 "print('Power dissipated in the cable: ',Pin - P_delivered, 'W')"
179 ]
180 },
181 {
182 "cell_type": "markdown",
183 "metadata": {},
184 "source": [
185 "## Non Matched load"
186 ]
187 },
188 {
189 "cell_type": "markdown",
190 "metadata": {},
191 "source": [
192 "However, if the load is not perfectly matched to the line characteristic impedance $z_0$, for example with $R_L=200 + 30j\\Omega$, additional losses are induced by the reflected wave. The reflection coefficient $\\Gamma_{load}$ induced by this load is:"
193 ]
194 },
195 {
196 "cell_type": "code",
197 "execution_count": null,
198 "metadata": {},
199 "outputs": [],
200 "source": [
201 "z0 = 50\n",
202 "ZL = 200 - 30j\n",
203 "Gamma_load = rf.zl_2_Gamma0(z0, ZL)\n",
204 "print('|Gamma_load|=', np.abs(Gamma_load))"
205 ]
206 },
207 {
208 "cell_type": "markdown",
209 "metadata": {},
210 "source": [
211 "while the reflection coefficient seen at the input of the transmission line $\\Gamma_{in}$ is: "
212 ]
213 },
214 {
215 "cell_type": "code",
216 "execution_count": null,
217 "metadata": {},
218 "outputs": [],
219 "source": [
220 "Gamma_in = rf.zl_2_Gamma_in(z0, ZL, theta=gamma*L)\n",
221 "SWR = rf.Gamma0_2_swr(rf.zl_2_Gamma_in(z0, ZL, theta=gamma*L))\n",
222 "print('|Gamma_in|=', np.abs(Gamma_in), '(SWR=', SWR,')')"
223 ]
224 },
225 {
226 "cell_type": "markdown",
227 "metadata": {},
228 "source": [
229 "The total loss in dB due to SWR is often stated as:\n",
230 "$$\n",
231 "a_{[dB]} + 10 \\log_{10} \\frac{1 - |\\Gamma_{in}|^2}{1 - |\\Gamma_{load}|^2}\n",
232 "$$"
233 ]
234 },
235 {
236 "cell_type": "code",
237 "execution_count": null,
238 "metadata": {},
239 "outputs": [],
240 "source": [
241 "10*np.log10(a) + 10*np.log10((1 - np.abs(Gamma_in)**2)/(1 - np.abs(Gamma_load)**2))"
242 ]
243 },
244 {
245 "cell_type": "markdown",
246 "metadata": {},
247 "source": [
248 "However, this expression is only correct if either properties are verified:\n",
249 "- (i) the characteristic impedance of the line is real (distorsionless line) \n",
250 "- (ii) reflection coefficient is real (ie real $Z_L/Z_0$) [1]. \n",
251 "\n",
252 "The 1st condition is met here, however it will not be the case in the next section. \n",
253 "\n",
254 "Anyway, the `scikit-rf` transmission line function `zl_2_total_loss` is correct in all conditions:"
255 ]
256 },
257 {
258 "cell_type": "code",
259 "execution_count": null,
260 "metadata": {},
261 "outputs": [],
262 "source": [
263 "a = rf.zl_2_total_loss(z0, zl=ZL, theta=gamma * L)\n",
264 "print('Total power loss: ', rf.mag_2_db10(a), 'dB' )\n",
265 "print('Delivered power:', Pin/a, 'W')\n",
266 "print('The total power loss is the cable:', Pin*(1 - 1/a), 'W')"
267 ]
268 },
269 {
270 "cell_type": "code",
271 "execution_count": null,
272 "metadata": {},
273 "outputs": [],
274 "source": [
275 "# reflection coefficient and input impedance\n",
276 "Gamma_in = rf.zl_2_Gamma_in(z0, ZL, theta=gamma*L)\n",
277 "Z_in = rf.zl_2_zin(z0, ZL, theta=gamma*L)\n",
278 "\n",
279 "# voltage and current at the line input as a function of source power\n",
280 "V_in = np.sqrt(2*z0*Pin)*(1 + Gamma_in)\n",
281 "I_in = V_in/Z_in\n",
282 "\n",
283 "# voltage and current at z=L\n",
284 "V,I = rf.voltage_current_propagation(V_in, I_in, z0, gamma*L)\n",
285 "P_delivered = 1/2 * np.real(V * np.conj(I))\n",
286 "print('Power delivered to the load: ', P_delivered, 'W')\n",
287 "print('Power dissipated in the cable: ',Pin - P_delivered, 'W')"
288 ]
289 },
290 {
291 "cell_type": "code",
292 "execution_count": null,
293 "metadata": {},
294 "outputs": [],
295 "source": [
296 "rf.Gamma0_2_swr(Gamma_in)"
297 ]
298 },
299 {
300 "cell_type": "code",
301 "execution_count": null,
302 "metadata": {},
303 "outputs": [],
304 "source": [
305 "10*np.log10(P_delivered/Pin)"
306 ]
307 },
308 {
309 "cell_type": "markdown",
310 "metadata": {},
311 "source": [
312 "## A more advanced example\n",
313 "This example reproduces the example presented in reference [1].\n",
314 "\n",
315 "Let's assume a coaxial line ([Wireman #551, 450-Ohm](https://thewireman.com/antennap.html)) loaded with a complex load $Z_L=R_L + jX_L$, with the following parameters: \n",
316 " - line length: 100 feet\n",
317 " - frequency: 1.83 MHz\n",
318 " - [attenuation constant](https://en.wikipedia.org/wiki/Propagation_constant#Attenuation_constant): $\\alpha=$ 0.095 dB/100 feet\n",
319 " - coaxial relative permittivity: $\\epsilon_r=1.194$ ([Velocity Factor](https://en.wikipedia.org/wiki/Velocity_factor) VF=0.915)\n",
320 " - real part of the characteristic impedance: $R_0 = \\Re \\left[Z_0\\right]$=402.75 Ohm\n",
321 " - Load resistance: $R_L$ = 4.5 Ohm\n",
322 " - Load reactance: $X_L$ = -1673 Ohm\n",
323 " "
324 ]
325 },
326 {
327 "cell_type": "code",
328 "execution_count": null,
329 "metadata": {},
330 "outputs": [],
331 "source": [
332 "Z_L = 4.5 - 1673j\n",
333 "R_0 = 402.75\n",
334 "freq = rf.Frequency(1.83, npoints=1, unit='MHz')\n",
335 "VF = 0.915\n",
336 "L = rf.feet_2_meter(100)"
337 ]
338 },
339 {
340 "cell_type": "markdown",
341 "metadata": {},
342 "source": [
343 "First, we can derive the propagation constant $\\gamma=\\alpha+j\\beta$ with $\\beta=\\frac{\\omega}{c }\\sqrt{\\epsilon_r}$ from the problem parameters:"
344 ]
345 },
346 {
347 "cell_type": "code",
348 "execution_count": null,
349 "metadata": {},
350 "outputs": [],
351 "source": [
352 "alpha = rf.db_2_np(rf.db_per_100feet_2_db_per_100meter(0.095)/100)\n",
353 "beta = freq.w/rf.c/VF\n",
354 "gamma = alpha + 1j*beta\n",
355 "print(gamma)"
356 ]
357 },
358 {
359 "cell_type": "markdown",
360 "metadata": {},
361 "source": [
362 "However, the transmission line characteristic reactance is not given in the problem parameters and must be determined. It can be approximated from a high-frequency, low-loss approximation [1]:\n",
363 "$$\n",
364 "Z_0 = R_0 + j X_0 \\approx R_0 - j \\frac{\\alpha}{\\beta}R_0\n",
365 "$$ \n",
366 "ie,\n",
367 "$$\n",
368 "X_0 \\approx - \\frac{\\alpha}{\\beta}R_0\n",
369 "$$"
370 ]
371 },
372 {
373 "cell_type": "code",
374 "execution_count": null,
375 "metadata": {},
376 "outputs": [],
377 "source": [
378 "X_0 = -alpha/beta*R_0\n",
379 "Z_0 = R_0 + 1j*X_0\n",
380 "print('X_0=', X_0)"
381 ]
382 },
383 {
384 "cell_type": "markdown",
385 "metadata": {},
386 "source": [
387 "Now that we have both the characteristic impedance and the propagation constant of the line, the reflection coefficients, input impedance and total loss can be deduced: "
388 ]
389 },
390 {
391 "cell_type": "code",
392 "execution_count": null,
393 "metadata": {},
394 "outputs": [],
395 "source": [
396 "print('Gamma at load:', np.abs(rf.zl_2_Gamma0(Z_0, Z_L)))\n",
397 "print('Gamma at input:', np.abs(rf.zl_2_Gamma_in(Z_0, Z_L, theta=gamma*L)))\n",
398 "print('SWR at load:', rf.Gamma0_2_swr(rf.zl_2_Gamma0(Z_0, Z_L)))\n",
399 "\n",
400 "print('SWR at input:', rf.Gamma0_2_swr(rf.zl_2_Gamma_in(Z_0, Z_L, theta=gamma*L)))\n",
401 "print('Input impedance:', rf.input_impedance_at_theta(Z_0, Z_L, theta=gamma*L ), 'Ohm')\n",
402 "\n",
403 "total_loss_db = rf.mag_2_db10(np.abs(rf.zl_2_total_loss(z0=Z_0, zl=Z_L, theta=gamma*L)))\n",
404 "print('Total loss:', total_loss_db, 'dB')"
405 ]
406 },
407 {
408 "cell_type": "markdown",
409 "metadata": {},
410 "source": [
411 "which match the results presented in reference [1]."
412 ]
413 },
414 {
415 "cell_type": "markdown",
416 "metadata": {},
417 "source": [
418 "## References\n",
419 " - [1] Steve Stearns (K6OIK), A Transmission Line Power Paradox and Its Resolution, ARRL Pacificon Antenna Seminar, Santa Clara, CA October 10-12, 2014: https://www.fars.k6ya.org/docs/K6OIK-A_Transmission_Line_Power_Paradox_and_Its_Resolution.pdf\n",
420 " "
421 ]
422 },
423 {
424 "cell_type": "code",
425 "execution_count": null,
426 "metadata": {},
427 "outputs": [],
428 "source": []
429 }
430 ],
431 "metadata": {
432 "kernelspec": {
433 "display_name": "Python 3",
434 "language": "python",
435 "name": "python3"
436 },
437 "language_info": {
438 "codemirror_mode": {
439 "name": "ipython",
440 "version": 3
441 },
442 "file_extension": ".py",
443 "mimetype": "text/x-python",
444 "name": "python",
445 "nbconvert_exporter": "python",
446 "pygments_lexer": "ipython3",
447 "version": "3.7.5"
448 }
449 },
450 "nbformat": 4,
451 "nbformat_minor": 2
452 }