| 1 |
""" |
| 2 |
DefinedAEpTandZ0 (:mod:`skrf.media.definedAEpTandZ0`) |
| 3 |
====================================================== |
| 4 |
|
| 5 |
Transmission line medium defined by A, Ep, Tand and Z0. |
| 6 |
|
| 7 |
This medium is defined by attenuation A, relative permittivity Ep_r, |
| 8 |
loss angle tand and characteristic impedance Z0. |
| 9 |
|
| 10 |
Djirdjevic/Svennson dispersion model is provided for dielectric, default |
| 11 |
behaviour is frequency invariant. |
| 12 |
|
| 13 |
.. autosummary:: |
| 14 |
:toctree: generated/ |
| 15 |
|
| 16 |
DefinedAEpTandZ0 |
| 17 |
""" |
| 18 |
from __future__ import annotations |
| 19 |
|
| 20 |
import warnings |
| 21 |
from collections.abc import Sequence |
| 22 |
|
| 23 |
from numpy import imag, log, ndarray, ones, pi, real, sqrt |
| 24 |
from scipy.constants import c |
| 25 |
|
| 26 |
from ..constants import NumberLike |
| 27 |
from ..frequency import Frequency |
| 28 |
from .media import Media |
| 29 |
|
| 30 |
|
| 31 |
class DefinedAEpTandZ0(Media): |
| 32 |
r""" |
| 33 |
Transmission line medium defined by A, Ep, Tand and Z0. |
| 34 |
|
| 35 |
This medium is defined by attenuation `A`, relative permittivity `Ep_r`, |
| 36 |
loss angle `tand` and nominal impedance `Z0`. |
| 37 |
|
| 38 |
Djirdjevic [#Djordjevic]_ / Svennson [#Svensson]_ dispersion model |
| 39 |
is provided for dielectric. Default behaviour is frequency invariant. |
| 40 |
|
| 41 |
Parameters |
| 42 |
---------- |
| 43 |
frequency : :class:`~skrf.frequency.Frequency` object |
| 44 |
Frequency band of this transmission line medium |
| 45 |
z0_port : number, array-like, or None |
| 46 |
`z0_port` is the port impedance for networks generated by the media. |
| 47 |
If `z0_port` is not None, the networks generated by the media are |
| 48 |
renormalized (or in other words embedded) from the characteristic |
| 49 |
impedance z0 of the media to `z0_port`. |
| 50 |
Else if `z0_port` is None, the networks port impedances will be the raw |
| 51 |
characteristic impedance z0 of the media. |
| 52 |
(Default is None) |
| 53 |
A : number, array-like, default 0.0 |
| 54 |
Attenuation due to conductor loss in dB/m/sqrt(Hz) |
| 55 |
The attenuation :math:`A(f)` at frequency :math:`f` is: |
| 56 |
|
| 57 |
.. math:: |
| 58 |
|
| 59 |
A(f) = A\sqrt{\frac{f}{f_A}} |
| 60 |
|
| 61 |
f_A : number, default 1.0 |
| 62 |
Frequency scaling in Hz for the attenuation. See A. |
| 63 |
ep_r : number, array-like, default 1.0 |
| 64 |
Real part of the relative permittivity of the dielectric: |
| 65 |
:math:`\epsilon_r'=\Re[\epsilon]`. |
| 66 |
|
| 67 |
If `model='frequencyinvariant'`, the complex relative permittivity is: |
| 68 |
|
| 69 |
.. math:: |
| 70 |
|
| 71 |
\epsilon_r(f) = \epsilon'_r + j \cdot \epsilon'_r \cdot \tan\delta |
| 72 |
|
| 73 |
if `model='djordjevicsvensson'`, the complex relative permittivity is: |
| 74 |
|
| 75 |
.. math:: |
| 76 |
|
| 77 |
\epsilon_r(f) = \epsilon_\inf + m \cdot \ln{\frac{f_{high} + j f_\epsilon}{f_{low} + j f_\epsilon}} |
| 78 |
|
| 79 |
where :math:`\epsilon_\inf` is the permittivity value when frequency approaches infinity. |
| 80 |
In this case, the value of :math:`\epsilon_r` and :math:`\tan\delta` (tanD) |
| 81 |
are given for frequency :math:`f_\epsilon`: |
| 82 |
|
| 83 |
.. math:: |
| 84 |
|
| 85 |
\epsilon_r(f_\epsilon) = \epsilon'_r+ j \cdot \epsilon'_r \cdot \tan\delta |
| 86 |
|
| 87 |
tanD : number, array-like, default 0.0 |
| 88 |
Dielectric relative permittivity loss tangent :math:`\tan\delta`. See `ep_r`. |
| 89 |
z0 : number, array-like, default 50.0 |
| 90 |
Quasi-static nominal impedance of the medium. |
| 91 |
Because of the dispersion introduced by the conductor and dielectric |
| 92 |
losses, the characteristic impedance can be frequency-dependent with an |
| 93 |
imaginary part. The characteristic impedance is computed with an RLGC |
| 94 |
model. |
| 95 |
If the impedance parameter is array-like, the characteristic impedance |
| 96 |
is assigned to this value without modification. |
| 97 |
|
| 98 |
.. math:: |
| 99 |
|
| 100 |
R = 2 Z_n \alpha_{conductor} |
| 101 |
|
| 102 |
.. math:: |
| 103 |
|
| 104 |
L = \frac{Z_n \sqrt{\epsilon_r}}{C_0} |
| 105 |
|
| 106 |
.. math:: |
| 107 |
|
| 108 |
G = \frac{2}{Z_n} \alpha_{dielectric} |
| 109 |
|
| 110 |
.. math:: |
| 111 |
|
| 112 |
C = \frac{\sqrt{\epsilon_r}}{C_0 Z_n} |
| 113 |
|
| 114 |
.. math:: |
| 115 |
|
| 116 |
Z_0 = \sqrt{\frac{R + j\omega L}{G + j\omega C}} |
| 117 |
|
| 118 |
where :math:`Z_n` is the nominal impedance and :math:`Z_0` is the |
| 119 |
characteristic impedance. |
| 120 |
Z0 : number, array-like, or None |
| 121 |
deprecated parameter, only emit a deprecation warning. |
| 122 |
f_low : number, default 1e3, optional |
| 123 |
Low frequency in Hz for for Djordjevic/Svennson dispersion model. |
| 124 |
See `ep_r`. |
| 125 |
f_high : number, default 1e12, optional |
| 126 |
High frequency in Hz for for Djordjevic/Svennson dispersion model. |
| 127 |
See `ep_r`. |
| 128 |
f_ep : number, default 1e9, , optional |
| 129 |
Specification frequency in Hz for for Djirdjevic/Svennson dispersion model. |
| 130 |
`ep_r` and `tanD` parameters are specified for this frequency. See `ep_r`. |
| 131 |
model : string, 'frequencyinvariant' or 'djordjevicsvensson', optional |
| 132 |
Use Djirdjevic/Svennson wideband Debye dispersion model or not. |
| 133 |
Default is frequency invariant behaviour. |
| 134 |
\*args, \*\*kwargs : arguments and keyword arguments |
| 135 |
|
| 136 |
|
| 137 |
Examples |
| 138 |
-------- |
| 139 |
>>> from skrf.media.definedAEpTandZ0 import DefinedAEpTandZ0 |
| 140 |
>>> from skrf.frequency import Frequency |
| 141 |
>>> f = Frequency(75,110,101,'ghz') |
| 142 |
>>> DefinedAEpTandZ0(frequency=f, A=1, f_A=1e9, ep_r=3, z0=50) |
| 143 |
>>> DefinedAEpTandZ0(frequency=f, A=1, f_A=1e9, ep_r=3, tand=0.02, z0=50) |
| 144 |
>>> DefinedAEpTandZ0(frequency=f, A=1, f_A=1e9, ep_r=3, tand=0.02, z0=50, |
| 145 |
f_low=1e3, f_high=1e12, f_Ep=1e9, |
| 146 |
model='djordjevicsvensson') |
| 147 |
|
| 148 |
References |
| 149 |
---------- |
| 150 |
.. [#Svensson] C. Svensson and G. E. Dermer, "Time Domain Modeling of Lossy Interconnects," |
| 151 |
IEEE Trans. Advanced Packaging, Vol. 24, No. 2, May 2001. |
| 152 |
https://doi.org/10.1109/6040.928754 |
| 153 |
.. [#Djordjevic] A. R. Djordjevic, R. M. Biljic, V. D. Likar-Smiljanic, and T. K. Sarkar, |
| 154 |
"Wideband Frequency-Domain Characterization of FR-4 and Time-Domain Causality," |
| 155 |
IEEE Trans. Electromagnetic Compatibility, Vol. 43, No. 4, November 2001. |
| 156 |
https://doi.org/10.1109/15.974647 |
| 157 |
|
| 158 |
""" |
| 159 |
|
| 160 |
def __init__(self, frequency: Frequency| None = None, |
| 161 |
A: float = 0.0, f_A: float = 1.0, |
| 162 |
ep_r: NumberLike = 1.0, tanD: NumberLike = 0.0, |
| 163 |
z0_port: NumberLike | None = None, |
| 164 |
z0: float = 50.0, |
| 165 |
Z0: NumberLike | None = None, |
| 166 |
f_low: float = 1.0e3, f_high: float = 1.0e12, f_ep: float = 1.0e9, |
| 167 |
model: str = 'frequencyinvariant', *args, **kwargs): |
| 168 |
|
| 169 |
Media.__init__(self, frequency=frequency, z0_port=z0_port) |
| 170 |
self.A, self.f_A = A, f_A |
| 171 |
self.ep_r, self.tanD = ep_r, tanD |
| 172 |
|
| 173 |
self.f_low, self.f_high, self.f_ep = f_low, f_high, f_ep |
| 174 |
self.model = model |
| 175 |
|
| 176 |
if isinstance(z0, (Sequence, ndarray)): |
| 177 |
|
| 178 |
self.z0_characteristic = z0 |
| 179 |
else: |
| 180 |
|
| 181 |
|
| 182 |
self.Zn = z0 |
| 183 |
self.R = 2 * self.Zn * self.alpha_conductor |
| 184 |
self.L = self.Zn * sqrt(self.ep_r) / c |
| 185 |
self.G = 2 / self.Zn * self.alpha_dielectric |
| 186 |
self.C = sqrt(ep_r) / c / self.Zn |
| 187 |
self.z0_characteristic = sqrt( |
| 188 |
(self.R + 1j * self.frequency.w * self.L) / |
| 189 |
(self.G + 1j * self.frequency.w * self.C)) |
| 190 |
|
| 191 |
if Z0 is not None: |
| 192 |
|
| 193 |
warnings.warn( |
| 194 |
'Use of `Z0` in DefinedAEpTandZ0 initialization is deprecated.\n' |
| 195 |
'`Z0` has no effect. Use `z0` instead\n' |
| 196 |
'`Z0` will be removed in version 1.0', |
| 197 |
DeprecationWarning, stacklevel = 2) |
| 198 |
|
| 199 |
def __str__(self): |
| 200 |
f = self.frequency |
| 201 |
output = 'DefinedAEpTandZ0 medium. %i-%i %s. %i points'%\ |
| 202 |
(f.f_scaled[0], f.f_scaled[-1], f.unit, f.npoints) |
| 203 |
return output |
| 204 |
|
| 205 |
def __repr__(self): |
| 206 |
return self.__str__() |
| 207 |
|
| 208 |
@property |
| 209 |
def ep_r_f(self) -> NumberLike: |
| 210 |
""" |
| 211 |
Frequency dependent complex relative permittivity of dielectric. |
| 212 |
""" |
| 213 |
ep_r, tand = self.ep_r, self.tanD |
| 214 |
f_low, f_high, f_ep = self.f_low, self.f_high, self.f_ep |
| 215 |
f = self.frequency.f |
| 216 |
if self.model == 'djordjevicsvensson': |
| 217 |
|
| 218 |
k = log((f_high + 1j * f_ep) / (f_low + 1j * f_ep)) |
| 219 |
fd = log((f_high + 1j * f) / (f_low + 1j * f)) |
| 220 |
ep_d = -tand * ep_r / imag(k) |
| 221 |
|
| 222 |
ep_inf = ep_r * (1. + tand * real(k) / imag(k)) |
| 223 |
|
| 224 |
return ep_inf + ep_d * fd |
| 225 |
elif self.model == 'frequencyinvariant': |
| 226 |
return ones(self.frequency.f.shape) * (ep_r - 1j*ep_r*tand) |
| 227 |
else: |
| 228 |
raise ValueError('Unknown dielectric dispersion model') |
| 229 |
|
| 230 |
@property |
| 231 |
def tand_f(self) -> NumberLike: |
| 232 |
""" |
| 233 |
Frequency dependent dielectric loss factor. |
| 234 |
""" |
| 235 |
ep_r = self.ep_r_f |
| 236 |
return -imag(ep_r) / real(ep_r) |
| 237 |
|
| 238 |
@property |
| 239 |
def alpha_conductor(self) -> NumberLike: |
| 240 |
""" |
| 241 |
Losses due to conductor resistivity. |
| 242 |
""" |
| 243 |
A, f_A, f = self.A, self.f_A, self.frequency.f |
| 244 |
return A * log(10)/20 * sqrt(f/f_A) |
| 245 |
|
| 246 |
@property |
| 247 |
def alpha_dielectric(self) -> NumberLike: |
| 248 |
""" |
| 249 |
Losses due to dielectric |
| 250 |
""" |
| 251 |
ep_r, tand = real(self.ep_r_f), self.tand_f |
| 252 |
f = self.frequency.f |
| 253 |
return pi*sqrt(ep_r)*f/c * tand |
| 254 |
|
| 255 |
@property |
| 256 |
def beta_phase(self) -> NumberLike: |
| 257 |
""" |
| 258 |
Phase parameter |
| 259 |
""" |
| 260 |
ep_r, f = real(self.ep_r_f), self.frequency.f |
| 261 |
return 2*pi*f*sqrt(ep_r)/c |
| 262 |
|
| 263 |
@property |
| 264 |
def gamma(self) -> NumberLike: |
| 265 |
""" |
| 266 |
Propagation constant. |
| 267 |
|
| 268 |
See Also |
| 269 |
-------- |
| 270 |
alpha_conductor : calculates conductor losses |
| 271 |
alpha_dielectric: calculates dielectric losses |
| 272 |
beta_phase : calculates phase parameter |
| 273 |
""" |
| 274 |
beta = self.beta_phase |
| 275 |
alpha = self.alpha_conductor + self.alpha_dielectric |
| 276 |
return alpha + 1j*beta |
| 277 |
|
| 278 |
@property |
| 279 |
def z0_characteristic(self) -> NumberLike: |
| 280 |
""" |
| 281 |
Characteristic Impedance, :math:`z_0` |
| 282 |
|
| 283 |
Returns |
| 284 |
------- |
| 285 |
z0_characteristic : np.ndarray |
| 286 |
Characteristic Impedance in units of ohms |
| 287 |
""" |
| 288 |
return self._z0 |
| 289 |
|
| 290 |
@z0_characteristic.setter |
| 291 |
def z0_characteristic(self, val): |
| 292 |
self._z0 = val |