def get_op_info(self, ports_v): vn1n2 = float(ports_v[0][0]) in1n2 = float(ports_v[0][0]/self.R) power = float(ports_v[0][0]**2/self.R) arr = [[self.letter_id.upper()+self.descr,"V(n1-n2):", vn1n2, "[V]", "I(n2-n1):", in1n2, "[A]", "P:", power, "[W]"]] strarr = printing.table_setup(arr) return strarr
def get_op_info(self, ports_v): vn1n2 = float(ports_v[0][0]) qn1n2 = float(ports_v[0][0]*self.C) energy = float(.5*ports_v[0][0]**2*self.C) arr = [[self.letter_id.upper()+self.descr,"V(n1-n2):", vn1n2, "[V]", "Q:", qn1n2, "[C]", "E:", energy, "[J]"]] strarr = printing.table_setup(arr) return strarr
def write_to_file(self, filename=None): if filename is None and self.filename is None: # maybe warn the user here? return if filename is None: filename = self.filename if filename != 'stdout': fp = open(filename + "info", "w") else: fp = sys.stdout fp.write(self.timestamp + "\n") fp.write("ahkab v. " + VERSION + u" (c) 2006-2013 Giuseppe Venturini\n\n") fp.write("Operating Point (OP) analysis\n\n") fp.write("Netlist: %s\nTitle: %s\n" % (self.netlist_file, self.netlist_title)) fp.write("At %.2f K\n" % (self.temp, )) fp.write("Options:\n\tvea = %e\n\tver = %f\n\tiea = %e\n\tier = %f\n\tgmin = %e\n" \ % (self.vea, self.ver, self.iea, self.ier, self.gmin)) fp.write("\nConvergence reached in %d iterations.\n" % (self.iterations, )) fp.write("\nResults:\n") vtable = self.get_table_array() fp.write(printing.table_setup(vtable)) fp.write("\nELEMENTS OP INFORMATION:\n") for opi in self.op_info: fp.write(opi) fp.write("-------------------\n") fp.flush() if filename != 'stdout': fp.close() solution._add_data(self, self.x)
def write_to_file(self, filename=None): if filename is not None: local_filename = filename else: filename = self.filename if filename == None: return if filename != 'stdout': fp = open(filename, "w") else: fp = sys.stdout fp.write(self.timestamp+"\n") fp.write("ahkab v. "+VERSION+u" (c) 2006-2011 Giuseppe Venturini\n\n") fp.write("Operating Point (OP) analysis\n\n") fp.write("Netlist: %s\nTitle: %s\n" % (self.netlist_file, self.netlist_title)) fp.write("At %.2f K\n" % (self.temp,)) fp.write("Options:\n\tvea = %e\n\tver = %f\n\tiea = %e\n\tier = %f\n\tgmin = %e\n" %\ (self.vea, self.ver, self.iea, self.ier, self.gmin)) fp.write("\nConvergence reached in %d iterations.\n" % (self.iterations,)) fp.write("\nResults:\n") vtable = self.get_table_array() fp.write(printing.table_setup(vtable)) fp.write("\nELEMENTS OP INFORMATION:\n") for opi in self.op_info: fp.write(opi) fp.write("-------------------\n") fp.flush() if filename != 'stdout': fp.close()
def get_op_info(self, ports_v_v): vn1n2 = float(ports_v_v[0][0]) idiode = self.i(0, (vn1n2,)) gmdiode = self.g(0, (vn1n2,), 0) info = ["V(n1-n2): ", vn1n2, "[V]", "I(n1-n2):", idiode, "[A]", "P:", vn1n2*idiode, "g:", gmdiode, "[A/V]", "T:", self._get_T(), "K" ] arr = [[self.letter_id.upper()+self.descr] + info] strarr = printing.table_setup(arr) return strarr
def get_op_info(self, ports_v): vn1n2 = float(ports_v[0][0]) qn1n2 = float(ports_v[0][0] * self.value) energy = float(.5 * ports_v[0][0]**2 * self.value) arr = [[ self.part_id.upper(), "V(n1-n2):", vn1n2, "[V]", "Q:", qn1n2, "[C]", "E:", energy, "[J]" ]] strarr = printing.table_setup(arr) return strarr
def get_op_info(self, ports_v): vn1n2 = float(ports_v[0][0]) in1n2 = float(ports_v[0][0] / self.value) power = float(ports_v[0][0]**2 / self.value) arr = [[ self.part_id.upper(), "V(n1-n2):", vn1n2, "[V]", "I(n2-n1):", in1n2, "[A]", "P:", power, "[W]" ]] strarr = printing.table_setup(arr) return strarr
def get_op_info(self, ports_v_v): vn1n2 = float(ports_v_v[0][0]) idiode = self.i(0, (vn1n2, )) gmdiode = self.g(0, (vn1n2, ), 0) info = [ "V(n1-n2): ", vn1n2, "[V]", "I(n1-n2):", idiode, "[A]", "P:", vn1n2 * idiode, "g:", gmdiode, "[A/V]", "T:", self._get_T(), "K" ] arr = [[self.part_id.upper()] + info] strarr = printing.table_setup(arr) return strarr
def get_op_info(self, ports_v): """Operating point info, for design/verification. """ self.update_status_dictionary(ports_v) arr = [[self.part_id, 'STATUS:', "ON" * self.opdict['STATUS'] + "OFF" * ( not self.opdict['STATUS']), "VO [V]:", float(self.opdict['state'][0]), "VS [V]:", float(self.opdict['state'][1]), "R [ohm]:", self.opdict["R"], "I [A]:", self.opdict['I'], "", ""], ] # arr.append([ "", "", "", "", "", ""]) return printing.table_setup(arr)
def get_op_info(self, ports_v): """Operating point info, for design/verification. """ mos_type = self._get_mos_type() self.update_status_dictionary(ports_v) sat_status = "SATURATION" if self.opdict['SAT'] else "LINEAR" if not self.opdict["ON"]: status = "OFF" else: status = "ON" arr = [ [ "M" + self.descr, mos_type.upper() + " ch", status, "", "", sat_status, "", "", "", "", "", "" ], ] arr.append([ "beta", "[A/V^2]:", self.opdict['beta'], "Weff", "[m]:", str(self.opdict['W']) + " (" + str(self.device.W) + ")", "L", "[m]:", str(self.opdict['L']) + " (" + str(self.device.L) + ")", "M/N:", "", str(self.device.M) + "/" + str(self.device.N) ]) arr.append([ "Vds", "[V]:", float(ports_v[0][0]), "Vgs", "[V]:", float(ports_v[0][1]), "Vbs", "[V]:", float(ports_v[0][2]), "", "", "" ]) arr.append([ "VTH", "[V]:", self.opdict['VTH'], "VOD", "[V]:", self.opdict['VOD'], "", "", "", "VA", "[V]:", str(self.opdict['Ids'] / self.opdict['gmd']) ]) arr.append([ "Ids", "[A]:", self.opdict['Ids'], "", "", "", "", "", "", "", "", '' ]) arr.append([ "gm", "[S]:", self.opdict['gm'], "gmb", "[S]:", self.opdict['gmb'], "ro", "[Ohm]:", 1 / self.opdict['gmd'], "", "", "" ]) #arr.append([ "", "", "", "", "", ""]) return printing.table_setup(arr)
def get_op_info(self, ports_v): """Operating point info, for design/verification. """ mos_type = self._get_mos_type() self.update_status_dictionary(ports_v) sat_status = "SATURATION" if self.opdict['SAT'] else "LINEAR" if not self.opdict["ON"]: status = "OFF" else: status = "ON" arr = [["M"+self.descr, mos_type.upper()+" ch", status, "", "", sat_status, "", "", "", "", "",""],] arr.append(["beta", "[A/V^2]:", self.opdict['beta'], "Weff", "[m]:", str(self.opdict['W'])+" ("+str(self.device.W)+")", "L", "[m]:", str(self.opdict['L'])+ " ("+str(self.device.L)+")", "M/N:", "", str(self.device.M)+"/"+str(self.device.N)]) arr.append(["Vds", "[V]:", float(ports_v[0][0]), "Vgs", "[V]:", float(ports_v[0][1]), "Vbs", "[V]:", float(ports_v[0][2]), "", "", ""]) arr.append([ "VTH", "[V]:", self.opdict['VTH'], "VOD", "[V]:", self.opdict['VOD'], "", "","", "VA", "[V]:", str(self.opdict['Ids']/self.opdict['gmd'])]) arr.append(["Ids", "[A]:", self.opdict['Ids'], "", "", "", "", "", "", "", "", '']) arr.append(["gm", "[S]:", self.opdict['gm'], "gmb", "[S]:", self.opdict['gmb'], "ro", "[Ohm]:", 1/self.opdict['gmd'], "", "", ""]) #arr.append([ "", "", "", "", "", ""]) return printing.table_setup(arr)
def get_op_info(self, ports_v): """Operating point info, for design/verification. """ mos_type = self._get_mos_type() self.update_status_dictionary(ports_v) sat_status = "SATURATION" if self.opdict['SAT'] else "LINEAR" if self.opdict["WMSI"] == 0: wmsi_status = "WEAK INVERSION" if self.opdict["WMSI"] == 1: wmsi_status = "MODERATE INVERSION" if self.opdict["WMSI"] == 2: wmsi_status = "STRONG INVERSION" arr = [["M"+self.descr, mos_type.upper()+" ch",wmsi_status, "", "", sat_status, "", "", "", "", "",""],] arr.append(["beta", "[A/V^2]:", self.opdict['beta'], "Weff", "[m]:", str(self.opdict['Weff'])+" ("+str(self.device.W)+")", "Leff", "[m]:", str(self.opdict['Leff'])+ " ("+str(self.device.L)+")", "M/N:", "", str(self.device.M)+"/"+str(self.device.N)]) arr.append(["Vdb", "[V]:", float(ports_v[0][0]), "Vgb", "[V]:", float(ports_v[0][1]), "Vsb", "[V]:", float(ports_v[0][2]), "Vp", "[V]:", self.opdict['Vp'],]) arr.append([ "VTH", "[V]:", self.opdict['VTH'], "VOD", "[V]:", self.opdict['VOD'], "nq: ", "",self.opdict['nq'], "VA", "[V]:", str(self.opdict['Ids']/self.opdict['gmd'])]) arr.append(["Ids", "[A]:", self.opdict['Ids'], "nv: ", "",self.opdict['nv'], "Ispec", "[A]:", self.opdict["Ispec"], "TEF:", "", str(self.opdict['TEF']),]) arr.append(["gmg", "[S]:", self.opdict['gmg'], "gms", "[S]:", self.opdict['gms'], "rob", "[Ohm]:", 1/self.opdict['gmd'], "", "", ""]) arr.append(["if:", "", self.opdict['ifn'],"ir:", "", self.opdict['irn'], "Qf", "[C/m^2]:", self.opdict["qf"], "Qr", "[C/m^2]:", self.opdict["qr"],]) #arr.append([ "", "", "", "", "", ""]) return printing.table_setup(arr)
def get_op_info(self, ports_v): """Operating point info, for design/verification. """ mos_type = self._get_mos_type() self.update_status_dictionary(ports_v) sat_status = "SATURATION" if self.opdict['SAT'] else "LINEAR" if self.opdict["WMSI"] == 0: wmsi_status = "WEAK INVERSION" if self.opdict["WMSI"] == 1: wmsi_status = "MODERATE INVERSION" if self.opdict["WMSI"] == 2: wmsi_status = "STRONG INVERSION" arr = [ [ self.part_id, mos_type.upper() + " ch", wmsi_status, "", "", sat_status, "", "", "", "", "", "" ], ] arr.append([ "beta", "[A/V^2]:", self.opdict['beta'], "Weff", "[m]:", str(self.opdict['Weff']) + " (" + str(self.device.W) + ")", "Leff", "[m]:", str(self.opdict['Leff']) + " (" + str(self.device.L) + ")", "M/N:", "", str(self.device.M) + "/" + str(self.device.N) ]) arr.append([ "Vdb", "[V]:", float(ports_v[0][0]), "Vgb", "[V]:", float(ports_v[0][1]), "Vsb", "[V]:", float(ports_v[0][2]), "Vp", "[V]:", self.opdict['Vp'], ]) arr.append([ "VTH", "[V]:", self.opdict['VTH'], "VOD", "[V]:", self.opdict['VOD'], "nq: ", "", self.opdict['nq'], "VA", "[V]:", str(self.opdict['Ids'] / self.opdict['gmd']) ]) arr.append([ "Ids", "[A]:", self.opdict['Ids'], "nv: ", "", self.opdict['nv'], "Ispec", "[A]:", self.opdict["Ispec"], "TEF:", "", str(self.opdict['TEF']), ]) arr.append([ "gmg", "[S]:", self.opdict['gmg'], "gms", "[S]:", self.opdict['gms'], "rob", "[Ohm]:", 1 / self.opdict['gmd'], "", "", "" ]) arr.append([ "if:", "", self.opdict['ifn'], "ir:", "", self.opdict['irn'], "Qf", "[C/m^2]:", self.opdict["qf"], "Qr", "[C/m^2]:", self.opdict["qr"], ]) # arr.append([ "", "", "", "", "", ""]) return printing.table_setup(arr)