def TLineFourPort(rho, gamma):
    """symbolic single-ended four-port transmission line
    @param rho string reflection coefficient
    @param gamma string gamma
    @return list of list of string s-parameter matrix
    containing LaTeX or ASCII strings for each element.
    @note strings can be any valid LaTeX
    @note use SignalIntegrity.Symbolic.TLine.TLineRho if you want to enter the string
    representation of rho based on the characteristic impedance.
    @note use SignalIntegrity.Symbolic.TLine.TLineGamma if you want to enter the string
    representation of gamma based on a time delay
    @note this is the symbolic version of SignalIntegrity.Lib.Devices.TLineFourPort.TLineFourPort except that by
    default it's base on rho for symbolic simplicity (Zc complicates the look of things).
    """
    Y = 'e^{' + gamma + ' } '
    Y2 = 'e^{2 \\cdot ' + gamma + ' } '
    D = '2 \\cdot \\left( 1 - ' + Y2 + ' \\cdot \\left[ ' + rho + ' \\right]^2 \\right)'
    S1 = lfrac(
        ' 1 - ' + Y2 + ' \\cdot \\left[ ' + rho + ' \\right]^2 + ' + rho +
        ' \\cdot \\left( 1 - ' + Y2 + ' \\right) ', ' ' + D + ' ') + ' '
    S2 = lfrac(
        ' \\left( 1 - \\left[ ' + rho + ' \\right]^2 \\right) \\cdot ' + Y +
        ' ', ' ' + D + ' ') + ' '
    S3 = lfrac(
        ' 1 - ' + Y2 + ' \\cdot \\left[ ' + rho + ' \\right]^2 - ' + rho +
        ' \\cdot \\left( 1 - ' + Y2 + ' \\right)  ', ' ' + D + ' ') + ' '
    return [[S1, S2, S3, '-' + S2], [S2, S1, '-' + S2, S3],
            [S3, '-' + S2, S1, S2], ['-' + S2, S3, S2, S1]]
def OperationalAmplifier(Zi, Zd, Zo, G):
    """symbolic operationalAmplifier
    Operational Amplifier

    Port 1 is - input, port 2 is + input and port 3 is output

    @param Zi string input impedance between each plus and minus input port
    to ground.
    @param Zd string input impedance across the plus and minus inputs.
    @param Zo string output impedance.
    @param G string gain of the op-amp.
    @return list of list of string s-parameter matrix
    containing LaTeX or ASCII strings for each element.
    @note strings can be any valid LaTeX
    @note this is the symbolic version of SignalIntegrity.Lib.Devices.OperationalAmplifier.OperationalAmplifier
    """
    S11 = lfrac(
        '\\left(-2\\cdot ' + Zi + ' - ' + Zd + ' \\right)\\cdot Z0^2+ ' + Zi +
        ' ^2\\cdot ' + Zd + ' ', '\\left(2\\cdot ' + Zi + ' + ' + Zd +
        ' \\right)\\cdot Z0^2+\\left(2\\cdot ' + Zi + ' \\cdot ' + Zd +
        ' +2\\cdot ' + Zi + ' ^2\\right)\\cdot Z0+ ' + Zi + ' ^2\\cdot ' + Zd +
        ' ')
    S12 = lfrac(
        '2\\cdot ' + Zi + ' ^2\\cdot Z0', '\\left(2\\cdot ' + Zi + ' + ' + Zd +
        ' \\right)\\cdot Z0^2+\\left(2\\cdot ' + Zi + ' \\cdot ' + Zd +
        ' +2\\cdot ' + Zi + ' ^2\\right)\\cdot Z0+ ' + Zi + ' ^2\\cdot ' + Zd +
        ' ')
    S32 = lfrac(
        '2\\cdot ' + G + ' \\cdot ' + Zi + ' \\cdot ' + Zd + ' \\cdot Z0',
        '\\left( ' + Zo + ' +Z0\\right)\\cdot \\left(\\left(2\\cdot ' + Zi +
        ' + ' + Zd + ' \\right)\\cdot Z0+ ' + Zi + ' \\cdot ' + Zd +
        ' \\right)')
    S33 = lfrac(' ' + Zo + ' -Z0', ' ' + Zo + ' +Z0')
    return [[S11, S12, '0'], [S12, S11, '0'], ['-' + S32, S32, S33]]
def RationalString(val):
    data = ''
    if isinstance(val, int):
        data = str(val)
    elif isinstance(val, float):
        from SignalIntegrity.Lib.Rat import Rat
        from numpy import sign
        sn = sign(val)
        if sn == 0:
            return '0'
        signStr = ''
        if sn == -1:
            val = val * -1.
            signStr = '-'
        (n, d) = Rat(val)
        if d == 1:
            return signStr + str(n)
        elif d < n:
            return signStr + str(val)
        elif d == n:
            return signStr + '1'
        elif ((d < 10) and (n < 10)):
            return signStr + lfrac(str(n), str(d))
        # check for square-root of 2
        valsq2 = val * math.sqrt(2.)
        (n, d) = Rat(valsq2)
        if d < n:
            return signStr + str(val)
        elif ((d < 10) and (n < 10)):
            denstr = '\\sqrt{2}'
            if d != 1:
                denstr = str(d) + '\\cdot' + denstr
            return signStr + lfrac(str(n), denstr)
        return signStr + str(val)
Esempio n. 4
0
def TransconductanceAmplifierThreePort(G, Zi, Zo):
    """symbolic three port transconductance amplifier
    @param G string transconductance
    @param Zi string input impedance
    @param Zo string output impedance
    @return list of list of string s-parameter matrix
    containing LaTeX or ASCII strings for each element.
    @note strings can be any valid LaTeX
    @note this is the symbolic version of SignalIntegrity.Lib.Devices.TransconductanceAmplifier.TransconductanceAmplifierThreePort
    """
    D = '3\\cdot Z0^2+ (2\\cdot ' + Zo + '+2\\cdot ' + Zi + '-' + G + '\\cdot ' + Zi + '\\cdot ' + Zo + ' )\\cdot Z0+' + Zo + '\\cdot ' + Zi
    S11 = lfrac(
        Zo + '\\cdot ' + Zi + '+Z0\\cdot  (2\\cdot ' + Zi + '-' + G +
        '\\cdot ' + Zi + '\\cdot ' + Zo + ' )-Z0^2', D)
    S12 = lfrac('2\\cdot Z0^2', D)
    S13 = lfrac('2\\cdot Z0^2+2\\cdot ' + Zo + '\\cdot Z0', D)
    S21 = lfrac(
        '2\\cdot Z0^2+2\\cdot ' + G + '\\cdot ' + Zi + '\\cdot ' + Zo +
        '\\cdot Z0', D)
    S22 = lfrac(
        Zo + '\\cdot ' + Zi + '+Z0\\cdot  (2\\cdot ' + Zo + '-' + G +
        '\\cdot ' + Zi + '\\cdot ' + Zo + ' )-Z0^2', D)
    S23 = lfrac(
        '2\\cdot Z0^2+Z0\\cdot  (2\\cdot ' + Zi + '-2\\cdot ' + G + '\\cdot ' +
        Zi + '\\cdot ' + Zo + ' )', D)
    S31 = lfrac(
        '2\\cdot Z0^2+Z0\\cdot  (2\\cdot ' + Zo + '-2\\cdot ' + G + '\\cdot ' +
        Zi + '\\cdot ' + Zo + ' )', D)
    S32 = lfrac('2\\cdot Z0^2+2\\cdot ' + Zi + '\\cdot Z0', D)
    S33 = lfrac(
        Zo + '\\cdot ' + Zi + '-Z0^2+' + G + '\\cdot ' + Zi + '\\cdot ' + Zo +
        '\\cdot Z0', D)
    return _LineReplacer([[S11, S12, S13], [S21, S22, S23], [S31, S32, S33]])
Esempio n. 5
0
def TeeThreePortZ1Z2Z3(Z1, Z2, Z3):
    D = '3\\cdot Z0^2+2\\cdot Z0\\cdot\\left(' + Z1 + '+' + Z2 + '+' + Z3 + '\\right)+' + Z1 + '\\cdot ' + Z2 + '+' + Z1 + '\\cdot ' + Z3 + '+' + Z2 + '\\cdot ' + Z3
    return [[
        lfrac(
            Z1 + '\\cdot ' + Z2 + '+' + Z1 + '\\cdot ' + Z3 + '+2\\cdot ' +
            Z1 + '\\cdot Z0+' + Z2 + '\\cdot ' + Z3 + '-Z0^2', D),
        lfrac('2\\cdot Z0^2+2\\cdot Z0\\cdot ' + Z3, D),
        lfrac('2\\cdot Z0^2+2\\cdot ' + Z2 + '\\cdot Z0', D)
    ],
            [
                lfrac('2\\cdot Z0^2+2\\cdot Z0\\cdot ' + Z3, D),
                lfrac(
                    Z1 + '\\cdot ' + Z2 + '+' + Z2 + '\\cdot ' + Z3 +
                    '+2\\cdot ' + Z2 + '\\cdot Z0+' + Z1 + '\\cdot ' + Z3 +
                    '-Z0^2', D),
                lfrac('2\\cdot Z0^2+2\\cdot ' + Z1 + '\\cdot Z0', D)
            ],
            [
                lfrac('2\\cdot Z0^2+2\\cdot ' + Z2 + '\\cdot Z0', D),
                lfrac('2\\cdot Z0^2+2\\cdot ' + Z1 + '\\cdot Z0', D),
                lfrac(
                    Z1 + '\\cdot ' + Z2 + '+' + Z1 + '\\cdot ' + Z3 + '+' +
                    Z2 + '\\cdot ' + Z3 + '+2\\cdot Z0\\cdot ' + Z3 + '-Z0^2',
                    D)
            ]]
Esempio n. 6
0
def ShuntZThreePort(Z):
    """symbolic three port shunt impedance
    @param Z string impedance
    @return list of list of string s-parameter matrix
    containing LaTeX or ASCII strings for each element.
    @note strings can be any valid LaTeX
    @note this is the symbolic version of SignalIntegrity.Lib.Devices.ShuntZ.ShuntZThreePort
    @remark Ports 1 and 2 are connected together and to port 1 impedance.\n
    Port 3 is the other port of the impedance.\n
    @todo check the port numbering
    """
    D = '2\\cdot ' + Z + '+3\\cdot Z0'
    return [[
        lfrac('-Z0', D),
        lfrac('2\\cdot ' + Z + '+2\\cdot Z0', D),
        lfrac('2\\cdot Z0', D)
    ],
            [
                lfrac('2\\cdot ' + Z + '+2\\cdot Z0', D),
                lfrac('-Z0', D),
                lfrac('2\\cdot Z0', D)
            ],
            [
                lfrac('2\\cdot Z0', D),
                lfrac('2\\cdot Z0', D),
                lfrac('2\\cdot ' + Z + '-Z0', D)
            ]]
Esempio n. 7
0
def CurrentAmplifierTwoPort(G,Zi,Zo):
    """symbolic two port current amplifier
    @param G string current gain
    @param Zi string input impedance
    @param Zo string output impedance
    @return list of list of string s-parameter matrix
    containing LaTeX or ASCII strings for each element.
    @note strings can be any valid LaTeX
    @note this is the symbolic version of SignalIntegrity.Lib.Devices.CurrentAmplifier.CurrentAmplifierTwoPort
    """
    return [[lfrac(Zi+' - Z0',Zi+' + Z0'),'0'],
            [lfrac('2\\cdot '+G+' \\cdot '+Zo+' \\cdot Z0',' ( '+Zi+' +Z0 )\\cdot ( '+Zo+' + Z0 )'),lfrac(Zo+' - Z0',Zo+' + Z0')]]
def TLineRho(Zc, ports=2):
    """string representation of rho from the characteristic impedance
    @param Zc string characteristic impedance
    @param ports (optional) integer number of ports (defaults to two).
    @return string LaTeX representation of rho
    @note that rho is different for a four-port single-ended transmission line.
    """
    if ports == 2:
        return ' ' + lfrac(' ' + Zc + '-Z0 ', ' ' + Zc + ' + Z0 ')
    elif ports == 4:
        return ' ' + lfrac(' ' + lfrac(' ' + Zc + ' ', '2') + ' - Z0  ',
                           ' ' + lfrac(' ' + Zc + ' ', '2') + ' + Z0 ')
Esempio n. 9
0
def SeriesZ(Z):
    """symbolic series impedance
    @param Z string impedance
    @return list of list of string s-parameter matrix
    containing LaTeX or ASCII strings for each element.
    @note strings can be any valid LaTeX
    @note this is the symbolic version of SignalIntegrity.Lib.Devices.SeriesZ
    """
    return [[
        lfrac(Z, Z + '+2\\cdot Z0'),
        lfrac('2\\cdot Z0', Z + '+2\\cdot Z0')
    ], [lfrac('2\\cdot Z0', Z + '+2\\cdot Z0'),
        lfrac(Z, Z + '+2\\cdot Z0')]]
Esempio n. 10
0
def ShuntZTwoPort(Z):
    """symbolic two port shunt impedance
    @param Z string impedance
    @return list of list of string s-parameter matrix
    containing LaTeX or ASCII strings for each element.
    @note strings can be any valid LaTeX
    @note this is the symbolic version of SignalIntegrity.Lib.Devices.ShuntZ.ShuntZTwoPort
    @remark Ports 1 and 2 are connected together and to one side of the impedance.\n
    The other side of the impedance is tied to ground.
    """
    D = '2\\cdot ' + Z + ' +Z0'
    return [[lfrac('-Z0', D), lfrac('2\\cdot ' + Z, D)],
            [lfrac('2\\cdot ' + Z, D),
             lfrac('-Z0', D)]]
Esempio n. 11
0
 def LaTeXTransferMatrix(self):
     """Calculates and stores internally a symbolic representation
     of the transfer matrix in LaTeX.
     @return self
     @see Symbolic
     """
     self.Check()
     self._LaTeXSi()
     numMeas = len(self.pMeasurementList)
     vemsi = MatrixMultiply(
         self.VoltageExtractionMatrix(self.pMeasurementList),
         self.SIPrime(True))
     oneElementVemsi = False
     if len(vemsi) == 1:
         if len(vemsi[0]) == 1: oneElementVemsi = True
     vemsi = Matrix2LaTeX(vemsi, self._SmallMatrix())
     veosi = MatrixMultiply(self.VoltageExtractionMatrix(self.pOutputList),
                            self.SIPrime(True))
     oneElementVeosi = False
     if len(veosi) == 1:
         if len(veosi[0]) == 1: oneElementVeosi = True
     veosi = Matrix2LaTeX(veosi, self._SmallMatrix())
     if self.pStimDef is None:
         numDeg = len(self.SIPrime(True)[0])
         inverse = '^{-1}' if numDeg == numMeas else '^\\dagger'
         if oneElementVemsi and oneElementVeosi:
             line = lfrac(' ' + veosi + ' ', ' ' + vemsi + ' ') + ' '
         elif oneElementVemsi and not oneElementVeosi:
             line = veosi + ' ' + lfrac('1', ' ' + vemsi + ' ') + ' '
         elif not oneElementVemsi and oneElementVeosi:
             line = '\\left( ' + veosi + '\\right)\\cdot ' + vemsi + inverse
         elif not oneElementVemsi and not oneElementVeosi:
             line = veosi + '\\cdot ' + vemsi + inverse
     else:
         numDeg = len(self.pStimDef[0])
         inverse = '^{-1}' if numDeg == numMeas else '^\\dagger'
         D = Matrix2LaTeX(self.pStimDef, self._SmallMatrix())
         fveosi = '\\left( ' + veosi + '\\right)' if oneElementVeosi else veosi
         fvemsi = '\\left( ' + vemsi + '\\right)' if oneElementVemsi else vemsi
         line = '\\left[ '+fveosi+'\\cdot '+D+'\\right]\\cdot'+\
             '\\left[ '+fvemsi+'\\cdot '+D+'\\right]'+inverse
     if len(self.pMeasurementList) == 1 and len(self.pOutputList) == 1:
         H = 'H'
     else:
         H = '\\mathbf{H}'
     return self._AddEq(H + ' = ' + line)
Esempio n. 12
0
def CurrentControlledVoltageSource(G):
    """symbolic current controlled voltage source
    @param G string transresistance
    @return list of list of string s-parameter matrix
    containing LaTeX or ASCII strings for each element.
    @note strings can be any valid LaTeX
    @note this is the symbolic version of
    SignalIntegrity.Lib.Devices.CurrentControlledVoltageSource.CurrentControlledVoltageSource
    """
    return [['0', '1', '0', '0'], ['1', '0', '0', '0'],
            [
                '-' + lfrac(G + ' ', '2\\cdot Z0'),
                lfrac(G + ' ', '2\\cdot Z0'), '0', '1'
            ],
            [
                lfrac(G + ' ', '2\\cdot Z0'),
                '-' + lfrac(G + ' ', '2\\cdot Z0'), '1', '0'
            ]]
Esempio n. 13
0
def IdealTransformer(a=1):
    """symbolic ideal transformer

    Ports 1 and 2 are the primary.

    Ports 3 and 4 are the secondary.

    The dot is on ports 1 and 3.

    a is the turns ratio specified as (secondary/primary) windings

    @param a integer, float or string turns ratio\n
    @return list of list of string s-parameter matrix
    containing LaTeX or ASCII strings for each element.
    @note strings can be any valid LaTeX
    @note this is the symbolic version of SignalIntegrity.Lib.Devices.IdealTransformer
    """
    if isinstance(a, str):
        try:
            a = int(a)
        except ValueError:
            try:
                a = float(a)
            except ValueError:
                pass
    if isinstance(a, int) or isinstance(a, float):
        if a == 1:
            a = '1'
            asq = '1'
            denom = '2'
        else:
            asq = str(a * a)
            denom = str(a * a + 1)
            a = str(a)
    elif isinstance(a, str):
        asq = a + '^2'
        denom = asq + ' + 1'
    one = ' ' + lfrac(' 1 ', denom) + ' '
    a2 = ' ' + lfrac(' ' + asq + ' ', ' ' + denom + ' ') + ' '
    a1 = ' ' + lfrac(' ' + a + ' ', ' ' + denom + ' ') + ' '
    na = ' -' + lfrac(' ' + a + ' ', ' ' + denom + ' ') + ' '
    return [[one, a2, a1, na], [a2, one, na, a1], [a1, na, a2, one],
            [na, a1, one, a2]]
def TransresistanceAmplifierFourPort(G,Zi,Zo):
    """symbolic four port transresistance amplifier
    @param G string transresistance
    @param Zi string input impedance
    @param Zo string output impedance
    @return list of list of string s-parameter matrix
    containing LaTeX or ASCII strings for each element.
    @note strings can be any valid LaTeX
    @note this is the symbolic version of SignalIntegrity.Lib.Devices.TransresistanceAmplifier.TransresistanceAmplifierFourPort
    """
    D11=lfrac(Zi,Zi+'+2\\cdot Z0')
    D12=lfrac('2\\cdot Z0',Zi+'+2\\cdot Z0')
    D31=lfrac('2\\cdot '+G+'\\cdot Z0',' ('+Zo+'+2\\cdot Z0 )\\cdot ('+Zi+'+2\\cdot Z0 )')
    D33=lfrac(Zo,Zo+'+2\\cdot Z0')
    D34=lfrac('2\\cdot Z0',Zo+'+2\\cdot Z0')
    return [[D11,D12,'0','0'],
            [D12,D11,'0','0'] ,
            [D31,'-'+D31,D33,D34],
            ['-'+D31,D31,D34,D33]]
Esempio n. 15
0
def TeeWithZ2(Z2):
    D = '3\\cdot Z0^2+2\\cdot Z0\\cdot ' + Z2
    return [[
        lfrac('-Z0^2', D),
        lfrac('2\\cdot Z0^2', D),
        lfrac('2\\cdot Z0^2+2\\cdot Z0\\cdot ' + Z2, D)
    ],
            [
                lfrac('2\\cdot Z0^2', D),
                lfrac('-Z0^2+2\\cdot Z0\\cdot ' + Z2, D),
                lfrac('2\\cdot Z0^2', D)
            ],
            [
                lfrac('2\\cdot Z0^2+2\\cdot Z0\\cdot ' + Z2, D),
                lfrac('2\\cdot Z0^2', D),
                lfrac('-Z0^2', D)
            ]]
Esempio n. 16
0
def TeeThreePortSafe(Zt):
    D = '3\\cdot \\left(' + Zt + '+Z0\\right)'
    return [[
        lfrac('3\\cdot ' + Zt + '-Z0', D),
        lfrac('2\\cdot Z0', D),
        lfrac('2\\cdot Z0', D)
    ],
            [
                lfrac('2\\cdot Z0', D),
                lfrac('3\\cdot ' + Zt + '-Z0', D),
                lfrac('2\\cdot Z0', D)
            ],
            [
                lfrac('2\\cdot Z0', D),
                lfrac('2\\cdot Z0', D),
                lfrac('3\\cdot ' + Zt + '-Z0', D)
            ]]
Esempio n. 17
0
def ShuntZOnePort(Z):
    """symbolic four port shunt impedance

    This is simply a termination impedance to ground.

    @param Z string impedance
    @return list of list of string s-parameter matrix
    containing LaTeX or ASCII strings for each element.
    @note strings can be any valid LaTeX
    @note this is the symbolic version of SignalIntegrity.Lib.Devices.TerminationZ.TerminationZ
    """
    return [[lfrac(' ' + Z + ' -Z0', ' ' + Z + ' +Z0')]]
Esempio n. 18
0
def Tee(P=3):
    """symbolic Tee
    @param P (optional) integer number of ports (defaults to three)\n
    @return list of list of string s-parameter matrix
    containing LaTeX or ASCII strings for each element.
    @note strings can be any valid LaTeX
    @note this is the symbolic equivalent of SignalIntegrity.Lib.Devices.Tee.Tee
    """
    D = str(P)
    DiagEle = '-' + lfrac(str(-(2 - P)), D)
    OffDiagEle = lfrac('2', D)
    M = []
    for r in range(P):
        row = []
        for c in range(P):
            if r == c:
                ele = DiagEle
            else:
                ele = OffDiagEle
            row.append(ele)
        M.append(row)
    return M
def VoltageAmplifierThreePort(G,Zi,Zo):
    """symbolic three port voltage amplifier
    @param G string voltage gain
    @param Zi string input impedance
    @param Zo string output impedance
    @return list of list of string s-parameter matrix
    containing LaTeX or ASCII strings for each element.
    @note strings can be any valid LaTeX
    @note this is the symbolic version of SignalIntegrity.Lib.Devices.VoltageAmplifier.VoltageAmplifierThreePort
    """
    D='-'+Zo+'\\cdot '+Zi+'-2\\cdot '+Zo+'\\cdot Z0-2\\cdot '+Zi+'\\cdot Z0-3\\cdot Z0^2+'+G+'\\cdot '+Zi+'\\cdot Z0'
    S11=lfrac('-'+Zo+'\\cdot '+Zi+'-2\\cdot '+Zi+'\\cdot Z0+Z0^2+'+G+'\\cdot '+Zi+'\\cdot Z0',D)
    S12=lfrac('-2\\cdot Z0^2',D)
    S13=lfrac('-2\\cdot Z0\\cdot ('+Zo+' +Z0 )',D)
    S21=lfrac('-2\\cdot Z0 \\cdot ('+G+'\\cdot '+Zi+' +Z0 )',D)
    S22=lfrac('Z0^2-2\\cdot '+Zo+'\\cdot Z0+'+G+'\\cdot '+Zi+'\\cdot Z0-'+Zo+'\\cdot '+Zi,D)
    S23=lfrac('2\\cdot Z0\\cdot ('+G+'\\cdot '+Zi+'-'+Zi+'-Z0 )',D)
    S31=lfrac('2\\cdot Z0\\cdot (-Z0+'+G+'\\cdot '+Zi+'-'+Zo+' )',D)
    S32=lfrac('-2\\cdot Z0\\cdot ('+Zi+'+Z0 )',D)
    S33=lfrac('-'+Zo+'\\cdot '+Zi+'+Z0^2-'+G+'\\cdot '+Zi+'\\cdot Z0',D)
    return [[S11,S12,S13],
            [S21,S22,S23],
            [S31,S32,S33]]
Esempio n. 20
0
def ShuntZFourPort(Z):
    """symbolic four port shunt impedance
    @param Z string impedance
    @return list of list of string s-parameter matrix
    containing LaTeX or ASCII strings for each element.
    @note strings can be any valid LaTeX
    @note this is the symbolic version of SignalIntegrity.Lib.Devices.ShuntZ.ShuntZFourPort
    @remark Ports 1 and 3 are connected to port 1 of the device D provided.\n
    Ports 2 and 4 are connected to port 2 of the device D provided.\n
    @todo check the port numbering
    """
    D = '2\\cdot  (' + Z + '+Z0 )'
    return [[
        lfrac('-Z0', D),
        lfrac('Z0', D),
        lfrac('2\\cdot ' + Z + '+Z0', D),
        lfrac('Z0', D)
    ],
            [
                lfrac('Z0', D),
                lfrac('-Z0', D),
                lfrac('Z0', D),
                lfrac('2\\cdot ' + Z + '+Z0', D)
            ],
            [
                lfrac('2\\cdot ' + Z + '+Z0', D),
                lfrac('Z0', D),
                lfrac('-Z0', D),
                lfrac('Z0', D)
            ],
            [
                lfrac('Z0', D),
                lfrac('2\\cdot ' + Z + '+Z0', D),
                lfrac('Z0', D),
                lfrac('-Z0', D)
            ]]
Esempio n. 21
0
def TransconductanceAmplifierFourPort(G, Zi, Zo):
    """symbolic four port transconductance amplifier
    @param G string transconductance
    @param Zi string input impedance
    @param Zo string output impedance
    @return list of list of string s-parameter matrix
    containing LaTeX or ASCII strings for each element.
    @note strings can be any valid LaTeX
    @note this is the symbolic version of SignalIntegrity.Lib.Devices.TransconductanceAmplifier.TransconductanceAmplifierFourPort
    """
    return [
        [
            lfrac(Zi, Zi + '+2\\cdot Z0'),
            lfrac('2\\cdot Z0', Zi + '+2\\cdot Z0'), '0', '0'
        ],
        [
            lfrac('2\\cdot Z0', Zi + '+2\\cdot Z0'),
            lfrac(Zi, Zi + '+2\\cdot Z0'), '0', '0'
        ],
        [
            lfrac('2\\cdot ' + Zi + '\\cdot ' + Zo + '\\cdot Z0\\cdot ' + G,
                  ' (' + Zi + '+2\\cdot Z0 )\\cdot (' + Zo + '+2\\cdot Z0 )'),
            '-' +
            lfrac('2\\cdot ' + Zi + '\\cdot ' + Zo + '\\cdot Z0\\cdot ' + G,
                  ' (' + Zi + '+2\\cdot Z0 )\\cdot (' + Zo + '+2\\cdot Z0 )'),
            lfrac(Zo, Zo + '+2\\cdot Z0'),
            lfrac('2\\cdot Z0', Zo + '+2\\cdot Z0')
        ],
        [
            '-' +
            lfrac('2\\cdot ' + Zi + '\\cdot ' + Zo + '\\cdot Z0\\cdot ' + G,
                  ' (' + Zi + '+2\\cdot Z0 )\\cdot (' + Zo + '+2\\cdot Z0 )'),
            lfrac('2\\cdot ' + Zi + '\\cdot ' + Zo + '\\cdot Z0\\cdot ' + G,
                  ' (' + Zi + '+2\\cdot Z0 )\\cdot (' + Zo + '+2\\cdot Z0 )'),
            lfrac('2\\cdot Z0', Zo + '+2\\cdot Z0'),
            lfrac(Zo, Zo + '+2\\cdot Z0')
        ]
    ]