| 1 |
r""" |
| 2 |
.. module:: skrf.tlineFunctions |
| 3 |
=============================================== |
| 4 |
tlineFunctions (:mod:`skrf.tlineFunctions`) |
| 5 |
=============================================== |
| 6 |
|
| 7 |
This module provides functions related to transmission line theory. |
| 8 |
|
| 9 |
Impedance and Reflection Coefficient |
| 10 |
-------------------------------------- |
| 11 |
These functions relate basic transmission line quantities such as |
| 12 |
characteristic impedance, input impedance, reflection coefficient, etc. |
| 13 |
Each function has two names. One is a long-winded but readable name and |
| 14 |
the other is a short-hand variable-like names. Below is a table relating |
| 15 |
these two names with each other as well as common mathematical symbols. |
| 16 |
|
| 17 |
==================== ====================== ================================ |
| 18 |
Symbol Variable Name Long Name |
| 19 |
==================== ====================== ================================ |
| 20 |
:math:`Z_l` z_l load_impedance |
| 21 |
:math:`Z_{in}` z_in input_impedance |
| 22 |
:math:`\Gamma_0` Gamma_0 reflection_coefficient |
| 23 |
:math:`\Gamma_{in}` Gamma_in reflection_coefficient_at_theta |
| 24 |
:math:`\theta` theta electrical_length |
| 25 |
==================== ====================== ================================ |
| 26 |
|
| 27 |
There may be a bit of confusion about the difference between the load |
| 28 |
impedance the input impedance. This is because the load impedance **is** |
| 29 |
the input impedance at the load. An illustration may provide some |
| 30 |
useful reference. |
| 31 |
|
| 32 |
Below is a (bad) illustration of a section of uniform transmission line |
| 33 |
of characteristic impedance :math:`Z_0`, and electrical length |
| 34 |
:math:`\theta`. The line is terminated on the right with some |
| 35 |
load impedance, :math:`Z_l`. The input impedance :math:`Z_{in}` and |
| 36 |
input reflection coefficient :math:`\Gamma_{in}` are |
| 37 |
looking in towards the load from the distance :math:`\theta` from the |
| 38 |
load. |
| 39 |
|
| 40 |
.. math:: |
| 41 |
Z_0, \theta |
| 42 |
|
| 43 |
\text{o===============o=}[Z_l] |
| 44 |
|
| 45 |
\to\qquad\qquad\qquad\quad\qquad \qquad \to \qquad \quad |
| 46 |
|
| 47 |
Z_{in},\Gamma_{in}\qquad\qquad\qquad\qquad\quad Z_l,\Gamma_0 |
| 48 |
|
| 49 |
So, to clarify the confusion, |
| 50 |
|
| 51 |
.. math:: |
| 52 |
Z_{in}= Z_{l},\qquad\qquad |
| 53 |
\Gamma_{in}=\Gamma_l \text{ at } \theta=0 |
| 54 |
|
| 55 |
|
| 56 |
Short names |
| 57 |
+++++++++++++ |
| 58 |
.. autosummary:: |
| 59 |
:toctree: generated/ |
| 60 |
|
| 61 |
theta |
| 62 |
|
| 63 |
zl_2_Gamma0 |
| 64 |
zl_2_zin |
| 65 |
zl_2_Gamma_in |
| 66 |
zl_2_swr |
| 67 |
zl_2_total_loss |
| 68 |
|
| 69 |
Gamma0_2_zl |
| 70 |
Gamma0_2_Gamma_in |
| 71 |
Gamma0_2_zin |
| 72 |
Gamma0_2_swr |
| 73 |
|
| 74 |
Long-names |
| 75 |
++++++++++++++ |
| 76 |
.. autosummary:: |
| 77 |
:toctree: generated/ |
| 78 |
|
| 79 |
electrical_length |
| 80 |
|
| 81 |
distance_2_electrical_length |
| 82 |
electrical_length_2_distance |
| 83 |
|
| 84 |
reflection_coefficient_at_theta |
| 85 |
reflection_coefficient_2_input_impedance |
| 86 |
reflection_coefficient_2_input_impedance_at_theta |
| 87 |
reflection_coefficient_2_propagation_constant |
| 88 |
|
| 89 |
input_impedance_at_theta |
| 90 |
load_impedance_2_reflection_coefficient |
| 91 |
load_impedance_2_reflection_coefficient_at_theta |
| 92 |
|
| 93 |
voltage_current_propagation |
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
Distributed Circuit and Wave Quantities |
| 98 |
---------------------------------------- |
| 99 |
.. autosummary:: |
| 100 |
:toctree: generated/ |
| 101 |
|
| 102 |
distributed_circuit_2_propagation_impedance |
| 103 |
propagation_impedance_2_distributed_circuit |
| 104 |
|
| 105 |
Transmission Line Physics |
| 106 |
--------------------------------- |
| 107 |
.. autosummary:: |
| 108 |
:toctree: generated/ |
| 109 |
|
| 110 |
skin_depth |
| 111 |
surface_resistivity |
| 112 |
""" |
| 113 |
|
| 114 |
import numpy as np |
| 115 |
from numpy import array, exp, pi, real, sqrt |
| 116 |
from scipy.constants import mu_0 |
| 117 |
|
| 118 |
from . import mathFunctions as mf |
| 119 |
from .constants import INF, ONE, NumberLike |
| 120 |
|
| 121 |
|
| 122 |
def skin_depth(f: NumberLike, rho: float, mu_r: float): |
| 123 |
r""" |
| 124 |
Skin depth for a material. |
| 125 |
|
| 126 |
The skin depth is calculated as: |
| 127 |
|
| 128 |
|
| 129 |
.. math:: |
| 130 |
|
| 131 |
\delta = \sqrt{\frac{ \rho }{ \pi f \mu_r \mu_0 }} |
| 132 |
|
| 133 |
See www.microwaves101.com [#]_ or wikipedia [#]_ for more info. |
| 134 |
|
| 135 |
Parameters |
| 136 |
---------- |
| 137 |
f : number or array-like |
| 138 |
frequency, in Hz |
| 139 |
rho : number of array-like |
| 140 |
bulk resistivity of material, in ohm*m |
| 141 |
mu_r : number or array-like |
| 142 |
relative permeability of material |
| 143 |
|
| 144 |
Returns |
| 145 |
------- |
| 146 |
skin depth : number or array-like |
| 147 |
the skin depth, in meter |
| 148 |
|
| 149 |
References |
| 150 |
---------- |
| 151 |
.. [#] https://www.microwaves101.com/encyclopedias/skin-depth |
| 152 |
.. [#] http://en.wikipedia.org/wiki/Skin_effect |
| 153 |
|
| 154 |
See Also |
| 155 |
-------- |
| 156 |
surface_resistivity |
| 157 |
|
| 158 |
""" |
| 159 |
return sqrt(rho/(pi*f*mu_r*mu_0)) |
| 160 |
|
| 161 |
|
| 162 |
def surface_resistivity(f: NumberLike, rho: float, mu_r: float): |
| 163 |
r""" |
| 164 |
Surface resistivity. |
| 165 |
|
| 166 |
The surface resistivity is calculated as: |
| 167 |
|
| 168 |
|
| 169 |
.. math:: |
| 170 |
|
| 171 |
\frac{ \rho }{ \delta } |
| 172 |
|
| 173 |
where :math:`\delta` is the skin depth from :func:`skin_depth`. |
| 174 |
|
| 175 |
See www.microwaves101.com [#]_ or wikipedia [#]_ for more info. |
| 176 |
|
| 177 |
Parameters |
| 178 |
---------- |
| 179 |
f : number or array-like |
| 180 |
frequency, in Hz |
| 181 |
rho : number or array-like |
| 182 |
bulk resistivity of material, in ohm*m |
| 183 |
mu_r : number or array-like |
| 184 |
relative permeability of material |
| 185 |
|
| 186 |
Returns |
| 187 |
------- |
| 188 |
surface resistivity : number of array-like |
| 189 |
Surface resistivity in ohms/square |
| 190 |
|
| 191 |
References |
| 192 |
---------- |
| 193 |
.. [#] https://www.microwaves101.com/encyclopedias/sheet-resistance |
| 194 |
.. [#] https://en.wikipedia.org/wiki/Sheet_resistance |
| 195 |
|
| 196 |
See Also |
| 197 |
-------- |
| 198 |
skin_depth |
| 199 |
""" |
| 200 |
return rho/skin_depth(rho=rho, f=f, mu_r=mu_r) |
| 201 |
|
| 202 |
|
| 203 |
def distributed_circuit_2_propagation_impedance(distributed_admittance: NumberLike, |
| 204 |
distributed_impedance: NumberLike): |
| 205 |
r""" |
| 206 |
Convert distributed circuit values to wave quantities. |
| 207 |
|
| 208 |
This converts complex distributed impedance and admittance to |
| 209 |
propagation constant and characteristic impedance. The relation is |
| 210 |
|
| 211 |
.. math:: |
| 212 |
Z_0 = \sqrt{ \frac{Z^{'}}{Y^{'}}} |
| 213 |
\quad\quad |
| 214 |
\gamma = \sqrt{ Z^{'} Y^{'}} |
| 215 |
|
| 216 |
Parameters |
| 217 |
---------- |
| 218 |
distributed_admittance : number, array-like |
| 219 |
distributed admittance |
| 220 |
distributed_impedance : number, array-like |
| 221 |
distributed impedance |
| 222 |
|
| 223 |
Returns |
| 224 |
------- |
| 225 |
propagation_constant : number, array-like |
| 226 |
distributed impedance |
| 227 |
characteristic_impedance : number, array-like |
| 228 |
distributed impedance |
| 229 |
|
| 230 |
See Also |
| 231 |
-------- |
| 232 |
propagation_impedance_2_distributed_circuit : opposite conversion |
| 233 |
""" |
| 234 |
propagation_constant = \ |
| 235 |
sqrt(distributed_impedance*distributed_admittance) |
| 236 |
characteristic_impedance = \ |
| 237 |
sqrt(distributed_impedance/distributed_admittance) |
| 238 |
return (propagation_constant, characteristic_impedance) |
| 239 |
|
| 240 |
|
| 241 |
def propagation_impedance_2_distributed_circuit(propagation_constant: NumberLike, |
| 242 |
characteristic_impedance: NumberLike): |
| 243 |
r""" |
| 244 |
Convert wave quantities to distributed circuit values. |
| 245 |
|
| 246 |
Convert complex propagation constant and characteristic impedance |
| 247 |
to distributed impedance and admittance. The relation is, |
| 248 |
|
| 249 |
.. math:: |
| 250 |
Z^{'} = \gamma Z_0 \quad\quad |
| 251 |
Y^{'} = \frac{\gamma}{Z_0} |
| 252 |
|
| 253 |
Parameters |
| 254 |
---------- |
| 255 |
propagation_constant : number, array-like |
| 256 |
distributed impedance |
| 257 |
characteristic_impedance : number, array-like |
| 258 |
distributed impedance |
| 259 |
|
| 260 |
Returns |
| 261 |
------- |
| 262 |
distributed_admittance : number, array-like |
| 263 |
distributed admittance |
| 264 |
distributed_impedance : number, array-like |
| 265 |
distributed impedance |
| 266 |
|
| 267 |
|
| 268 |
See Also |
| 269 |
-------- |
| 270 |
distributed_circuit_2_propagation_impedance : opposite conversion |
| 271 |
""" |
| 272 |
distributed_admittance = propagation_constant/characteristic_impedance |
| 273 |
distributed_impedance = propagation_constant*characteristic_impedance |
| 274 |
return (distributed_admittance, distributed_impedance) |
| 275 |
|
| 276 |
|
| 277 |
def electrical_length(gamma: NumberLike, f: NumberLike, d: NumberLike, deg: bool = False): |
| 278 |
r""" |
| 279 |
Electrical length of a section of transmission line. |
| 280 |
|
| 281 |
.. math:: |
| 282 |
\theta = \gamma(f) \cdot d |
| 283 |
|
| 284 |
Parameters |
| 285 |
---------- |
| 286 |
gamma : number, array-like or function |
| 287 |
propagation constant. See Notes. |
| 288 |
If passed as a function, takes frequency in Hz as a sole argument. |
| 289 |
f : number or array-like |
| 290 |
frequency at which to calculate |
| 291 |
d : number or array-like |
| 292 |
length of line, in meters |
| 293 |
deg : Boolean |
| 294 |
return in degrees or not. |
| 295 |
|
| 296 |
Returns |
| 297 |
------- |
| 298 |
theta : number or array-like |
| 299 |
electrical length in radians or degrees, depending on value of deg. |
| 300 |
|
| 301 |
See Also |
| 302 |
-------- |
| 303 |
electrical_length_2_distance : opposite conversion |
| 304 |
|
| 305 |
Note |
| 306 |
---- |
| 307 |
The convention has been chosen that forward propagation is |
| 308 |
represented by the positive imaginary part of the value returned by |
| 309 |
the gamma function. |
| 310 |
""" |
| 311 |
|
| 312 |
if not callable(gamma): |
| 313 |
_gamma = gamma |
| 314 |
def gamma(f0): return _gamma |
| 315 |
|
| 316 |
|
| 317 |
f = array(f, dtype=float).reshape(-1) |
| 318 |
d = array(d, dtype=float).reshape(-1) |
| 319 |
|
| 320 |
if not deg: |
| 321 |
return gamma(f)*d |
| 322 |
else: |
| 323 |
return mf.radian_2_degree(gamma(f)*d ) |
| 324 |
|
| 325 |
|
| 326 |
def electrical_length_2_distance(theta: NumberLike, gamma: NumberLike, f0: NumberLike, deg: bool = True): |
| 327 |
r""" |
| 328 |
Convert electrical length to a physical distance. |
| 329 |
|
| 330 |
.. math:: |
| 331 |
d = \frac{\theta}{\gamma(f_0)} |
| 332 |
|
| 333 |
Parameters |
| 334 |
---------- |
| 335 |
theta : number or array-like |
| 336 |
electrical length. units depend on `deg` option |
| 337 |
gamma : number, array-like or function |
| 338 |
propagation constant. See Notes. |
| 339 |
If passed as a function, takes frequency in Hz as a sole argument. |
| 340 |
f0 : number or array-like |
| 341 |
frequency at which to calculate gamma |
| 342 |
deg : Boolean |
| 343 |
return in degrees or not. |
| 344 |
|
| 345 |
Returns |
| 346 |
------- |
| 347 |
d : number or array-like (real) |
| 348 |
physical distance in m |
| 349 |
|
| 350 |
Note |
| 351 |
---- |
| 352 |
The convention has been chosen that forward propagation is |
| 353 |
represented by the positive imaginary part of the value returned by |
| 354 |
the gamma function. |
| 355 |
|
| 356 |
See Also |
| 357 |
-------- |
| 358 |
distance_2_electrical_length: opposite conversion |
| 359 |
""" |
| 360 |
|
| 361 |
if not callable(gamma): |
| 362 |
_gamma = gamma |
| 363 |
def gamma(f0): return _gamma |
| 364 |
|
| 365 |
if deg: |
| 366 |
theta = mf.degree_2_radian(theta) |
| 367 |
return real(theta / gamma(f0)) |
| 368 |
|
| 369 |
|
| 370 |
def load_impedance_2_reflection_coefficient(z0: NumberLike, zl: NumberLike): |
| 371 |
r""" |
| 372 |
Reflection coefficient from a load impedance. |
| 373 |
|
| 374 |
Return the reflection coefficient for a given load impedance, and |
| 375 |
characteristic impedance. |
| 376 |
|
| 377 |
For a transmission line of characteristic impedance :math:`Z_0` |
| 378 |
terminated with load impedance :math:`Z_l`, the complex reflection |
| 379 |
coefficient is given by, |
| 380 |
|
| 381 |
.. math:: |
| 382 |
\Gamma = \frac {Z_l - Z_0}{Z_l + Z_0} |
| 383 |
|
| 384 |
Parameters |
| 385 |
---------- |
| 386 |
z0 : number or array-like |
| 387 |
characteristic impedance |
| 388 |
zl : number or array-like |
| 389 |
load impedance (aka input impedance) |
| 390 |
|
| 391 |
Returns |
| 392 |
------- |
| 393 |
gamma : number or array-like |
| 394 |
reflection coefficient |
| 395 |
|
| 396 |
See Also |
| 397 |
-------- |
| 398 |
Gamma0_2_zl : reflection coefficient to load impedance |
| 399 |
|
| 400 |
Note |
| 401 |
---- |
| 402 |
Inputs are typecasted to 1D complex array. |
| 403 |
""" |
| 404 |
|
| 405 |
z0 = array(z0, dtype=complex).reshape(-1) |
| 406 |
zl = array(zl, dtype=complex).reshape(-1) |
| 407 |
|
| 408 |
|
| 409 |
zl[(zl == np.inf)] = INF |
| 410 |
|
| 411 |
return ((zl - z0)/(zl + z0)) |
| 412 |
|
| 413 |
|
| 414 |
def reflection_coefficient_2_input_impedance(z0: NumberLike, Gamma: NumberLike): |
| 415 |
r""" |
| 416 |
Input impedance from a load reflection coefficient. |
| 417 |
|
| 418 |
Calculate the input impedance given a reflection coefficient and |
| 419 |
characteristic impedance. |
| 420 |
|
| 421 |
.. math:: |
| 422 |
Z_0 \left(\frac {1 + \Gamma}{1-\Gamma} \right) |
| 423 |
|
| 424 |
Parameters |
| 425 |
---------- |
| 426 |
Gamma : number or array-like |
| 427 |
complex reflection coefficient |
| 428 |
z0 : number or array-like |
| 429 |
characteristic impedance |
| 430 |
|
| 431 |
Returns |
| 432 |
------- |
| 433 |
zin : number or array-like |
| 434 |
input impedance |
| 435 |
|
| 436 |
""" |
| 437 |
|
| 438 |
Gamma = array(Gamma, dtype=complex).reshape(-1) |
| 439 |
z0 = array(z0, dtype=complex).reshape(-1) |
| 440 |
|
| 441 |
|
| 442 |
Gamma[(Gamma == 1)] = ONE |
| 443 |
|
| 444 |
return z0*((1.0 + Gamma)/(1.0 - Gamma)) |
| 445 |
|
| 446 |
|
| 447 |
def reflection_coefficient_at_theta(Gamma0: NumberLike, theta: NumberLike): |
| 448 |
r""" |
| 449 |
Reflection coefficient at a given electrical length. |
| 450 |
|
| 451 |
.. math:: |
| 452 |
\Gamma_{in} = \Gamma_0 e^{-2 \theta} |
| 453 |
|
| 454 |
Parameters |
| 455 |
---------- |
| 456 |
Gamma0 : number or array-like |
| 457 |
reflection coefficient at theta=0 |
| 458 |
theta : number or array-like |
| 459 |
electrical length (may be complex) |
| 460 |
|
| 461 |
Returns |
| 462 |
------- |
| 463 |
Gamma_in : number or array-like |
| 464 |
input reflection coefficient |
| 465 |
|
| 466 |
""" |
| 467 |
Gamma0 = array(Gamma0, dtype=complex).reshape(-1) |
| 468 |
theta = array(theta, dtype=complex).reshape(-1) |
| 469 |
return Gamma0 * exp(-2*theta) |
| 470 |
|
| 471 |
|
| 472 |
def input_impedance_at_theta(z0: NumberLike, zl: NumberLike, theta: NumberLike): |
| 473 |
""" |
| 474 |
Input impedance from load impedance at a given electrical length. |
| 475 |
|
| 476 |
Input impedance of load impedance zl at a given electrical length, |
| 477 |
given characteristic impedance z0. |
| 478 |
|
| 479 |
Parameters |
| 480 |
---------- |
| 481 |
z0 : number or array-like |
| 482 |
characteristic impedance |
| 483 |
zl : number or array-like |
| 484 |
load impedance |
| 485 |
theta : number or array-like |
| 486 |
electrical length of the line (may be complex) |
| 487 |
|
| 488 |
Returns |
| 489 |
------- |
| 490 |
zin : number or array-like |
| 491 |
input impedance at theta |
| 492 |
|
| 493 |
""" |
| 494 |
Gamma0 = load_impedance_2_reflection_coefficient(z0=z0, zl=zl) |
| 495 |
Gamma_in = reflection_coefficient_at_theta(Gamma0=Gamma0, theta=theta) |
| 496 |
return reflection_coefficient_2_input_impedance(z0=z0, Gamma=Gamma_in) |
| 497 |
|
| 498 |
|
| 499 |
def load_impedance_2_reflection_coefficient_at_theta(z0: NumberLike, zl: NumberLike, theta: NumberLike): |
| 500 |
""" |
| 501 |
Reflection coefficient of load at a given electrical length. |
| 502 |
|
| 503 |
Reflection coefficient of load impedance zl at a given electrical length, |
| 504 |
given characteristic impedance z0. |
| 505 |
|
| 506 |
Parameters |
| 507 |
---------- |
| 508 |
z0 : number or array-like |
| 509 |
characteristic impedance. |
| 510 |
zl : number or array-like |
| 511 |
load impedance |
| 512 |
theta : number or array-like |
| 513 |
electrical length of the line (may be complex). |
| 514 |
|
| 515 |
Returns |
| 516 |
------- |
| 517 |
Gamma_in : number or array-like |
| 518 |
input reflection coefficient at theta |
| 519 |
|
| 520 |
""" |
| 521 |
Gamma0 = load_impedance_2_reflection_coefficient(z0=z0, zl=zl) |
| 522 |
Gamma_in = reflection_coefficient_at_theta(Gamma0=Gamma0, theta=theta) |
| 523 |
return Gamma_in |
| 524 |
|
| 525 |
|
| 526 |
def reflection_coefficient_2_input_impedance_at_theta(z0: NumberLike, Gamma0: NumberLike, theta: NumberLike): |
| 527 |
""" |
| 528 |
Input impedance from load reflection coefficient at a given electrical length. |
| 529 |
|
| 530 |
Calculate the input impedance at electrical length theta, given a |
| 531 |
reflection coefficient and characteristic impedance of the medium. |
| 532 |
|
| 533 |
Parameters |
| 534 |
---------- |
| 535 |
z0 : number or array-like |
| 536 |
characteristic impedance. |
| 537 |
Gamma: number or array-like |
| 538 |
reflection coefficient |
| 539 |
theta: number or array-like |
| 540 |
electrical length of the line, (may be complex) |
| 541 |
|
| 542 |
Returns |
| 543 |
------- |
| 544 |
zin: number or array-like |
| 545 |
input impedance at theta |
| 546 |
|
| 547 |
""" |
| 548 |
Gamma_in = reflection_coefficient_at_theta(Gamma0=Gamma0, theta=theta) |
| 549 |
zin = reflection_coefficient_2_input_impedance(z0=z0, Gamma=Gamma_in) |
| 550 |
return zin |
| 551 |
|
| 552 |
|
| 553 |
def reflection_coefficient_2_propagation_constant(Gamma_in: NumberLike, Gamma_l: NumberLike, d: NumberLike): |
| 554 |
r""" |
| 555 |
Propagation constant from line input and load reflection coefficients. |
| 556 |
|
| 557 |
Calculate the propagation constant of a line of length d, given the |
| 558 |
reflection coefficient and characteristic impedance of the medium. |
| 559 |
|
| 560 |
.. math:: |
| 561 |
\Gamma_{in} = \Gamma_l e^{-2 j \gamma \cdot d} |
| 562 |
\to \gamma = -\frac{1}{2 d} \ln \left ( \frac{ \Gamma_{in} }{ \Gamma_l } \right ) |
| 563 |
|
| 564 |
Parameters |
| 565 |
---------- |
| 566 |
Gamma_in : number or array-like |
| 567 |
input reflection coefficient |
| 568 |
Gamma_l : number or array-like |
| 569 |
load reflection coefficient |
| 570 |
d : number or array-like |
| 571 |
length of line, in meters |
| 572 |
|
| 573 |
Returns |
| 574 |
------- |
| 575 |
gamma : number (complex) or array-like |
| 576 |
propagation constant (see notes) |
| 577 |
|
| 578 |
Note |
| 579 |
---- |
| 580 |
The convention has been chosen that forward propagation is |
| 581 |
represented by the positive imaginary part of gamma. |
| 582 |
|
| 583 |
""" |
| 584 |
gamma = -1/(2*d) * np.log(Gamma_in/Gamma_l) |
| 585 |
|
| 586 |
|
| 587 |
gamma.imag = gamma.imag % (pi/d) |
| 588 |
|
| 589 |
return gamma |
| 590 |
|
| 591 |
|
| 592 |
def Gamma0_2_swr(Gamma0: NumberLike): |
| 593 |
r""" |
| 594 |
Standing Wave Ratio (SWR) for a given reflection coefficient. |
| 595 |
|
| 596 |
Standing Wave Ratio value is defined by: |
| 597 |
|
| 598 |
.. math:: |
| 599 |
VSWR = \frac{1 + |\Gamma_0|}{1 - |\Gamma_0|} |
| 600 |
|
| 601 |
Parameters |
| 602 |
---------- |
| 603 |
Gamma0 : number or array-like |
| 604 |
Reflection coefficient |
| 605 |
|
| 606 |
Returns |
| 607 |
------- |
| 608 |
swr : number or array-like |
| 609 |
Standing Wave Ratio. |
| 610 |
|
| 611 |
""" |
| 612 |
return (1 + np.abs(Gamma0)) / (1 - np.abs(Gamma0)) |
| 613 |
|
| 614 |
|
| 615 |
def zl_2_swr(z0: NumberLike, zl: NumberLike): |
| 616 |
r""" |
| 617 |
Standing Wave Ratio (SWR) for a given load impedance. |
| 618 |
|
| 619 |
Standing Wave Ratio value is defined by: |
| 620 |
|
| 621 |
.. math:: |
| 622 |
VSWR = \frac{1 + |\Gamma|}{1 - |\Gamma|} |
| 623 |
|
| 624 |
where |
| 625 |
|
| 626 |
.. math:: |
| 627 |
\Gamma = \frac{Z_L - Z_0}{Z_L + Z_0} |
| 628 |
|
| 629 |
Parameters |
| 630 |
---------- |
| 631 |
z0 : number or array-like |
| 632 |
line characteristic impedance [Ohm] |
| 633 |
zl : number or array-like |
| 634 |
load impedance [Ohm] |
| 635 |
|
| 636 |
Returns |
| 637 |
------- |
| 638 |
swr : number or array-like |
| 639 |
Standing Wave Ratio. |
| 640 |
|
| 641 |
""" |
| 642 |
Gamma0 = load_impedance_2_reflection_coefficient(z0, zl) |
| 643 |
return Gamma0_2_swr(Gamma0) |
| 644 |
|
| 645 |
|
| 646 |
def voltage_current_propagation(v1: NumberLike, i1: NumberLike, z0: NumberLike, theta: NumberLike): |
| 647 |
""" |
| 648 |
Voltages and currents calculated on electrical length theta of a transmission line. |
| 649 |
|
| 650 |
Give voltage v2 and current i1 at theta, given voltage v1 |
| 651 |
and current i1 at theta=0 and given characteristic parameters gamma and z0. |
| 652 |
|
| 653 |
:: |
| 654 |
|
| 655 |
i1 i2 |
| 656 |
○-->---------------------->--○ |
| 657 |
|
| 658 |
v1 gamma,z0 v2 |
| 659 |
|
| 660 |
○----------------------------○ |
| 661 |
|
| 662 |
<------------ d -------------> |
| 663 |
|
| 664 |
theta=0 theta |
| 665 |
|
| 666 |
Uses (inverse) ABCD parameters of a transmission line. |
| 667 |
|
| 668 |
Parameters |
| 669 |
---------- |
| 670 |
v1 : array-like (nfreqs,) |
| 671 |
total voltage at z=0 |
| 672 |
i1 : array-like (nfreqs,) |
| 673 |
total current at z=0, directed toward the transmission line |
| 674 |
z0: array-like (nfreqs,) |
| 675 |
characteristic impedance |
| 676 |
theta : number or array-like (nfreq, ntheta) |
| 677 |
electrical length of the line (may be complex). |
| 678 |
|
| 679 |
Return |
| 680 |
------ |
| 681 |
v2 : array-like (nfreqs, ntheta) |
| 682 |
total voltage at z=d |
| 683 |
i2 : array-like (nfreqs, ndtheta |
| 684 |
total current at z=d, directed outward the transmission line |
| 685 |
""" |
| 686 |
|
| 687 |
|
| 688 |
|
| 689 |
A = np.cosh(theta) |
| 690 |
B = z0*np.sinh(theta) |
| 691 |
C = np.sinh(theta)/z0 |
| 692 |
D = np.cosh(theta) |
| 693 |
|
| 694 |
|
| 695 |
ABCD = np.array([[A, B],[C, D]]).transpose() |
| 696 |
inv_ABCD = np.linalg.inv(ABCD).transpose() |
| 697 |
|
| 698 |
v2 = inv_ABCD[0,0] * v1 + inv_ABCD[0,1] * i1 |
| 699 |
i2 = inv_ABCD[1,0] * v1 + inv_ABCD[1,1] * i1 |
| 700 |
return v2, i2 |
| 701 |
|
| 702 |
|
| 703 |
def zl_2_total_loss(z0: NumberLike, zl: NumberLike, theta: NumberLike): |
| 704 |
r""" |
| 705 |
Total loss of a terminated transmission line (in natural unit). |
| 706 |
|
| 707 |
The total loss expressed in terms of the load impedance is [#]_ : |
| 708 |
|
| 709 |
.. math:: |
| 710 |
TL = \frac{R_{in}}{R_L} \left| \cosh \theta + \frac{Z_L}{Z_0} \sinh\theta \right|^2 |
| 711 |
|
| 712 |
Parameters |
| 713 |
---------- |
| 714 |
z0 : number or array-like |
| 715 |
characteristic impedance. |
| 716 |
zl : number or array-like |
| 717 |
load impedance |
| 718 |
theta : number or array-like |
| 719 |
electrical length of the line (may be complex). |
| 720 |
|
| 721 |
Returns |
| 722 |
------- |
| 723 |
total_loss: number or array-like |
| 724 |
total loss in natural unit |
| 725 |
|
| 726 |
References |
| 727 |
---------- |
| 728 |
.. [#] Steve Stearns (K6OIK), Transmission Line Power Paradox and Its Resolution. |
| 729 |
ARRL PacificonAntenna Seminar, Santa Clara, CA, October 10-12, 2014. |
| 730 |
https://www.fars.k6ya.org/docs/K6OIK-A_Transmission_Line_Power_Paradox_and_Its_Resolution.pdf |
| 731 |
|
| 732 |
""" |
| 733 |
Rin = np.real(zl_2_zin(z0, zl, theta)) |
| 734 |
total_loss = Rin/np.real(zl)*np.abs(np.cosh(theta) + zl/z0*np.sinh(theta))**2 |
| 735 |
return total_loss |
| 736 |
|
| 737 |
|
| 738 |
|
| 739 |
|
| 740 |
|
| 741 |
theta = electrical_length |
| 742 |
distance_2_electrical_length = electrical_length |
| 743 |
|
| 744 |
zl_2_Gamma0 = load_impedance_2_reflection_coefficient |
| 745 |
Gamma0_2_zl = reflection_coefficient_2_input_impedance |
| 746 |
|
| 747 |
zl_2_zin = input_impedance_at_theta |
| 748 |
zl_2_Gamma_in = load_impedance_2_reflection_coefficient_at_theta |
| 749 |
|
| 750 |
Gamma0_2_Gamma_in = reflection_coefficient_at_theta |
| 751 |
Gamma0_2_zin = reflection_coefficient_2_input_impedance_at_theta |