Beispiel #1
0
    def __init__(self, filename):
        """

        :param filename:
        :type filename:
        """


        projRootFold = u.getDirectory()
        netListFile = filename#os.path.join(os.path.abspath('../'),filename)#"".join((projRootFold,"/__Circuits/",filename))

        self.spice_netlist = open(netListFile, 'rb')

        self.components = []

        comments = self.getCommentsFromNetlist(netListFile)

        for line in self.spice_netlist:
            d = line[0]
            if d in ['R', 'V', 'C', 'L', 'D', 'Q', 'I', 'K','P']:
                arr = line.split()
                nodefrom = arr[1]
                nodeto = arr[2]
                name = arr[0]
                value = arr[3]

                if d == 'R':
                    r = Resistor([nodefrom, nodeto], name, value, None)
                    self.components.append(r)
                elif d == 'V':
                    #r = VoltageSource([nodefrom, nodeto], name, value, None)
                    args = self.stringArrToDict(arr[4:])
                    args = self.parseCommentsToArgs(args,comments,name)
                    r = Port([nodefrom, nodeto], name, value, None, paramdict=args)
                    self.components.append(r)
                elif d == 'I':
                    r = CurrentSource([nodefrom, nodeto], name, value, None)
                    self.components.append(r)
                elif d == 'L':
                    l = Inductance([nodefrom, nodeto], name, value, None)
                    self.components.append(l)
                elif d == 'C':
                    c = Capacity([nodefrom, nodeto], name, value, None)
                    self.components.append(c)
                elif d == 'D':
                    path = "Diode_std.comp"
                    c = Diode([nodefrom, nodeto], name, 0,None, pParams=path)
                    self.components.append(c)
                elif d == 'Q':
                    #npn = NPNTransistor_SGP([arr[1], arr[2], arr[3]], name, arr[4], None, pParams="__Parameter/NPN_Gummel_BC547B.comp")
                    #npn = NPNEasy_SGP([arr[1], arr[2], arr[3]], name, arr[4])
                    path = ('NPN_VBIC_npn13G2.comp')
                    addargs =  self.parseCommentsToArgs(dict(),comments,name)
                    npn = NPN_VBIC([arr[1], arr[2], arr[3], '0'], name, arr[4], None, pParams=path,addargs = addargs)
                    self.components.append(npn)
                elif d == 'K':
                    pass
                    #k = VoltageDependentCurrentSource([nodefrom, nodeto], name, value, None)
                    #self.components.append(k)
                elif d == 'P':
                    #nodes, name, voltage, seriesImpedance
                    args = self.stringArrToDict(arr[4:])
                    k = Port([nodefrom, nodeto], name, value, None, paramdict=args)
                    self.components.append(k)
Beispiel #2
0
nb = 'b'
nc = 'c'
ne = 'e'
m1 = 'm1'
m2 = 'm2'

#Anzeigeparamter
raster = 0.05
BFIX = 0.9
CMIN = -0.5
CMAX = 0.5
EMIN = -0.5
EMAX = 0.5

r1 = Resistor([m1, nb], "R1", 0.001, None)
r2 = Resistor([m2, nc], "R2", 0.001, None)
v1 = VoltageSource([m1, '0'], "V1", 0, None)
v2 = VoltageSource([m2, '0'], "V2", 0, None)
v3 = VoltageSource([ne, '0'], "V3", 0, None)

npn = NPN_VBIC([nc, nb, ne, '0'],
               "Q",
               0,
               None,
               pParams="../../__Parameter/NPN_VBIC_npn13G2.comp")
TBSys = CircuitSystemEquations([npn, r1, r2, v3, v1, v2])
print(TBSys.compDict)
ca = CircuitAnalysis(TBSys)
TBSys.atype = CircuitSystemEquations.ATYPE_DC
Beispiel #3
0
ci = 'c'

params = dict()
params["Nx"] = "1"
params["ibci"] ="1.5E-18*(1*0.25)" #"1.5E-18*(Nx*0.25)"
params["ibcn"] = "1E-15*(1*0.25)"#"1E-15*(Nx*0.25)"
params["ncn"] = "1.7"
params["nci"] = "1.05"
params["avc1"] = "2.4"
params["avc2"] = "11.5*(1*0.25)**0.01"#"11.5*(Nx*0.25)**0.01"
params["mc"] = "0.12"
params["pc"] = "0.62"

v1 = VoltageSource([bi,'0'],"V1",0,None)
ibc = IBC([bi,ci], "IBC", 0, None ,paramdict=params)
r = Resistor([ci,'0'],"R1",1e-10,None)
TBSys = CircuitSystemEquations([ibc,v1,r])
ca = CircuitAnalysis(TBSys)

x = np.arange(-0, 0.9, 0.001)
current = np.zeros((len(x), 1), dtype=np.float64)
gd = np.zeros((len(x), 1), dtype=np.float64)

TBSys.atype = CircuitSystemEquations.ATYPE_DC

for idx, v in enumerate(x):
    v1.changeMyVoltageInSys(v)
    ca.newtonRaphson(TBSys)
    current[idx] = ibc.current
    gd[idx] = ibc.gd
params["itf"] = "0.4*(1*0.25)"

dummyIT = dummyMainTransportCurrent()
Q_DBE = QDBE([bi, ei], "QDBE", 0, dummyIT, dict=params)
vsource = VoltageSource(["0", bi],
                        "V1",
                        0,
                        None,
                        dict={
                            'FUNC': 'SIN',
                            'F': '1e11',
                            'DC': '0',
                            'AC': '1',
                            'P': '180'
                        })
r1 = Resistor([ei, "0"], "R1", 0.00001, None)
TBSys = CircuitSystemEquations([Q_DBE, vsource, r1])
ca = CircuitAnalyser(TBSys)

x = np.arange(-1, 2, 0.1)
charge = np.zeros((len(x), 1), dtype=np.complex128)
capacity = np.zeros((len(x), 1), dtype=np.complex128)

for idx, v in enumerate(x):
    #vsource.changeMyVoltageInSys(v)
    dummyIT.IT.itf += 0.2e-3
    ca.calcDCOperatingPoint()
    charge[idx] = Q_DBE.getCharge()
    #capacity[idx] = Q_DBE.dQdU_A()

plt.plot(x, charge, label="charge")
Beispiel #5
0
    def __init__(self, nodes, name, value, superComponent, **kwargs):
        super(NPNTransistor_SGP, self).__init__(nodes, name, value,
                                                superComponent, **kwargs)

        self.b = self.nodes[1]
        self.c = self.nodes[0]
        self.e = self.nodes[2]

        self.bi = self.myName("bi")
        self.ci = self.myName("ci")
        self.ei = self.myName("ei")

        # Leckstrom-Dioden
        self.DL_E = Diode([self.bi, self.ei],
                          self.myName("DL_E"),
                          0,
                          self,
                          dict=self.paramDict)
        self.DL_C = Diode([self.bi, self.ci],
                          self.myName("DL_C"),
                          0,
                          self,
                          dict=self.paramDict)

        # PN-Uebergaenge
        self.DBE = Diode([self.bi, self.ei],
                         self.myName("DBE"),
                         0,
                         self,
                         dict=self.paramDict)
        self.DBC = Diode([self.ei, self.ci],
                         self.myName("DBC"),
                         0,
                         self,
                         dict=self.paramDict)

        # Transportstromquelle
        self.IT = NPNTransportCurrent([self.bi, self.ei, self.ci],
                                      self.myName("IT"),
                                      0,
                                      self,
                                      dict=self.paramDict)

        # Sperrschicht-Kapatitaeten
        self.CS_Ce = JunctionCapacity([self.b, self.ci],
                                      self.myName("CS_Ce"),
                                      0,
                                      self,
                                      dict=self.paramDict)
        self.CS_Ci = JunctionCapacity([self.bi, self.ci],
                                      self.myName("CS_Ci"),
                                      0,
                                      self,
                                      dict=self.paramDict)
        self.CS_E = JunctionCapacity([self.bi, self.ei],
                                     self.myName("CS_E"),
                                     0,
                                     self,
                                     dict=self.paramDict)

        # Diffusionskapazitateten
        #self.CD_I = DiffusionCapacity([self.bi, self.ei, self.ci], self.myName("CD_I"), 0, None, inverse=True)
        self.CD_N = DiffusionCapacity([self.bi, self.ei, self.ci],
                                      self.myName("CD_N"),
                                      0,
                                      self,
                                      dict=self.paramDict)

        # Bahnwidestaende
        self.RB = Resistor([self.b, self.bi],
                           self.myName("RB"),
                           self.myParam("RB"),
                           self,
                           dict=self.paramDict)
        self.RC = Resistor([self.c, self.ci],
                           self.myName("RC"),
                           self.myParam("RC"),
                           self,
                           dict=self.paramDict)
        self.RE = Resistor([self.e, self.ei],
                           self.myName("RE"),
                           self.myParam("RE"),
                           self,
                           dict=self.paramDict)
Beispiel #6
0
vbic_cje_mm = 1
vbic_cje = 1
CJx = 9.7E-15*(1*0.25)**0.95*1*(1+(1-1)/np.sqrt(1)) # CJE#9.7E-15*(Nx*0.25)**0.95*vbic_cje*(1+(vbic_cje_mm-1)/np.sqrt(Nx)) # CJE
P = 0.9 # PE
M = 0.105 # ME
AJ = -0.5 # AJE
WBx = 1 # WBE
F = 0.97 # FC

gnd = '0'
sigin = '1'
sigout = '2'
ik = '3'

vsource = VoltageSource([gnd,sigin],"V1",0,None,paramdict={'FUNC':'SIN','F':'1e11', 'DC':'0', 'AC':'1', 'P':'180'})
r1 = Resistor([sigin,sigout],"R1",0.00001,None)
c = VBIC_DepletionCharge([sigout, ik],"QJ", CJx, None, paramdict= {'P':P,'M':M,'F':F,'AJ':AJ,'FAK':WBx})
cref = Capacity([sigout, ik],"CR",0.35e-14, None)
r2 = Resistor([ik,gnd],"R2",1000,None)

TBSys = CircuitSystemEquations([vsource,r1,c,r2,cref])
ca = CircuitAnalyser(TBSys)

volts = [x/100 for x in range(-200,200)]
res = np.zeros((2,len(volts)),dtype= np.float64)

#for vidx,v in enumerate(volts):
#    vsource.changeMyVoltageInSys(v)
#    ca.calcDCOperatingPoint()
#    res[0][vidx] = v
#    res[1][vidx] = c.getCharge()
Beispiel #7
0
    def __init__(self, nodes, name, value, superComponent, **kwargs):
        super(NPN_VBIC, self).__init__(nodes, name, value, superComponent,
                                       **kwargs)
        '''
        Parameter
        '''

        for name, value in kwargs.items():
            if name == 'addargs':
                addargs = value
                for k in addargs:
                    if k in self.variableDict:
                        self.variableDict[k] = addargs[k]

        for v in self.variableDict:
            variableExpr = "".join((v, "=", self.variableDict[v]))
            exec(variableExpr)

        self.NR = eval(self.paramDict.get("nr", "1"))
        self.UT = eval(self.paramDict.get("ut", "0.026"))
        '''
        Knoten
        '''
        # external nodes
        self.b = self.nodes[1]
        self.c = self.nodes[0]
        self.e = self.nodes[2]
        self.s = "SUB"

        # internal nodes
        self.bi = self.myName("bi")
        self.bx = self.myName("bx")
        self.bp = self.myName("bp")
        self.ci = self.myName("ci")
        self.ei = self.myName("ei")
        self.cx = self.myName("cx")
        self.si = self.myName("si")

        # excess phase
        #self.xf1 = self.myName("xf1")
        #self.xf2 = self.myName("xf2")
        '''
        Bauteile
        '''
        # Transportstromquelle Haupttransistor
        #self.IT = MainTransportCurrent([self.c, self.b, self.e], self.myName("IT"), 0, self)
        self.IT = MainTransportCurrent([self.ci, self.bi, self.ei],
                                       self.myName("IT"),
                                       0,
                                       self,
                                       paramdict=self.paramDict,
                                       variabledict=self.variableDict)
        # Oxid - Overlap Capacities
        self.QBEO = Capacity([self.b, self.e], self.myName("QBEO"),
                             eval(self.paramDict.get("cbeo", "0")), self)
        self.QBCO = Capacity([self.b, self.e], self.myName("QBCO"),
                             eval(self.paramDict.get("cbco", "0")), self)
        self.QCSO = Capacity([self.b, self.e], self.myName("QCSO"),
                             eval(self.paramDict.get("ccso", "1e-30")), self)

        # Stroeme Haupttransistor
        self.IBE = IBE([self.bi, self.ei],
                       self.myName("IBE"),
                       0,
                       self,
                       paramdict=self.paramDict,
                       variabledict=self.variableDict)
        self.IBC = IBC([self.bi, self.ci],
                       self.myName("IBC"),
                       0,
                       self,
                       paramdict=self.paramDict,
                       variabledict=self.variableDict)
        #self.IBEX = IBE([self.bx, self.ei], self.myName("IBEX"), 0, self, isExternal=True,dict=self.paramDict) #wird bei ihp nicht mit-simuliert
        #self.IRCI = IRCI([self.cx,self.ci,self.bi],self.myName("IRCI"),0,self,paramdict=self.paramDict,variabledict=self.variableDict)
        self.bypassIRCI = Resistor([self.cx, self.ci], self.myName("RByP"),
                                   100, self)

        # Bahnwidestaende
        re = eval(self.paramDict.get("re", "5.3"))
        rbx = eval(self.paramDict.get("rbx", "8"))
        rcx = eval(self.paramDict.get("rcx", "6.5"))
        rbp = eval(self.paramDict.get("rbp", "10"))
        rs = eval(self.paramDict.get("rs", "50"))
        rbi = eval(self.paramDict.get("rbi", "20"))

        self.RE = Resistor([self.ei, self.e], self.myName("RE"), re, self)
        self.RBX = Resistor([self.b, self.bx], self.myName("RBX"), rbx, self)
        #self.RBI = RBI([self.bx, self.bi], self.myName("RBI"), 0, self,paramdict=self.paramDict,variabledict=self.variableDict)
        self.RBI = Resistor([self.bx, self.bi], self.myName("RBI"), rbi, self)
        self.RCX = Resistor([self.c, self.cx], self.myName("RCX"), rcx, self)
        self.RBP = Resistor([self.bp, self.cx], self.myName("RBP"), rbp, self)
        self.RS = Resistor([self.si, self.s], self.myName("RS"), rs, self)

        # Depletion Charges
        self.PE = eval(self.paramDict.get("pe", "0.9"))
        self.PC = eval(self.paramDict.get("pc", "0.9"))
        self.ME = eval(self.paramDict.get("me", "0.105"))
        self.MC = eval(self.paramDict.get("mc", "0.105"))
        self.MS = eval(self.paramDict.get("ms", "0.105"))
        self.FC = eval(self.paramDict.get("fc", "0.97"))
        self.PS = eval(self.paramDict.get("ps", "0.97"))
        self.AJE = eval(self.paramDict.get("aje", "-0.5"))
        self.AJS = eval(self.paramDict.get("ajs", "-0.5"))
        self.AJC = eval(self.paramDict.get("ajc", "-0.5"))
        self.WBE = eval(self.paramDict.get("wbe", "1"))
        self.CJE = eval(self.paramDict.get("cje", "9.7E-15"))
        self.CJC = eval(self.paramDict.get("cjc", "8E-16"))
        self.CJCP = eval(self.paramDict.get("cjcp", "8E-15")) * 0.3
        self.CJEP = eval(self.paramDict.get("cjep", "4.2E-15")) * 0.3

        #self.QJBEX = VBIC_DepletionCharge([self.bx, self.ei], self.myName("QJBEX"), 0, self,paramdict= {'CJx':self.CJE,'P':self.PE, 'M':self.ME,'F':self.FC, 'AJ' :self.AJE ,'FAK':(1-self.WBE)})
        self.QJBE = VBIC_DepletionCharge(
            [self.bi, self.ei],
            self.myName("QJBE"),
            0,
            self,
            paramdict={
                'CJx': self.CJE,
                'P': self.PE,
                'M': self.ME,
                'F': self.FC,
                'AJ': self.AJE,
                'FAK': self.WBE
            })
        self.QJBC = VBIC_DepletionCharge(
            [self.bi, self.ci],
            self.myName("QJBC"),
            0,
            self,
            paramdict={
                'CJx': self.CJC,
                'P': self.PC,
                'M': self.MC,
                'F': self.FC,
                'AJ': self.AJC
            })
        self.QJBCP = VBIC_DepletionCharge(
            [self.bp, self.si],
            self.myName("QJBCP"),
            0,
            self,
            paramdict={
                'CJx': self.CJCP,
                'P': self.PC,
                'M': self.MS,
                'F': self.FC,
                'AJ': self.AJS
            })
        self.QJBEP = VBIC_DepletionCharge(
            [self.bp, self.bx],
            self.myName("QJBEP"),
            0,
            self,
            paramdict={
                'CJx': self.CJEP,
                'P': self.PS,
                'M': self.MC,
                'F': self.FC,
                'AJ': self.AJC
            })

        #Diffuison Charges
        self.QDBE = QDBE([self.bi, self.ei],
                         self.myName("QDBE"),
                         0,
                         self,
                         paramdict=self.paramDict,
                         variabledict=self.variableDict)
        self.QDBC = QDBC([self.bx, self.ci],
                         self.myName("QDBC"),
                         0,
                         self,
                         paramdict=self.paramDict,
                         variabledict=self.variableDict)

        #Quasi-Saturation Charges
        #self.QBCX = QBC([self.bi, self.cx], self.myName("QBCX"),0, self, paramdict=self.paramDict)
        #self.QBCI = QBC([self.bi, self.ci], self.myName("QBCI"),0, self, paramdict=self.paramDict)

        ### Stroeme Parasitischer Transistor
        # Parasitischer Transistor:
        self.ICCP = ParasitTransportCurrent([self.bx, self.bp, self.si],
                                            self.myName("ICCP"),
                                            0,
                                            self,
                                            paramdict=self.paramDict,
                                            variabledict=self.variableDict)
        # Dioden-aehnliche Stroeme:
        self.IBCP = IBCP([self.si, self.bp],
                         self.myName("IBCP"),
                         0,
                         self,
                         paramdict=self.paramDict,
                         variabledict=self.variableDict)
        self.IBEP = IBEP([self.bx, self.bp],
                         self.myName("IBEP"),
                         0,
                         self,
                         paramdict=self.paramDict,
                         variabledict=self.variableDict)

        #self.QDBEP = QDBEP([self.bx, self.bp], self.myName("QDBEP"), 0, self,ParasitCurSource=self.ICCP,paramdict=self.paramDict,variabledict=self.variableDict)
        '''
        Hilfswiderstaende:
        '''
        self.RH1 = Resistor([self.b, self.c], self.myName("RH1"), 1e12, self)
        self.RH2 = Resistor([self.b, self.e], self.myName("RH2"), 1e12, self)
        self.RH3 = Resistor([self.bp, self.bx], self.myName("RH3"), 1e12, self)
        self.RH4 = Resistor([self.bp, self.si], self.myName("RH4"), 1e12, self)
        '''ideale Ersatzkapazitaeten'''
        #self.QJBEX = Capacity([self.bx,self.ei],self.myName("QJBEX"),1e-15,self)
        #self.QJBE = Capacity([self.bi,self.ei],self.myName("QJBE"),1e-15,self)
        #self.QJBC = Capacity([self.bi,self.ci],self.myName("QJBC"),1e-15,self)
        #self.QJBCP = Capacity([self.bp,self.si],self.myName("QJBCP"),1e-15,self)
        #self.QJBEP = Capacity([self.bp,self.bx],self.myName("QJBEP"),1e-15,self)
        self.QDBEP = Capacity([self.bx, self.ci], self.myName("QDBEP"),
                              0.5e-15, self)

        #Diffuison Charges
        #self.QDBE = Capacity([self.bi,self.ei],self.myName("QDBE"),1e-15,self)
        #self.QDBC = Capacity([self.bx,self.ci],self.myName("QDBC"),1e-15,self)

        #Quasi-Saturation Charges
        self.QBCX = Capacity([self.bi, self.cx], self.myName("QBCX"), 1e-18,
                             self)
        self.QBCI = Capacity([self.bi, self.ci], self.myName("QBCI"), 1e-18,
                             self)
Beispiel #8
0
from OSIM.Modeling.Components.Port import Port
from OSIM.Modeling.Components.Resistor import Resistor
from OSIM.Modeling.Components.NPN_Vertical_Bipolar_Intercompany_Model.NPN_VBIC import NPN_VBIC
from OSIM.Simulation.CircuitAnalysis.CircuitAnalyser import CircuitAnalyser
from OSIM.Simulation.NetToComp import NetToComp
import OSIM.Simulation.Utils as u

kbasis = 'b'
kcollector = 'c'
kv1 = 'v1'
kemitterdirekt = 'e'
kemitter = '0'

v1 = Port([kbasis, kemitter], 'V1', 0.883, None)
v2 = Port([kv1, kemitter], 'V2', 1.6, None)
r1 = Resistor([kv1, kcollector], 'R1', 500, None)
re = Resistor([kemitterdirekt, kemitter], 'RE', 0.001, None)
npn = NPN_VBIC([kcollector, kbasis, kemitterdirekt, 'SUB'],
               'Q1',
               0,
               None,
               pParams='NPN_VBIC_npn13G2.comp')
rsub = Resistor(['SUB', '0'], "R3", 264, None)
seq = CircuitSystemEquations([v1, v2, npn, r1, rsub, re])
#v1.setInnerImpedance(50)
ca = CircuitAnalyser(seq)

#for Nx in range(1,8):
#seq.setParamterForComp("Q1","Nx",1)
#npn.setParameterOrVariableValue("Nx", Nx)
#ca.plot_lin(ca.getDCParamSweep('V2',-1,1.6,0.1,["Q1IT"],'V1',[0.8]))