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)
def TerminationL(L,f,Z0=None): """Termination (one-port) inductance @param L float inductance @param f float frequency @param Z0 (optional) float of complex reference impedance (defaults to 50 Ohms) @return the list of list s-parameter matrix for a termination inductance """ return TerminationZ(L*1j*2.*math.pi*f,Z0)
def TerminationG(G,Z0=50.): """TerminationG Termination conductance @param G float conductance. @param Z0 (optional) float of complex reference impedance (defaults to 50 Ohms). @return the list of list s-parameter matrix for a termination conductance. """ infinity=1e25 try: Z = 1.0/G except ZeroDivisionError: Z = infinity return TerminationZ(Z,Z0)
def IdealRelay(ports, position, termination='open', Z0=50.): """IdealRelay An ideal relay with a given number of ports, where the common is always the last port. I.e. for a given number ports P, port P is always the common connection and ports 1 through P-1 are the throws of the relay (the ports that get connected to the common) in port order. The position value ranges from 0 to P-1, where 0 says that none of the throws are connected to the common, and a value from 1 to P-1 indicates the throw port connected to the common. Valid terminations are the string 'open', or a number indicating the impedance of the unconnected port. This impedance is also applied to the common, when no ports are connected. @param ports int number of ports in the relay (including the common). @parem position int number from 0 to ports-1 indicating the relay position. @param float or string (optional, defaults to 'open' termination applied to unconnected ports. @param float (optional, defaults to 50) reference impedance. @returns the list of list s-parameter matrix of the ideal relay in the position specified. """ if termination == 'open': rho = 1. else: rho = TerminationZ(termination, Z0)[0][0] S = [[rho if r == c else 0 for c in range(ports)] for r in range(ports)] if 0 < position < ports: S[position - 1][position - 1] = 0 S[position - 1][ports - 1] = 1. S[ports - 1][position - 1] = 1. S[ports - 1][ports - 1] = 0 return S