Microwave filters GUI  2.0.3
Public Member Functions | List of all members
libcommonfunc.Sparameters Class Reference

[S] parameters class. More...

Public Member Functions

def __init__
 Initialize frequency axis attributes and compute S parameters from Characteristic Polynomials.
def fromCharPolys
 Compute S-Parameters ( $S_{11}$, $S_{12}$, $S_{21}$, and $S_{22}$) from the characteristic polynomials.
def groupDelayfunc
 This function returns the group delay as defined in [Cameron eq.
def fromCouplingMatrix
 Compute S-Parameters ( $S_{21}$ and $S_{11}$) from a coupling matrix.
def energyPowerFromCM
 Compute stored energy and dissipated power at resonators and lossy couplings, from a coupling matrix.
def saveSparam
 Save [S] parameters in output file.

Detailed Description

[S] parameters class.

Definition at line 935 of file libcommonfunc.py.

Constructor & Destructor Documentation

def libcommonfunc.Sparameters.__init__ (   self,
  P,
  CP,
  FT,
  freq = None,
  checkPassive = True 
)

Initialize frequency axis attributes and compute S parameters from Characteristic Polynomials.

    @param P  = Parameters class instance, containing filter, synthesis and sweep parameters.
    @param CP = CharPolys  class instance, containing characteristic polynomials and constants.
    @param FT = Frequency transform class instance, containing methods to normalize frequency and unnormalize group delay.
    @param freq = Frequency axis (Hz). If equal to None, the frequency sweep based on P.minFreq, P.maxFreq and P.numFreq will be used. Default None.
    @param checkPassive = If checkPassive is True, a warning will be raised when there are [S] parameters larger than 0 dB. Default True.

    [S] parameters computed from characteristic polynomials.

\[ S_{11} = \frac{1}{\epsilon_R} \frac{F(s)}{E(s)} \]

\[ S_{21} = S_{12} = \frac{1}{\epsilon} \frac{P(s)}{E(s)} \]

\[ S_{22} = \frac{1}{\epsilon_R} \frac{F_{22}(s)}{E(s)} = (-1)^N \frac{1}{\epsilon_R} \frac{F(s)^*}{E(s)} \]

except for asymmetrical "Prescribed Insertion Loss technique" case 1 (kS21+kS11), where it is computed as

\[ S_{22} = k_{22} \left( 1 - \left( \frac{k_{21}}{k_{11}} \right) ^2 \right) + \left( \frac{k_{21}}{k_{11}} \right) ^2 S_{11} \]

In this "Prescribed Insertion Loss technique" case 1, the correct lossy values of $ S_{11} $ and $ S_{21} $ are obtained because $ \epsilon_R $ and $ \epsilon $ have been divided by $ k_{11} $ and $ k_{21} $ , respectively, when processing the polinomials at liblossyfilters.nonUniformQ() function . Fractional bandwidth of the FT used to compute this [S] parameters. Central frequency of the FT used to compute this [S] parameters. Frequency transform used to compute this [S] parameters. Frequency axis (Hz) Normalized $ \omega ' $ axis Dissipation factor. [Cameron eq. (3.118)] [TN 101.1 eq. (14)].

$ \sigma = \frac{f_0}{\Delta f} \frac{1}{Q_0} $ Complex frequency variable in normalized s-plane. $ s = \sigma + j \omega ' $ Parameter $ S_{11} $ computed from characteristic polynomials. $ S_{11} = \frac{1}{\epsilon_R} \frac{F(s)}{E(s)} $ Parameter $ S_{12} $ computed from characteristic polynomials. $ S_{12} = \frac{1}{\epsilon} \frac{P(s)}{E(s)} $ Parameter $ S_{21} $ computed from characteristic polynomials. $ S_{21} = \frac{1}{\epsilon} \frac{P(s)}{E(s)} $ Parameter $ S_{22} $ computed from characteristic polynomials. $ S_{22} = \frac{1}{\epsilon_R} \frac{F_{22}(s)}{E(s)} = (-1)^N \frac{1}{\epsilon_R} \frac{F(s)^*}{E(s)} $ [Cameron eq. (6.15) pp. 212]

except for asymmetrical "Prescribed Insertion Loss technique" case 1 (kS21+kS11), where it is computed as $ S_{22} = 1 - \left ( \frac{k_{21}}{k_{11}} \right) ^2 + \frac{k^2_{21}}{k_{11}k_{22}} S_{11_lossless} $ Group delay for the LowPass prototype Group delay for the unnormalized filter (sec) Phase of transfer function (rad) Phase of return losses (rad) Phase of inverse return losses (rad) Deviation from linear phase. It is the error between the phase of S21 and the straight line that best fits the phase in the center of the band in an interval equal to half the bandwidth. Parameter $ S_{11} $ computed from a coupling matrix. Parameter $ S_{21} $ computed from a coupling matrix. Parameter $ S_{22} $ computed from a coupling matrix. Power dissipated at resonators. 2-D numpy array of shape (Nf, Nr), where Nf is the number of frequencies and Nr the number of resonators. Energy stored at resonators. 2-D numpy array of shape (Nf, Nr), where Nf is the number of frequencies and Nr the number of resonators. Power dissipated at resistive couplings. Tuple ( (m, n), Gmn, powerDirect, powerReverse ) where power is a 1-D numpy array with one element for each frequency. Only entries n>m are stored. Energy stored at magnetic or electric couplings. Tuple ( (m, n), Bmn, energyDirect, energyReverse ) where energy is a 1-D numpy array with one element for each frequency. Only entries n>m are stored. Power dissipated at resonators, with reverse excitation. 2-D numpy array of shape (Nf, Nr), where Nf is the number of frequencies and Nr the number of resonators. Energy stored at resonators, with reverse excitation. 2-D numpy array of shape (Nf, Nr), where Nf is the number of frequencies and Nr the number of resonators.

Definition at line 965 of file libcommonfunc.py.

References libcommonfunc.Sparameters.deviationLP, libcommonfunc.Sparameters.energyCoup, libcommonfunc.Sparameters.energyRes, libcommonfunc.Sparameters.energyResRev, libcommonfunc.Sparameters.f0, libcommonfunc.Sparameters.FBW, libcommonfunc.Sparameters.freq, libcommonfunc.Sparameters.fromCharPolys(), libcommonfunc.Sparameters.FT, libcommonfunc.Sparameters.groupDelay, libcommonfunc.Sparameters.groupDelayfunc(), libcommonfunc.Sparameters.groupDelayLP, libcommonfunc.Sparameters.omega, libcommonfunc.Sparameters.phaseS11, libcommonfunc.Sparameters.phaseS21, libcommonfunc.Sparameters.phaseS22, libcommonfunc.Sparameters.powerCoup, libcommonfunc.Sparameters.powerRes, libcommonfunc.Sparameters.powerResRev, libcommonfunc.Sparameters.s, libcommonfunc.Sparameters.S11, libcommonfunc.Sparameters.S11M, libcommonfunc.Sparameters.S12, libcommonfunc.Sparameters.S21, libcommonfunc.Sparameters.S21M, libcommonfunc.Sparameters.S22, libcommonfunc.Sparameters.S22M, libcommonfunc.Sparameters.sigma, and libcommonfunc.warningMsg().

Here is the call graph for this function:

Member Function Documentation

def libcommonfunc.Sparameters.energyPowerFromCM (   self,
  MatQ 
)

Compute stored energy and dissipated power at resonators and lossy couplings, from a coupling matrix.

    Evaluation points are taken from attribute Sparameters.s .
    Output in atributes Sparameters.energyRes, Sparameters.powerRes , 
    which are 2D numpy arrays, each column is the energy(f) or power(f) at a resonator.
    @param MatQ = MatrixQ class instance, containing the coupling matrix to process.

    Dissipated power at \form#38-th resonator can be found as:

\[ P_i(f) = \frac{G_i}{2} |V_i(f)|^2 \]

being $ V_i $ the voltage at each resonator and $ G_i $ the conductance of unloaded resonators

\[ G_i = \frac{Z_0}{Q_i \mathrm{FBW}} \]

where $ Q_i $ is the quality factor, $ \mathrm{FBW} = \Delta f / f_0 $ is the filter fractional bandwidth and $ Z_0 $ is the characteristic impedance of the resonators.

The stored energy is:

\[ W_i(f) = \frac {Q_i P_i(f)}{2 \pi f_0} = \frac{Z_0}{4 \pi f_0 \, \mathrm{FBW}} |V_i(f)|^2 \]

    For resistive couplings between resonators \form#47 and \form#48, with conductance \form#49, the voltage drop at the coupling is \form#50 and, hence,
    the dissipated power becomes:

\[ P_{ij}(f) = \frac{G_{ij}}{2} \; |V_{ij}(f)|^2 \]

    Following [Pozar eq. (4.14) and (4.16)], the time harmonic complex power is

\[ P = \frac{1}{2} V I^* = \frac{1}{2} |V|^2 Y^* = Pd + 2 j \omega (W_m - W_e) \]

and, accounting that $ Y_{ij} = j M_{ij} $, the stored energy at magnetic or electric couplings between resonators $ i $ and $ j $, with susceptance $ B_{ij} = \Im Y_{ij} = \Re M_{ij} $, is

\[ W_{ij}(f) = W_m - W_e = \frac{B_{ij}}{4\omega} \; |V_{ij}(f)|^2 \]

    Voltages at each resonator for unitary current excitation at source port are obtained as:

\[ V(s)=Z(s) \, J(s) \]

where $ J(s) $ is the input current vector $ J(s) = [I_s \;\: 0 \ldots 0]^T $

If the input is matched, the input current is $ I_s = \sqrt{8 P_0 / Z_0} $. We will assume input power $ P_0 $ equal to 1 Watt.

The impedance matrix is computed as:

\[ Z(s)= \left( jM+sI+G \right)^{-1} \]

with $I $ a diagonal matrix with the node scaling factor squared in the diagonal except in the non-resonant nodes positions, where it is zero. It means putting zeros in the extraNodesS first positions of the diagonal and in the last extraNodesL positions.

\[ G = \begin{bmatrix} G_{S} & & & & \\ & 0 & & & \\ & & \ddots & & \\ & & & 0 & \\ & & & & G_{L}\end{bmatrix} \]

Definition at line 1408 of file libcommonfunc.py.

References libcommonfunc.Sparameters.energyCoup, libcommonfunc.Sparameters.energyRes, libcommonfunc.Sparameters.energyResRev, libcommonfunc.Sparameters.f0, libcommonfunc.Sparameters.FBW, libcommonfunc.Sparameters.freq, libcommonfunc.Sparameters.powerCoup, libcommonfunc.Sparameters.powerRes, libcommonfunc.Sparameters.powerResRev, libcommonfunc.Sparameters.s, and libcommonfunc.warningMsg().

Here is the call graph for this function:

def libcommonfunc.Sparameters.fromCharPolys (   self,
  P,
  evalS,
  Ps,
  Es,
  Fs,
  eps,
  epsR 
)

Compute S-Parameters ( $S_{11}$, $S_{12}$, $S_{21}$, and $S_{22}$) from the characteristic polynomials.

Evaluation points are taken from attribute Sparameters.s . This method will be called by the BW and TZs optimization routines. Output in atributes Sparameters.S11, Sparameters.S12, Sparameters.S21 and Sparameters.S22 .

Parameters
P= Parameters class instance, containing filter, synthesis and sweep parameters.
evalS= Vector with the normalized complex frequencies (s) where we want to compute the group delay.
Ps= Characteristic polynomial of the numerator of $S_{21}$.
Es= Characteristic polynomial of the denominator of $S_{11}$ and $S_{21}$.
Fs= Characteristic polynomial of the numerator of $S_{11}$.
eps= Characteristic constant $ \epsilon $ in the denominator of $ S_{12} $ and $ S_{21} $
epsR= Characteristic constant $ \epsilon_R $ in the denominator of $ S_{11} $

Definition at line 1154 of file libcommonfunc.py.

References libcommonfunc.Sparameters.S11, libcommonfunc.Sparameters.S12, libcommonfunc.Sparameters.S21, and libcommonfunc.Sparameters.S22.

Referenced by libcommonfunc.Sparameters.__init__().

Here is the caller graph for this function:

def libcommonfunc.Sparameters.fromCouplingMatrix (   self,
  MatQ,
  evalS = None,
  checkPassive = True 
)

Compute S-Parameters ( $S_{21}$ and $S_{11}$) from a coupling matrix.

    Evaluation points are taken from attribute Sparameters.s .
    Output in atributes Sparameters.S11M and Sparameters.S21M .
    @param MatQ = MatrixQ class instance, containing the coupling matrix to process.
    @param evalS = Normalized frequency axis (imaginary). If equal to None, it is set to 1j * np.imag(self.s). Default None.
    @param checkPassive = If checkPassive is True, a warning will be raised when there are [S] parameters larger than 0 dB. Default True.
    @return stErrorCM = String with a message about the error in [S] computed from M coupling matrix versus self.S11 and self.S21.
    @return CM_error = Relative error in [S] computed from M coupling matrix versus self.S11 and self.S21 (float).

    By definition, \form#29 and \form#30 can be found as:

\[ S_{21}(s) = 2\sqrt{R_{S}R_{L}} \, Z'_{N+2,1}(s) \]

\[ S_{11}(s) = 1 - 2R_{S}Z'_{1,1}(s) \]

\[ S_{22}(s) = 1 - 2R_{L}Z'_{N+2,N+2}(s) \]

where:

\[ Z'(s)=Y'(s)^{-1} \]

\[ Y'(s)=jM+sI+G \]

with $I $ a diagonal matrix with the node scaling factor squared in the diagonal except in the non-resonant nodes positions, where it is zero. It means putting zeros in the extraNodesS first positions of the diagonal and in the last extraNodesL positions.

\[ G = \begin{bmatrix} G_{S} & & & & \\ & 0 & & & \\ & & \ddots & & \\ & & & 0 & \\ & & & & G_{L}\end{bmatrix} \]

Todo:
Find out why sign of S11 from CM is opposite than from CP. The sign is changed below to force agreement with S11 from CP.

Phase of S11 return losses computed from coupling matrix Phase of S22 return losses computed from coupling matrix Phase of transfer function computed from coupling matrix Group delay computed from coupling matrix Frequency axis with sampling points in the middle of self.freq sampling. It is necessary to plot self.groupDelayM Group delay computed from Characteristic Polynomials, sampled at self.freq2 It is necessary to compare with self.groupDelayM

Definition at line 1223 of file libcommonfunc.py.

References libcommonfunc.Sparameters.freq, libcommonfunc.Sparameters.freq2, libcommonfunc.Sparameters.groupDelay, libcommonfunc.Sparameters.groupDelay2, libcommonfunc.Sparameters.groupDelayM, libcommonfunc.Sparameters.phaseS11M, libcommonfunc.Sparameters.phaseS21M, libcommonfunc.Sparameters.phaseS22M, libcommonfunc.Sparameters.S11, libcommonfunc.Sparameters.S11M, libcommonfunc.Sparameters.S21, libcommonfunc.Sparameters.S21M, libcommonfunc.Sparameters.S22, libcommonfunc.Sparameters.S22M, and libcommonfunc.warningMsg().

Here is the call graph for this function:

def libcommonfunc.Sparameters.groupDelayfunc (   self,
  Es,
  Ps,
  evalS 
)

This function returns the group delay as defined in [Cameron eq.

13.7, pp. 475-476] evaluated in the normalized complex frequency vector evalS .

Parameters
Es= Characteristic polynomial of the denominator of $S_{21}$ and $S_{11}$.
Ps= Characteristic polynomial of the numerator of $S_{21}$.
evalS= Vector with the normalized complex frequencies (s) where we want to compute the group delay.
Returns
groupD = Vector with the group delay at each frequency. The group delay is computed from the formula:

\[ \tau_{i}= Re\left[ \frac{E'(s_{i})}{E(s_{i})} - \frac{P'(s_{i})}{P(s_{i})} \right] \]

where $s_{i}$ are the frequency samples.

Definition at line 1188 of file libcommonfunc.py.

Referenced by libcommonfunc.Sparameters.__init__().

Here is the caller graph for this function:

def libcommonfunc.Sparameters.saveSparam (   self,
  P,
  prec 
)

Save [S] parameters in output file.

S11, S12, S21 and S22 are attributes of sParameters class, and of type numpy.array.

Parameters
P= Parameter class instance.
prec= Number of correct significant digits to print.

Definition at line 1519 of file libcommonfunc.py.

References libcommonfunc.complexStr(), libcommonfunc.Sparameters.freq, libcommonfunc.myPrint(), libcommonfunc.pkgNameVersion(), libcommonfunc.Sparameters.S11, libcommonfunc.Sparameters.S12, libcommonfunc.Sparameters.S21, and libcommonfunc.Sparameters.S22.

Here is the call graph for this function:


The documentation for this class was generated from the following file: