예제 #1
0
    def __init__(self,
                 f=None,
                 DUTSParameters=None,
                 PortConnectionList=None,
                 args=None,
                 callback=None,
                 cacheFileName=None):
        """constructor  
        frequencies may be provided at construction time (or not for symbolic solutions).
        @param f (optional) list of frequencies
        @param DUTSParameters (optional) instance of class SParameters containing the DUT.
        If None is supplied, the file already in the schematic will be used, otherwise these
        will replace the DUT s-parameters.
        @param PortConnectionList (optional) list of True or False for each port in the
        network analyzer indicating a DUT port connection.  If None is supplied, then all
        network analyzer ports are used.
        @param args (optional) string arguments for the circuit.
        @param callback (optional) function taking one argument as a callback
        @param cacheFileName (optional) string name of file used to cache results

        Arguments are provided on a line as pairs of names and values separated by a space.

        The optional callback is used as described in the class CallBacker.

        The use of the cacheFileName is described in the class LineCache

        """
        self.PortConnectionList = PortConnectionList
        self.DutSParameters = SParameters(DUTSParameters.m_f,
                                          DUTSParameters.m_d)
        SimulatorNumericParser.__init__(self, f, args, callback, cacheFileName)
예제 #2
0
    def SParameters(self):
        """SParameters
        @return list of list of lists representing the transfer matrices as s-parameters.
        @note that transfer matrices are actually very much like s-parameters because they
        provide the complex frequency-domain relationship between an input and output at the
        given frequencies.  The only actual difference is that an s-parameter matrix must be
        square while transfer parameter matrices can be rectangular.

        s-parameters make it convenient for writing and viewing transfer matrices, so this
        format is provided.  The transfer matrices converted to s-parameters will have a square
        matrix whose row and column length is the maximum of the row and column length of a
        transfer matrix.
        """
        # pragma: silent exclude
        from SignalIntegrity.Lib.SParameters.SParameters import SParameters
        # pragma: include
        if self.Inputs == self.Outputs:
            return SParameters(self.f, self)
        else:
            squareMatrices = []
            P = max(self.Inputs, self.Outputs)
            for transferMatrix in self:
                squareMatrix = zeros((P, P), complex).tolist()
                for r in range(len(transferMatrix)):
                    for c in range(len(transferMatrix[0])):
                        squareMatrix[r][c] = transferMatrix[r][c]
                squareMatrices.append(squareMatrix)
            return SParameters(self.f, squareMatrices)
    def __init__(self,f,Rp,Rsep,Lp,Gp,Cp,dfp,Rn,Rsen,Ln,Gn,Cn,dfn,Z0=50.,K=0):
        """Constructor

        ports are 1,2,3,4 is +1,-1, +2, -2

        @param f list of float frequencies
        @param Rp float DC resistance of positive leg (ohms)
        @param Rsep float skin-effect resistance of positive leg (ohms/sqrt(Hz))
        @param Lp float inductance of positive leg (H)
        @param Gp float DC conductance of positive leg to ground (S)
        @param Cp float capacitance of positive leg to ground (F)
        @param dfp float dissipation factor (loss-tangent) of capacitance of positive leg to ground
        @param Rn float DC resistance of negative leg (ohms)
        @param Rsen float skin-effect resistance of negative leg (ohms/sqrt(Hz))
        @param Ln float inductance of negative leg (H)
        @param Gn float DC conductance of negative leg to ground (S)
        @param Cn float capacitance of negative leg to ground (F)
        @param dfn float dissipation factor (loss-tangent) of capacitance of negative leg to ground
        @param Z0 (optional) float reference impedance (defaults to 50 ohms)
        @param K (optional) integer number of sections (defaults to 0).
        If 0 is specified, then an analytic solution is provided otherwise an approximate solution is provided
        with all parametric values divided into the integer number of sections.
        """
        # pragma: silent exclude
        from SignalIntegrity.Lib.Parsers.SystemDescriptionParser import SystemDescriptionParser
        from SignalIntegrity.Lib.SystemDescriptions.SystemSParametersNumeric import SystemSParametersNumeric
        from SignalIntegrity.Lib.SParameters.Devices.TLineTwoPortRLGC import TLineTwoPortRLGC
        # pragma: include
        sdp=SystemDescriptionParser()
        sdp.AddLines(['device TP 2','device TN 2',
                      'port 1 TP 1 2 TN 1 3 TP 2 4 TN 2'])
        self.m_sspn=SystemSParametersNumeric(sdp.SystemDescription())
        self.m_spdl=[('TP',TLineTwoPortRLGC(f,Rp,Rsep,Lp,Gp,Cp,dfp,Z0,K)),
                     ('TN',TLineTwoPortRLGC(f,Rn,Rsen,Ln,Gn,Cn,dfn,Z0,K))]
        SParameters.__init__(self,f,None,Z0)
 def __init__(self, sp, port, timelen, method='estimated'):
     """Constructor
     @param sp instance of class SParameters of the device
     @param port integer 1 based port to calculate
     @param timelen float time to peel
     @param method string determining method for computing impedance profile
     @remark methods include:
     'estimated' (default) estimate the impedance profile from simulated step response.
     'approximate' use the approximation based on the simulated step response.
     'exact' use the impedance peeling algorithm.
     """
     # pragma: silent exclude
     if timelen == 0.0:
         # if the time length is zero, make a zero length transmission line
         SParameters.__init__(
             self, sp.m_f,
             [TLineTwoPortLossless(50., 0, f) for f in sp.m_f])
         return
     # pragma: include
     ip = ImpedanceProfileWaveform(sp, port, method, includePortZ=False)
     Ts = 1. / ip.td.Fs
     sections = int(math.floor(timelen / Ts + 0.5))
     tp1 = [identity(2) for n in range(len(sp.f()))]
     for k in range(sections):
         tp1 = [
             tp1[n].dot(
                 array(S2T(TLineTwoPortLossless(ip[k], Ts, sp.m_f[n]))))
             for n in range(len(sp.m_f))
         ]
     SParameters.__init__(self, sp.m_f, [T2S(tp.tolist()) for tp in tp1])
예제 #5
0
 def _CalculateUnknownThruErrorTerms(self,measurements):
     """calculates the unknown thru standards for each unknown thru measurement.
     @param measurements list of list of calibration measurements where each column corresponds to
     a driven port and each row corresponds to a measured port.
     @remark measurements is affected by this function and the returned measurements should be used
     subsequently.  Unknown thru measurements create thru measurements using the recovered thru standards.
     """
     for other in range(self.ports):
         for driven in range(self.ports):
             if (other != driven):
                 for meas in measurements[other][driven]:
                     if meas.type=='reciprocal':
                         Sestsp= [s for s in meas.S] if not (meas.S is None)\
                             else [Thru() for _ in range(len(self.f))]
                         for n in range(len(self.f)):
                             Sestsp[n]=self[n].UnknownThruCalibration(
                                 meas.Smeasured[n],
                                 Sestsp[n] if not meas.S is None
                                 else Sestsp[max(n-1,0)],driven,other)
                         Sest=SParameters(self.f,Sestsp)
                         Sest=Sest.LimitImpulseResponseLength(meas.limit)
                         # pragma: silent exclude
                         #Sest.WriteToFile('RecoveredThru')
                         # pragma: include
                         measurements[other][driven].append(
                             ThruCalibrationMeasurement(
                             meas.Smeasured.FrequencyResponse(1,1),
                             meas.Smeasured.FrequencyResponse(2,1),
                             Sest,other,driven))
                         measurements[driven][other].append(
                             ThruCalibrationMeasurement(
                             meas.Smeasured.FrequencyResponse(2,2),
                             meas.Smeasured.FrequencyResponse(1,2),
                             Sest.PortReorder([1,0]),driven,other))
예제 #6
0
 def __init__(self, sp, timelen, method='estimated'):
     """Constructor
     @param sp instance of class SParameters of the device
     @param timelen list of float times to peel, one for each port
     @param method string determining method for computing impedance profile
     @remark methods include:
     'estimated' (default) estimate the impedance profile from simulated step response.
     'approximate' use the approximation based on the simulated step response.
     'exact' use the impedance peeling algorithm.
     """
     # pragma: silent exclude
     if all([t == 0.0 for t in timelen]):
         SParameters.__init__(self, sp.m_f, sp.m_d)
         return
     # pragma: include
     spp = [
         PeeledPortSParameters(sp, p + 1, timelen[p], method)
         for p in range(sp.m_P)
     ]
     sddp = DeembedderParser().AddLine('unknown S ' + str(sp.m_P))
     for ps in [str(p + 1) for p in range(sp.m_P)]:
         sddp.AddLines([
             'device D' + ps + ' 2', 'connect D' + ps + ' 2 S ' + ps,
             'port ' + ps + ' D' + ps + ' 1'
         ])
     sddn = DeembedderNumeric(sddp.SystemDescription())
     spd = []
     for n in range(len(sp)):
         for p in range(sp.m_P):
             sddn.AssignSParameters('D' + str(p + 1), spp[p][n])
         spd.append(sddn.CalculateUnknown(sp[n]))
     SParameters.__init__(self, sp.m_f, spd)
예제 #7
0
 def __init__(self,
              f,
              filename,
              etfilename,
              portListstring=None,
              calculate=True):
     """Constructor  
     Calculates calibrated or raw s-parameters from a network analyzer.
     @param f list of frequencies to calculate s-parameters
     @param filename string filename containing (usually raw) s-parameters.
     @param etfilename string filename containing error-terms (see Calibration).
     @param portListstring (optional, defaults to None) string containing comma delimited list
     of one-based port numbers to use.  This is so that the error-terms from a large port count calibration
     can be used to make a smaller measurement on less ports, and for port reordering.  Essentially, this
     is the list of network analyzer ports used for the measurement.
     @param calculate (optional, defaults to True) bool that defines the calculation direction.  If calculate
     is True, then the assumption is that the s-parameters provided are raw and the goal is to convert the
     raw s-parameters to calibrated s-parameters.  In the unusual situation where calculate is False, the direction
     is reversed and the assumption is that the s-parameters provided are calibrated and the goal is to convert the
     calibrated s-parameters to raw s-parameters.
     """
     if portListstring != None:
         portlist = [int(p) - 1 for p in portListstring.split(',')]
     else:
         portlist = None
     spraw = SParameterFile(filename).Resample(f)
     calibration = Calibration(0, 0).ReadFromFile(etfilename)
     fixtures = calibration.Fixtures()
     fixtures = [fixture.Resample(f) for fixture in fixtures]
     calibration.InitializeFromFixtures(fixtures)
     if calculate:
         dut = calibration.DutCalculation(spraw, portlist)
     else:
         dut = calibration.DutUnCalculation(spraw, portlist)
     SParameters.__init__(self, f, dut)
예제 #8
0
 def __init__(self,
              f,
              offsetDelay=0.0,
              offsetZ0=50.0,
              offsetLoss=0.0,
              terminationZ0=50.0):
     """Constructor
     @param f list of frequencies
     @param offsetDelay (optional) float electrical length of offset in s (defaults to 0 s)
     @param offsetZ0 (optional) float real characteristic impedance of offset (defaults to 50 ohms)
     @param offsetLoss (optional) float loss due to skin-effect defined in Gohms/s at 1 GHz (defaults to 0).
     @param terminationZ0 (optional) float real impedance of termination.
     The result is that the class becomes the base-class SParameters with the s-parameters
     of a load standard.
     """
     # pragma: silent exclude
     from SignalIntegrity.Lib.Parsers.SystemDescriptionParser import SystemDescriptionParser
     # pragma: include
     sspn = SystemSParametersNumeric(SystemDescriptionParser().AddLines([
         'device offset 2', 'device R 1', 'port 1 offset 1',
         'connect offset 2 R 1'
     ]).SystemDescription())
     offsetSParameters = Offset(f, offsetDelay, offsetZ0, offsetLoss)
     terminationSParameters = TerminationZ(terminationZ0)
     sp = []
     for n in range(len(f)):
         sspn.AssignSParameters('offset', offsetSParameters[n])
         sspn.AssignSParameters('R', terminationSParameters)
         sp.append(sspn.SParameters())
     SParameters.__init__(self, f, sp)
예제 #9
0
 def __init__(self, f, R, Rse, L, G, C, df, Z0=50., K=0, scale=1.):
     """Constructor
     @param f list of float frequencies
     @param R float DC series resistance (ohms)
     @param Rse float series skin-effect resistance (ohms/sqrt(Hz))
     @param L float series inductance (H)
     @param G float DC conductance to ground (S)
     @param C float capacitance to ground (F)
     @param df float dissipation factor (loss-tangent) of capacitance to ground
     @param Z0 (optional) float reference impedance (defaults to 50 ohms)
     @param K (optional) integer number of sections (defaults to zero)
     @param scale (optional) float amount to scale the line by (assuming all other values are per unit)
     @note K=0 specifies the analytic transmission line calculation TLineTwoPortRLGCAnalytic.\n
     Otherwise, non-zero K specifies the numerical approximation TLineTwoPortRLGCApproximate.\n
     """
     # pragma: silent exclude
     from SignalIntegrity.Lib.SParameters.Devices.TLineTwoPortRLGCAnalytic import TLineTwoPortRLGCAnalytic
     from SignalIntegrity.Lib.SParameters.Devices.TLineTwoPortRLGCApproximate import TLineTwoPortRLGCApproximate
     # pragma: include
     if K == 0:
         self.sp = TLineTwoPortRLGCAnalytic(f, R, Rse, L, G, C, df, Z0,
                                            scale)
     else:
         self.sp = TLineTwoPortRLGCApproximate(f, R, Rse, L, G, C, df, Z0,
                                               K, scale)
     SParameters.__init__(self, f, None, Z0)
예제 #10
0
 def __init__(self, f, L, Z0=50.):
     """Constructor
     @param f list of float frequencies
     @param L float inductance
     @param Z0 (optional) float of complex reference impedance (defaults to 50 ohms)
     """
     self.m_L = L
     SParameters.__init__(self, f, None, Z0)
예제 #11
0
    def __init__(self,
                 f,
                 R,
                 Rse,
                 L,
                 G,
                 C,
                 df,
                 Cm,
                 dfm,
                 Gm,
                 Lm,
                 Z0=50.,
                 K=0,
                 scale=1.):
        """Constructor

        ports are 1,2,3,4 is +1,-1, +2, -2

        @param f list of float frequencies
        @param R float DC resistance of both legs (ohms)
        @param Rse float skin-effect resistance of both legs (ohms/sqrt(Hz))
        @param L float inductance of both legs (H)
        @param G float DC conductance of both legs to ground (S)
        @param C float capacitance of both legs to ground (F)
        @param df float dissipation factor (loss-tangent) of capacitance of both legs to ground
        @param Cm float mutual capacitance (F)
        @param dfm float dissipation factor (loss-tangent) of mutual capacitance (F)
        @param Gm float mutual conductance (S)
        @param Lm float mutual inductance (H)
        @param Z0 (optional) float reference impedance (defaults to 50 ohms)
        @param K (optional) integer number of sections (defaults to 0).
        @param scale (optional) float amount to scale the line by (assuming all other values are per unit)
        If 0 is specified, then an analytic solution is provided otherwise an approximate solution is provided
        with all parametric values divided into the integer number of sections.
        """
        # pragma: silent exclude
        from SignalIntegrity.Lib.Parsers.SystemDescriptionParser import SystemDescriptionParser
        from SignalIntegrity.Lib.SystemDescriptions.SystemSParametersNumeric import SystemSParametersNumeric
        from SignalIntegrity.Lib.SParameters.Devices.TLineTwoPortRLGC import TLineTwoPortRLGC
        # pragma: include
        sdp = SystemDescriptionParser()
        sdp.AddLines([
            'device L 4 mixedmode', 'device R 4 mixedmode', 'device TE 2',
            'device TO 2', 'port 1 L 1 2 L 2 3 R 1 4 R 2', 'connect L 3 TO 1',
            'connect R 3 TO 2', 'connect L 4 TE 1', 'connect R 4 TE 2'
        ])
        self.m_sspn = SystemSParametersNumeric(sdp.SystemDescription())
        self.m_spdl = [
            ('TE', TLineTwoPortRLGC(f, R, Rse, L + Lm, G, C, df, Z0, K,
                                    scale)),
            ('TO',
             TLineTwoPortRLGC(f, R, Rse, L - Lm, G + 2 * Gm, C + 2 * Cm,
                              (C * df + 2 * Cm * dfm) / (C + 2 * Cm), Z0, K,
                              scale))
        ]
        SParameters.__init__(self, f, None, Z0)
예제 #12
0
 def __init__(self, f, L, Z0=50.):
     """Constructor
     @param f list of float frequencies
     @param L float inductance
     @param Z0 (optional) float of complex reference impedance (defaults to 50 Ohms)
     @return the list of list s-parameter matrix for a termination inductance
     """
     self.m_L = L
     SParameters.__init__(self, f, None, Z0)
예제 #13
0
 def __init__(self,f,Rse,Z0=50.):
     """Constructor
     @param f list of float frequencies
     @param Rse float resistance specified as Ohms/sqrt(Hz)
     @param Z0 (optional) float of complex reference impedance (defaults to 50 Ohms)
     @note a skin-effect resistance is simply a resistance that is proportional to 
     the square-root of the frequency."""
     self.m_Rse=Rse
     SParameters.__init__(self,f,None,Z0)
예제 #14
0
    def __init__(self, f, R, Rse, L, G, C, df, Z0=50., K=0, scale=1.):
        """Constructor
        @param f list of float frequencies
        @param R float DC series resistance (ohms)
        @param Rse float series skin-effect resistance (ohms/sqrt(Hz))
        @param L float series inductance (H)
        @param G float DC conductance to ground (S)
        @param C float capacitance to ground (F)
        @param df float dissipation factor (loss-tangent) of capacitance to ground
        @param Z0 (optional) float reference impedance (defaults to 50 ohms)
        @param K (optional) integer number of sections (defaults to zero)
        @param scale (optional) float amount to scale the line by (assuming all other values are per unit)
        @note If K=0 is specified, it is modified to a value that will provided a very good numerical
        approximation.

        The calculation is such that round-trip propagation time (twice the electrical length)
        of any one small section is no more than one percent of the fastest possible risetime.
        """
        R = R * scale
        Rse = Rse * scale
        L = L * scale
        G = G * scale
        C = C * scale
        df = df
        K = int(K * scale + 0.5)
        if K == 0:
            """max possible electrical length"""
            Td = math.sqrt(L * C)
            Rt = 0.45 / f[-1]  # fastest risetime
            """sections such that fraction of risetime less than round trip
            electrical length of one section"""
            K = int(math.ceil(Td * 2 / (Rt * self.rtFraction)))

        self.m_K = K
        # pragma: silent exclude
        from SignalIntegrity.Lib.Devices import SeriesZ
        from SignalIntegrity.Lib.Devices import TerminationG
        from SignalIntegrity.Lib.SParameters.Devices.TerminationC import TerminationC
        from SignalIntegrity.Lib.SParameters.Devices.SeriesL import SeriesL
        from SignalIntegrity.Lib.SParameters.Devices.SeriesRse import SeriesRse
        from SignalIntegrity.Lib.SystemDescriptions.SystemSParametersNumeric import SystemSParametersNumeric
        from SignalIntegrity.Lib.Parsers.SystemDescriptionParser import SystemDescriptionParser
        # pragma: include
        sdp = SystemDescriptionParser().AddLines([
            'device R 2', 'device Rse 2', 'device L 2', 'device C 1',
            'device G 1', 'connect R 2 Rse 1', 'connect Rse 2 L 1',
            'connect L 2 G 1 C 1', 'port 1 R 1 2 G 1'
        ])
        self.m_sspn = SystemSParametersNumeric(sdp.SystemDescription())
        self.m_sspn.AssignSParameters('R', SeriesZ(R / K, Z0))
        self.m_sspn.AssignSParameters('G', TerminationG(G / K, Z0))
        self.m_spdl = [('Rse', SeriesRse(f, Rse / K, Z0)),
                       ('L', SeriesL(f, L / K, Z0)),
                       ('C', TerminationC(f, C / K, Z0, df))]
        SParameters.__init__(self, f, None, Z0)
 def __init__(self, f, L0=0.0, L1=0.0, L2=0.0, L3=0.0, Z0=50.):
     """Constructor
     @param f list of frequencies for the s-parameters
     @param L0 (optional) float polynomial term for f^0 (defaults to 0.0).
     @param L1 (optional) float polynomial term for f^1 (defaults to 0.0).
     @param L2 (optional) float polynomial term for f^2 (defaults to 0.0).
     @param L3 (optional) float polynomial term for f^3 (defaults to 0.0).
     @param Z0 (optional) real or complex reference impedance Z0 (defaults to 50 Ohms).
     """
     TerminationPolynomial.__init__(self, L0, L1, L2, L3)
     SParameters.__init__(self, f, None, Z0)
 def __init__(self, f, C0=0.0, C1=0.0, C2=0.0, C3=0.0, Z0=50.):
     """Constructor
     @param f list of frequencies for the s-parameters
     @param C0 (optional) float polynomial term for f^0 (defaults to 0.0).
     @param C1 (optional) float polynomial term for f^1 (defaults to 0.0).
     @param C2 (optional) float polynomial term for f^2 (defaults to 0.0).
     @param C3 (optional) float polynomial term for f^3 (defaults to 0.0).
     @param Z0 (optional) real or complex reference impedance Z0 (defaults to 50 ohms).
     """
     TerminationPolynomial.__init__(self, C0, C1, C2, C3)
     SParameters.__init__(self, f, None, Z0)
예제 #17
0
 def __init__(self, f, C, Z0=50., df=0., esr=0.):
     """Constructor
     @param f list of float frequencies
     @param C float capacitance
     @param Z0 (optional) float of complex reference impedance (defaults to 50 ohms)
     @param df (optional) float dissipation factor (or loss-tangent) (defaults to 0)
     @param esr (optional) float effective-series-resistance (defaults to 0)
     """
     self.m_C = C
     self.m_df = df
     self.m_esr = esr
     SParameters.__init__(self, f, None, Z0)
예제 #18
0
 def __init__(self, f, Td, taps, numPreCursorTaps, Z0=50.):
     """Constructor
     @param f list of float frequencies
     @param Td float time delay of each tap
     @param taps list of float values of the taps
     @param numPreCursorTaps integer number of precursor taps
     @param Z0 float (optional, defaults to 50) reference impedance
     @remark Usually Td is the reciprocal of the baud rate or sometimes, half the reciprocal.
     """
     self.Td = Td
     self.taps = taps
     self.PC = numPreCursorTaps
     SParameters.__init__(self, f, None, Z0)
예제 #19
0
 def __init__(self,f, R, Rse, L, G, C, df, Z0=50.):
     """Constructor
     @param f list of float frequencies
     @param R float DC series resistance (Ohms)
     @param Rse float series skin-effect resistance (Ohms/sqrt(Hz))
     @param L float series inductance (H)
     @param G float DC conductance to ground (S)
     @param C float capacitance to ground (F)
     @param df float dissipation factor (loss-tangent) of capacitance to ground
     @param Z0 (optional) float reference impedance (defaults to 50 Ohms)
     """
     self.R=R;   self.Rse=Rse; self.L=L
     self.G=G;   self.C=C;     self.df=df
     SParameters.__init__(self,f,None,Z0)
예제 #20
0
 def __init__(self, f, C, Z0=50., df=0., esr=0.):
     """Constructor
     @param f list of float frequencies
     @param C float capacitance
     @param Z0 (optional) float of complex reference impedance (defaults to 50 Ohms)
     @param df (optional) float dissipation factor (or loss-tangent) (defaults to 0)
     @param esr (optional) float effective-series-resistance (defaults to 0)
     @remark The s-parameters are evaluated using the single-frequency device
     SignalIntegrity.Lib.Devices.SeriesC
     """
     self.m_C = C
     self.m_df = df
     self.m_esr = esr
     SParameters.__init__(self, f, None, Z0)
    def __init__(self,
                 filename,
                 wfProjName=None,
                 normalizedDCGain=None,
                 multiplyByTs=True,
                 derivative=False):
        """Constructor
        @param filename string file name of s-parameter file to read.
        @param normalizedDCGain (optional, defaults to None) DC gain to normalize response to.
        @param multiplyByTs (optional, defaults to True) whether to multiply the waveform by the sample period
        @param derivative (optional, defaults to False) whether to use the derivative of the waveform

        Reads the waveform file and produces SParameters.

        The s-parameters are for a two-port device that is "amplifier-like", meaning it has infinite
        input impedance, zero output impedance, the impulse response forms s21, and has infinite reverse
        isolation.

        If normalizedDCGain is 0 or None, the DC gain is not normalized, otherwise the filter is normalized by setting
        the sum of the values in the impulse response equal to this gain value.

        if multiplyByTs is True, it assumes that the impulse response waveform is an ordinary waveform, and the impulse
        response is formed by multiplying every value by the sample period.

        if derivative is True, the derivative of the waveform is taken.  This is useful when you are provided a step
        response.
        """
        ext = str.lower(filename).split('.')[-1]
        if ext == 'si':
            from SignalIntegrity.App.SignalIntegrityAppHeadless import ProjectWaveform
            wf = ProjectWaveform(filename, wfProjName)
            if wf == None:
                raise SignalIntegrityExceptionWaveformFile(
                    'waveform could not be produced by ' + filename)
        else:
            try:
                wf = Waveform().ReadFromFile(filename)
            except:
                raise SignalIntegrityExceptionWaveformFile(
                    'waveform could not be produced by ' + filename)
        if derivative:
            wf = wf.Derivative()
        if multiplyByTs:
            wf = wf * (1. / wf.TimeDescriptor().Fs)
        if not ((normalizedDCGain == None) or (normalizedDCGain == 0)):
            wf = wf * (1. / sum(wf))
        fr = ImpulseResponse(wf).FrequencyResponse()
        fl = fr.Frequencies()
        SParameters.__init__(self, fl, [[[1., 0], [2. * r, -1]] for r in fr])
예제 #22
0
 def __init__(self, f, M, Z0=50.):
     """Constructor
     @param f list of frequencies.
     @param M float mutual inductance.
     @param Z0 (optional) float or complex reference impdedance (defaults to 50 ohms).
     @remark
     This is a four-port device with no self inductance.\n
     The left leg is from port 1 to 2.\n
     The right leg is from port 3 to 4.\n
     The arrow for the mutual points to ports 1 and 3.\n
     The s-parameters are evaluated using the single-frequency device
     SignalIntegrity.Lib.Devices.Mutual
     """
     self.m_M = M
     SParameters.__init__(self, f, None, Z0)
예제 #23
0
 def __init__(self,f, R, Rse, L, G, C, df, Z0=50., scale=1.):
     """Constructor
     @param f list of float frequencies
     @param R float DC series resistance (ohms)
     @param Rse float series skin-effect resistance (ohms/sqrt(Hz))
     @param L float series inductance (H)
     @param G float DC conductance to ground (S)
     @param C float capacitance to ground (F)
     @param df float dissipation factor (loss-tangent) of capacitance to ground
     @param Z0 (optional) float reference impedance (defaults to 50 ohms)
     @param scale (optional) float amount to scale the line by (assuming all other values are per unit)
     """
     self.R=R*scale;   self.Rse=Rse*scale; self.L=L*scale
     self.G=G*scale;   self.C=C*scale;     self.df=df
     SParameters.__init__(self,f,None,Z0)
예제 #24
0
    def RawMeasuredSParameters(self, wfList):
        """RawMeasuredSParameters
        @param wfList list of lists of waveforms of measurements.
        @return instance of class SParameters containing the raw measured
        s-parameters of the DUT.

        Each element at index d in wfList is a list of waveforms where
        the zero based dth waveform contains the incident and the others don't.
        (i.e. they are the waveforms measured at the ports of the DUT when zero
        based port d is driven).

        For a P port DUT, wfList must be PxP.
        @note for one port measurements, wfList can be a single measurement (as opposed
        to a 1x1 list of list of one element).
        """
        # pragma: silent exclude
        wfList = copy.deepcopy(wfList)
        if isinstance(wfList, Waveform):
            wfList = [wfList]
        # pragma: silent include
        ports = len(wfList)
        S = [[None for _ in range(ports)] for _ in range(ports)]
        for d in range(ports):
            # pragma: silent exclude
            if isinstance(wfList[d], Waveform):
                wfList[d] = [wfList[d]]
            # pragma: include
            fc = self.Convert(wfList[d], d)
            for o in range(ports):
                S[o][d] = fc[o]
        f = S[0][0].Frequencies()
        return SParameters(f, [[[S[r][c][n] for c in range(ports)]
                                for r in range(ports)] for n in range(len(f))])
예제 #25
0
 def __init__(self, f, P, Zc, Td, Z0=50.):
     """Constructor
     @param f list of float frequencies
     @param P integer number of ports (either 2 or 4)
     @param Zc float or complex characteristic impedance
     @param Td float electrical length (propagation time)
     @param Z0 (optional) float or complex reference impedance (defaults to 50 Ohms) 
     @note
     if two ports are specified, SignalIntegrity.Lib.Devices.TLineTwoPortLossless
     is used.\n
     Otherwise, if four ports are specified,
     SignalIntegrity.Lib.Devices.TLineFourPortLossless is used\n
     """
     self.m_Zc = Zc
     self.m_Td = Td
     self.m_P = P
     SParameters.__init__(self, f, None, Z0)
예제 #26
0
 def __init__(self, f, gDC, gDC2, fz, fLF, fp1, fp2, Z0=50.):
     """Constructor
     @param f list of float frequencies
     @param gDC float DC gain in dB
     @param gDC2 float DC gain at peaking point in dB
     @param fz float frequency of zero
     @param fLF float LF frequency
     @param fp1 float first pole frequency
     @param fp2 float second pole frequency
     @param Z0 float (optional, defaults to 50) reference impedance
     """
     self.powgDC = pow(10., gDC / 20.)
     self.powgDC2 = pow(10., gDC2 / 20.)
     self.joverfz = 1j / fz
     self.joverfLF = 1j / fLF
     self.joverfp1 = 1j / fp1
     self.joverfp2 = 1j / fp2
     SParameters.__init__(self, f, None, Z0)
예제 #27
0
 def DutCalculation(self, sRaw):
     """calculates the Dut.\n
     converts the raw measured s-parameters of the DUT into calibrated s-parameter
     measurements.
     @param sRaw instance of class SParameters of the raw measurement of the DUT.
     @return instance of class SParameters of the calibrated DUT measurement.
     """
     self.CalculateErrorTerms()
     return SParameters(
         self.f,
         [self[n].DutCalculation(sRaw[n]) for n in range(len(self))])
 def Deembed(self, systemSParameters=None):
     """computes deembedded s-parameters of a netlist.
     @param systemSParameters (optional) instance of class SParameters referring
     to the s-parameters of the system 
     @return instance of class SParameters of the unknown devices in the network.
     """
     # pragma: silent exclude
     if self.CheckCache():
         self.CallBack(100.0)
         return self.sf
     # pragma: include
     self._ProcessLines()
     self.m_sd.CheckConnections()
     NumUnknowns = len(self.m_sd.UnknownNames())
     result = [[] for i in range(NumUnknowns)]
     systemSP = systemSParameters
     if systemSP is None:
         for d in range(len(self.m_spc)):
             if self.m_spc[d][0] == 'system': systemSP = self.m_spc[d][1]
     # pragma: silent exclude
     if not systemSP is None:
         if hasattr(self, 'delayDict'):
             td = [
                 self.delayDict[p + 1] if p + 1 in self.delayDict else 0.0
                 for p in range(systemSP.m_P)
             ]
             systemSP = PeeledLaunches(systemSP, td, method='exact')
     # pragma: include
     for n in range(len(self.m_f)):
         for d in range(len(self.m_spc)):
             if self.m_spc[d][0] != 'system':
                 self.m_sd.AssignSParameters(self.m_spc[d][0],
                                             self.m_spc[d][1][n])
         system = systemSP[n] if not systemSP is None else None
         unl = DeembedderNumeric(self.m_sd).CalculateUnknown(system)
         if NumUnknowns == 1: unl = [unl]
         for u in range(NumUnknowns):
             result[u].append(unl[u])
         # pragma: silent exclude
         if self.HasACallBack():
             progress = self.m_f[n] / self.m_f[-1] * 100.0
             if not self.CallBack(progress):
                 raise SignalIntegrityExceptionDeembedder(
                     'calculation aborted')
         # pragma: include
     self.sf = [
         SParametersParser(SParameters(self.m_f, r), self.m_ul)
         for r in result
     ]
     if len(self.sf) == 1: self.sf = self.sf[0]
     # pragma: silent exclude
     self.CacheResult()
     # pragma: include
     return self.sf
예제 #29
0
    def __init__(self,
                 f,
                 offsetDelay=0.0,
                 offsetZ0=50.0,
                 offsetLoss=0.0,
                 f0=1e9,
                 C0=0.0,
                 C1=0.0,
                 C2=0.0,
                 C3=0.0):
        """Constructor
        @param f list of frequencies
        @param offsetDelay (optional) float electrical length of offset in s (defaults to 0 s)
        @param offsetZ0 (optional) float real characteristic impedance of offset (defaults to 50 ohms)
        @param offsetLoss (optional) float loss due to skin-effect defined in Gohms/s at 1 GHz (defaults to 0).
        @param f0 (optional) float frequency where the offset loss is defined (defaults to 1e9).
        @param C0 (optional) float polynomial coefficient for capacitance of open termination
        @param C1 (optional) float polynomial coefficient for capacitance of open termination
        @param C2 (optional) float polynomial coefficient for capacitance of open termination
        @param C3 (optional) float polynomial coefficient for capacitance of open termination
        The result is that the class becomes the base-class SParameters with the s-parameters
        of a open standard.

        Termination capacitance polynomial is C0+f*(C1+f*(C2+f*C3)).
        """
        # pragma: silent exclude
        from SignalIntegrity.Lib.Parsers.SystemDescriptionParser import SystemDescriptionParser
        # pragma: include
        sspn = SystemSParametersNumeric(SystemDescriptionParser().AddLines([
            'device offset 2', 'device C 1', 'port 1 offset 1',
            'connect offset 2 C 1'
        ]).SystemDescription())
        offsetSParameters = Offset(f, offsetDelay, offsetZ0, offsetLoss, f0)
        terminationSParameters = TerminationCPolynomial(f, C0, C1, C2, C3)
        sp = []
        for n in range(len(f)):
            sspn.AssignSParameters('offset', offsetSParameters[n])
            sspn.AssignSParameters('C', terminationSParameters[n])
            sp.append(sspn.SParameters())
        SParameters.__init__(self, f, sp)
예제 #30
0
 def DutUnCalculation(self,S,portList=None):
     """Un-calcualates the DUT.\n
     This calculates the expected raw measured DUT based on the DUT actually calculated.\n
     @see DutCalculation
     @param S instance of class SParameters of measured DUT from these error-terms.
     @param portList (optional) list of zero based port numbers used for the DUT calcualtion
     @return instance of class SParameters of the raw measured s-parameters that calculated this DUT
     @remark If the portList is None, then it assumed to be a list [0,1,2,P-1] where P is the
     number of ports in sRaw, otherwise ports can be specified where the DUT is connected.
     """
     self.CalculateErrorTerms()
     return SParameters(self.f,[self[n].DutUnCalculation(S[n],portList)
                                for n in range(len(self))])