class MixedModeTLine(SParameters): """s-parameters of a mixed-mode, balanced transmission line""" def __init__(self,f,Zd,Td,Zc,Tc,Z0=50.): """Constructor The port numbering is ports 1 and 2 are the plus and minus terminals on one side of the line and ports 3 and 4 are the plus and minus terminals on the other side of the line. @param f list of float frequencies @param Zd float or complex differential mode impedance @param Td float differential (or odd-mode) electrical length (the differential-mode propagation time. @param Zc float or complex common-mode impedance @param Tc float common (or even-mode) electrical length (the common-mode propagation time. @param Z0 (optional) float or complex reference impedance (defaults to 50 Ohms). @note The differential mode impedance is twice the odd-mode impedance.\n The common-mode impedance is half the even-mode impedance.\n @note The model is appropriate for a balanced transmission line.\n @note The s-parameters provided are single-ended. @note This device builds a model internally and only solves the model on each access to __getitem__(). """ import SignalIntegrity.Lib.SParameters.Devices as dev from SignalIntegrity.Lib.Devices.MixedModeConverter import MixedModeConverter from SignalIntegrity.Lib.SystemDescriptions.SystemSParametersNumeric import SystemSParametersNumeric self.m_sspn=SystemSParametersNumeric() self.m_spdl=[] self.m_sspn.AddDevice('MM1',4,MixedModeConverter()) self.m_sspn.AddDevice('MM2',4,MixedModeConverter()) self.m_sspn.AddDevice('D',2), self.m_spdl.append(('D',dev.TLineLossless(f,2,Zd/2.,Td,Z0))) self.m_sspn.AddDevice('C',2), self.m_spdl.append(('C',dev.TLineLossless(f,2,Zc*2.,Tc,Z0))) self.m_sspn.ConnectDevicePort('MM1',3,'D',1) self.m_sspn.ConnectDevicePort('MM2',3,'D',2) self.m_sspn.ConnectDevicePort('MM1',4,'C',1) self.m_sspn.ConnectDevicePort('MM2',4,'C',2) self.m_sspn.AddPort('MM1',1,1) self.m_sspn.AddPort('MM1',2,2) self.m_sspn.AddPort('MM2',1,3) self.m_sspn.AddPort('MM2',2,4) SParameters.__init__(self,f,None,Z0) def __getitem__(self,n): """overloads [n] @return list of list s-parameter matrix for the nth frequency element """ for ds in self.m_spdl: self.m_sspn.AssignSParameters(ds[0],ds[1][n]) return self.m_sspn.SParameters()
def DutUnCalculationAlternate(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. @deprecated This method utilizes fixtures and embeds them. Originally, I could not figure out how to do this with just the error-terms. This was figured out finally and is more efficient, but this method is retained for comparison of results. @see DutUnCalculation """ self.CalculateErrorTerms() if portList is None: portList=[p for p in range(self.ports)] ports=len(portList) sspn=SystemSParametersNumeric() sspn.AddDevice('F',2*ports) sspn.AddDevice('D',ports) for p in range(ports): sspn.AddPort('F',p+1,p+1) sspn.ConnectDevicePort('F',ports+p+1,'D',p+1) rd=[None for n in range(len(self.f))] fixtureList=self.Fixtures(portList) for n in range(len(self.f)): rm=[[None for c in range(ports)] for r in range(ports)] sspn.AssignSParameters('D',S[n]) for p in range(ports): sspn.AssignSParameters('F',fixtureList[p][n]) spp=sspn.SParameters() for r in range(ports): rm[r][p]=spp[r][p] rd[n]=rm return SParameters(self.f,rd)