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])
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]) sp=self.m_sspn.SParameters() if sp == 1: return sp lp=[w+1 for w in range(len(sp)//2)]; rp=[w+len(sp)//2+1 for w in range(len(sp)//2)] return T2S(linalg.matrix_power(S2T(sp,lp,rp),self.m_K),lp,rp)
def __getitem__(self, n): """overloads [n] @return list of list s-parameter matrix for the nth frequency element """ # pragma: silent exclude from numpy import linalg from SignalIntegrity.Lib.Conversions import S2T from SignalIntegrity.Lib.Conversions import T2S # pragma: include for ds in self.m_spdl: self.m_sspn.AssignSParameters(ds[0], ds[1][n]) sp = self.m_sspn.SParameters() return T2S(linalg.matrix_power(S2T(sp), self.m_K))
def SParameters(self,f): """s-parameters @param f list of frequencies for the s-parameters @return instance of class SParameters calculated by aggregating the list of rho values using lossless transmission line sections with the rho calculated for each section. """ N = len(f)-1 Gsp=[None for n in range(N+1)] gamma=[1j*2.*math.pi*f[n]*self.m_Td for n in range(N+1)] for n in range(N+1): tacc=matrix([[1.,0.],[0.,1.]]) for m in range(len(self)): tacc=tacc*matrix(S2T(IdealTransmissionLine(self[m],gamma[n]))) Gsp[n]=T2S(tacc.tolist()) sp = SParameters(f,Gsp,self.m_Z0) return sp