def get_total_current(device): tot_current = {} for contact in ['top', 'bot']: e_current = get_contact_current(device=device, contact=contact, equation=ece_name) h_current = get_contact_current(device=device, contact=contact, equation=hce_name) tot_current[contact] = e_current + h_current return tot_current['top'], tot_current['bot']
def total_current(self): current = 0 for contact in self.contacts: e_current = get_contact_current(device=self.name, contact=contact, equation=ECE_NAME) h_current = get_contact_current(device=self.name, contact=contact, equation=HCE_NAME) current += e_current + h_current return current
def get_total_current(device, ece_name="ElectronContinuityEquation", hce_name="HoleContinuityEquation"): tot_current = {} for contact in ['top', 'bot']: e_current = get_contact_current(device=device, contact=contact, equation=ece_name) h_current = get_contact_current(device=device, contact=contact, equation=hce_name) tot_current[contact] = e_current + h_current return tot_current['top'], tot_current['bot']
def print_currents(self): for c in self.mesh.contacts: e_current = get_contact_current( device=device, contact=c, equation='ElectronContinuityEquation') h_current = get_contact_current(device=device, contact=c, equation='HoleContinuityEquation') total_current = e_current + h_current voltage = get_parameter(device=device, name=self._contact_bias_name(contact)) log.info("{0}\t{1}\t{2}\t{3}\t{4}".format(contact, voltage, e_current, h_current, total_current))
def get_voltage_current(device=None, contact=None, ece_name="ElectronContinuityEquation", hce_name="HoleContinuityEquation"): ''' Return voltage and current for the device ''' if device is None: device = ds.get_device_list()[0] logger.warning(f"No device specified! Assuming '{device}'") if contact is None: contact = ds.get_contact_list(device)[0] electron_current = ds.get_contact_current(device=device, contact=contact, equation=ece_name) hole_current = ds.get_contact_current(device=device, contact=contact, equation=hce_name) total_current = electron_current + hole_current voltage = ds.get_parameter(device=device, name=f"{contact}_bias") return voltage, total_current
### Drift diffusion simulation at equilibrium ### currs = [] volts = [] bias_contact = "top_n1" for volt in range(-20, 20, 1): volt = volt / 10 volts.append(volt) ds.set_parameter(device=device, name=f"{bias_contact}_bias", value=float(volt)) ds.solve(type="dc", absolute_error=1e1, relative_error=1e-10, maximum_iterations=30) e_current = ds.get_contact_current(device=device, contact=bias_contact, equation="ElectronContinuityEquation") h_current = ds.get_contact_current(device=device, contact=bias_contact, equation="HoleContinuityEquation") current = e_current + h_current currs.append(current) print(volts, currs) plt.plot(volts, currs) #### #### Ramp the bias to 0.5 Volts #### ds.write_devices(file="nBn_ugly.dat", type="devsim") plt.show()
v = 0.0 while v < 0.51: # plot_charge([region]) set_parameter(device=device, name=GetContactBiasName("bot"), value=v) set_parameter(device=device, name=GetContactBiasName("top"), value=0.0) print(v) solve(type="dc", absolute_error=1e6, relative_error=1e-12, maximum_iterations=300) # PrintCurrents(device, "top") # PrintCurrents(device, "bot") for contact in ds.get_contact_list(device=device): e_current = abs( ds.get_contact_current(device=device, contact=contact, equation=ECE_NAME)) e_current += abs( ds.get_contact_current(device=device, contact=contact, equation=HCE_NAME)) current.append(e_current) volts.append(v) v += 0.02 # plt.show() plt.figure() plt.semilogy(volts, current) plt.figure() plt.plot(volts, current) # pydevsim.plot_charge(regions=regions) # pydevsim.plot_current(regions=regions)
#### volts = [] current = [] # v = -0.5 for v in np.linspace(-1, 1, 10): v = float(v) set_parameter(device=device, name=GetContactBiasName("top_n1"), value=v) solve(type="dc", absolute_error=1e1, relative_error=1e-2, maximum_iterations=200) # PrintCurrents(device, "top_n1") # PrintCurrents(device, "bot_n2") e_current = abs( ds.get_contact_current(device=device, contact='top_n1', equation=ECE_NAME)) e_current += abs( ds.get_contact_current(device=device, contact='top_n1', equation=HCE_NAME)) e_current += abs( ds.get_contact_current(device=device, contact='bot_n2', equation=ECE_NAME)) e_current += abs( ds.get_contact_current(device=device, contact='bot_n2', equation=HCE_NAME)) current.append(e_current) volts.append(v)