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])) res = ca.getACAnalysis_semilogx("V1", [kcollector], 1, 12, 10) ca.plot_semilogx(res[0]) #res = ca.getDCParamSweep('V2',0.01,1.6,0.01,["Q1IT"],'V1',[0.91]) #ca.plot_lin(res) #res = ca.getSPAnalysis_semilogx(1,12,10,["V1"]) #ca.plot_smith(res) res = res[0] toFile = open("Betragsfrequenzgang_angepasst.csv", 'w') for i in range(res[0].shape[1]): t = str((res[0])[0][i]) plot = (res[0])[1][i] real = str(float(plot.real)) imag = str(float(plot.imag)) wline = "".join((t, ",", str(plot), "\n"))
ca = CircuitAnalyser(seq) ca.printDCOp(["vCurMirror", "Q7IT", "Q6C", "LOPlus"]) imp1_180 = ca.getImpedanceAt("V1", 180e9) imp4_18 = ca.getImpedanceAt("V4", 18e9) imp5_18 = ca.getImpedanceAt("V5", 18e9) print("IMP1_180 @180G: %s" % str(imp1_180)) print("IMP4_18 @18G: %s" % str((imp4_18))) print("IMP5_18 @18G: %s" % str(imp5_18)) #print(imp6) #v1 = seq.getCompByName("V1").setInnerImpedance(imp[0]) #seq.getCompByName("V3").setInnerImpedance(imp[0]) #print(v1.getInnerImpedance()) #ca.plot_smith(ca.getSPAnalysis_semilogx(8,12,10,["V1","V3"])) ca.plot_semilogx(ca.getACAnalysis_semilogx("V1", ["Q1C"], 9, 11, 10)[0]) res = ca.getTrans(0, 0.1e-9, 1e-13, ["Q4C", "Q1C", "LOPlus"]) # how to get a diff-Signal out = np.zeros((2, res[0].shape[1]), dtype=np.float64) for i in range(res[0].shape[1]): out[0][i] = (res[0])[0][i] out[1][i] = (res[0])[1][i] - (res[0])[2][i] ca.plot_lin([out, ["diffout"], "transient"]) print("Max %G " % np.amax(out[1][:])) ca.plot_lin(res)
from OSIM.Modeling.CircuitSystemEquations import CircuitSystemEquations from OSIM.Simulation.CircuitAnalysis.CircuitAnalyser import CircuitAnalyser from OSIM.Simulation.NetToComp import NetToComp seq = CircuitSystemEquations( NetToComp('DiffAmplifier/Diffamp.net').getComponents()) ca = CircuitAnalyser(seq) ca.printDCOp(["R6", "R3", "VCurSource"]) #print(seq.x) #max = np.amax(np.absolute(seq.x)) #print(max) #ca.plot_lin(ca.getDCParamSweep('V1',1,3.3,0.05,["VoutPlus","VoutMinus"],'VCC',[3.3])) ca.plot_semilogx(ca.getACAnalysis_semilogx("V1", ["VoutPlus"], 2, 10, 11)[0])