pmrf.models.lines
Classes
|
Overview |
|
Overview |
|
Overview |
|
Overview |
- class pmrf.models.lines.RLGCLine(length=1.0, *, name=None, separator='_', _z0=(50+0j), _param_groups=<factory>)[source]
Bases:
Model
Overview
An abstract base class for a transmission line defined by its per-unit-length RLGC (Resistance, Inductance, G, Conductance) parameters.
This class provides the fundamental equations to calculate the ABCD-matrix of a transmission line given its propagation constant (gamma) and characteristic impedance (Z_c), which are derived from the RLGC values.
Derived classes must implement the rlgc method, which defines how the four distributed parameters (R, L, G, C) behave as a function of frequency.
- Parameters:
length (Any)
name (str | None)
separator (str)
_z0 (complex)
_param_groups (list[ParameterGroup])
- abstractmethod rlgc(freq)[source]
Calculates the frequency-dependent RLGC parameters of the line.
This method must be implemented by any derived concrete class.
- Args:
freq (Frequency): The frequency axis at which to evaluate the parameters.
- Returns:
tuple: A tuple containing the R, L, G, and C parameter vectors, in that order.
- Parameters:
freq (Frequency)
- Return type:
tuple[Array, Array, Array, Array]
- class pmrf.models.lines.ConstantRLGCLine(length=1.0, R=0.0, L=2.8e-07, G=0.0, C=9e-11, *, name=None, separator='_', _z0=(50+0j), _param_groups=<factory>)[source]
Bases:
RLGCLine
Overview
An RLGC line with constant, frequency-independent per-unit-length parameters.
This is the simplest transmission line model, where R, L, G, and C are single scalar values.
Example
# Create a lossless 50-ohm line model # L and C are chosen to produce Z0=50 and epr=2.2 lossless_line = prf.models.ConstantRLGCLine(
L=368.8e-9, # nH/m C=147.5e-12, # pF/m length=0.1 # 10 cm
)
# Calculate its S-parameters over a frequency range freq = prf.Frequency(start=1, stop=5, npoints=101, unit=’ghz’) s = lossless_line.s(freq)
print(f”S21 magnitude at center frequency: {abs(s[freq.center_idx, 1, 0]):.3f}”) ```
- Parameters:
length (Any)
R (Any)
L (Any)
G (Any)
C (Any)
name (str | None)
separator (str)
_z0 (complex)
_param_groups (list[ParameterGroup])
- class pmrf.models.lines.DatasheetCoaxial(length=1.0, zn=50.0, epr=1.0, epr_slope=None, k1=0.0, k2=0.0, loss_coeffs_normalized=False, freq_bounds=None, *, name=None, separator='_', _z0=(50+0j), _param_groups=<factory>)[source]
Bases:
RLGCLine
Overview
A coaxial line defined by parameters typically found on a datasheet.
This model provides a convenient way to define a coaxial cable from its nominal impedance, dielectric constant, and loss factors, rather than from the fundamental RLGC values directly. It includes terms for both skin effect loss (k1) and dielectric loss (k2).
Example
```python import pmrf as prf import numpy as np
# Define a 1m coaxial cable from typical datasheet values cable = prf.models.DatasheetCoaxial(
zn=50.0, epr=2.1, k1=0.2, # Skin effect loss factor k2=0.01, # Dielectric loss factor length=1.0
)
freq = prf.Frequency(start=0.1, stop=10, npoints=201, unit=’ghz’) s = cable.s(freq)
# Plot the insertion loss # import matplotlib.pyplot as plt # plt.plot(freq.f_scaled, 20*np.log10(abs(s[:,1,0]))) # plt.xlabel(f”Frequency ({freq.unit})”) # plt.ylabel(“Insertion Loss (dB)”) # plt.grid(True) # plt.show() ```
- Parameters:
length (Any)
zn (Any)
epr (Any)
epr_slope (Parameter | None)
k1 (Any)
k2 (Any)
loss_coeffs_normalized (bool)
freq_bounds (tuple | None)
name (str | None)
separator (str)
_z0 (complex)
_param_groups (list[ParameterGroup])
- loss_coeffs_normalized: bool = False
- freq_bounds: tuple | None = None
- class pmrf.models.lines.PhysicalCoaxial(length=1.0, din=0.00112, dout=0.0032, epr=1.0, mur=1.0, tand=0.0, rho=1.68e-08, epr_model='constant', mur_model='constant', tand_model='constant', rho_model='constant', separate_rho=False, neglect_skin_inductance=False, *, name=None, separator='_', _z0=(50+0j), _param_groups=<factory>)[source]
Bases:
RLGCLine
Overview
A coaxial line defined directly by its physical and material properties.
This model calculates the RLGC parameters from the geometry (inner/outer diameters) and material properties (permittivity, permeability, loss tangent, resistivity). It provides a high-fidelity model that accounts for the skin effect in the conductors and frequency-dependent material properties.
Several material properties can be defined as frequency-dependent polynomials using the _model arguments (e.g., epr_model). The available models are: - ‘constant’: (Default) The parameter is a single scalar value. - ‘ppoly’: The parameter is a polynomial in the power basis. The Parameter
value should be a list of coefficients.
‘bpoly’: The parameter is a polynomial in the Bernstein basis. The Parameter value should be a list of coefficients.
Example
# A coaxial cable where the dielectric constant (epr) varies with frequency # We model epr as a 1st-order Bernstein polynomial (a line) # The coefficients are the start and end values of the line. phys_cable = prf.models.PhysicalCoaxial(
din=0.9e-3, dout=2.95e-3, epr=[2.1, 2.05], # epr goes from 2.1 to 2.05 over the freq range epr_model=’bpoly’, tand=0.0004, rho=1.72e-8, # Copper resistivity length=0.5
)
freq = prf.Frequency(start=1, stop=20, npoints=101, unit=’ghz’) s_phys = phys_cable.s(freq) ```
- Parameters:
length (Any)
din (Any)
dout (Any)
epr (Any)
mur (Any)
tand (Any)
rho (Any)
epr_model (str)
mur_model (str)
tand_model (str)
rho_model (str)
separate_rho (bool)
neglect_skin_inductance (bool)
name (str | None)
separator (str)
_z0 (complex)
_param_groups (list[ParameterGroup])
- epr_model: str = 'constant'
- mur_model: str = 'constant'
- tand_model: str = 'constant'
- rho_model: str = 'constant'
- separate_rho: bool = False
- neglect_skin_inductance: bool = False
- interpolated(param, freq)[source]
Evaluates a potentially frequency-dependent parameter.
- Args:
param (str): The name of the parameter to evaluate (e.g., ‘epr’). freq (Frequency): The frequency axis for the evaluation.
- Returns:
np.ndarray: The parameter’s value across the frequency axis.
- Parameters:
param (str)
freq (Frequency)
- Return type:
Array
- epr_f(freq)[source]
The relative permittivity (epsilon_r) as a function of frequency.
- Parameters:
freq (Frequency)
- Return type:
Array
- tand_f(freq)[source]
The loss tangent (tan_delta) as a function of frequency.
- Parameters:
freq (Frequency)
- Return type:
Array
- mur_f(freq)[source]
The relative permeability (mu_r) as a function of frequency.
- Parameters:
freq (Frequency)
- Return type:
Array
- rho_f(freq)[source]
The conductor resistivity (rho) as a function of frequency.
- Parameters:
freq (Frequency)
- Return type:
Array
- rhoin_f(freq)[source]
The inner conductor resistivity as a function of frequency.
- Parameters:
freq (Frequency)
- Return type:
Array
- rhoout_f(freq)[source]
The outer conductor resistivity as a function of frequency.
- Parameters:
freq (Frequency)
- Return type:
Array
- eps_f(freq)[source]
The complex permittivity (epsilon) as a function of frequency.
- Parameters:
freq (Frequency)
- Return type:
Array
- mu_f(freq)[source]
The complex permeability (mu) as a function of frequency.
- Parameters:
freq (Frequency)
- Return type:
Array
- L_prime(freq)[source]
The per-unit-length external inductance.
- Parameters:
freq (Frequency)
- Return type:
Array
- C_prime(freq)[source]
The per-unit-length capacitance.
- Parameters:
freq (Frequency)
- Return type:
Array
- G_diel(freq)[source]
The per-unit-length dielectric conductance.
- Parameters:
freq (Frequency)
- Return type:
Array
- R_skin(freq)[source]
The per-unit-length resistance due to skin effect.
- Parameters:
freq (Frequency)
- Return type:
Array
- L_skin(freq)[source]
The per-unit-length internal inductance due to skin effect.
- Parameters:
freq (Frequency)
- Return type:
Array