pmrf.models.lines

Classes

ConstantRLGCLine([length, R, L, G, C, name, ...])

Overview

DatasheetCoaxial([length, zn, epr, ...])

Overview

PhysicalCoaxial([length, din, dout, epr, ...])

Overview

RLGCLine([length, name, separator, _z0, ...])

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])

length: Parameter = 1.0
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]

a(freq)[source]

Calculates the ABCD-matrix from the line’s RLGC parameters.

Args:

freq (Frequency): The frequency axis for the calculation.

Returns:

np.ndarray: The resultant ABCD-matrix.

Parameters:

freq (Frequency)

Return type:

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

```python import pmrf as prf

# 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])

R: Parameter = 0.0
L: Parameter = 2.8e-07
G: Parameter = 0.0
C: Parameter = 9e-11
rlgc(_)[source]

Returns the constant RLGC parameters.

Args:

_ (Frequency): The frequency axis (ignored).

Returns:

tuple: The constant R, L, G, and C parameters.

Parameters:

_ (Frequency)

Return type:

tuple[Parameter, Parameter, Parameter, Parameter]

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])

zn: Parameter = 50.0
epr: Parameter = 1.0
epr_slope: Parameter | None = None
k1: Parameter = 0.0
k2: Parameter = 0.0
loss_coeffs_normalized: bool = False
freq_bounds: tuple | None = None
rlgc(freq)[source]

Calculates RLGC parameters from datasheet values.

Args:

freq (Frequency): The frequency axis for the calculation.

Returns:

tuple: The calculated R, L, G, and C parameter vectors.

Parameters:

freq (Frequency)

Return type:

tuple[Array, Array, Array, Array]

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

```python import pmrf as prf

# 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])

din: Parameter = 0.00112
dout: Parameter = 0.0032
epr: Parameter = 1.0
mur: Parameter = 1.0
tand: Parameter = 0.0
rho: Parameter = 1.68e-08
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:
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

Z_skin(freq)[source]

The per-unit-length internal impedance due to skin effect.

Parameters:

freq (Frequency)

rlgc(freq)[source]

Calculates RLGC parameters from physical and material properties.

Args:

freq (Frequency): The frequency axis for the calculation.

Returns:

tuple: The calculated R, L, G, and C parameter vectors.

Parameters:

freq (Frequency)

Return type:

tuple[Array, Array, Array, Array]