예제 #1
0
def get_ds_status():
    devices = ds.get_device_list()
    for device in devices:
        print("Device: " + device)
        regions = ds.get_region_list(device=device)
        for region in regions:
            print("\tRegion :" + region)
            params = ds.get_parameter_list(device=device, region=region)
            for param in params:
                val = ds.get_parameter(device=device,
                                       region=region,
                                       name=param)
                print(f"\t\t{param} = {val}")
            n_models = ds.get_node_model_list(device=device, region=region)
            for node_model in n_models:
                nmvals = ds.get_node_model_values(device=device,
                                                  region=region,
                                                  name=node_model)
                print(f"\t\t Node Model '{node_model}' = {nmvals!s}")
            e_models = ds.get_edge_model_list(device=device, region=region)
            for edge_model in e_models:
                emvals = ds.get_edge_model_values(device=device,
                                                  region=region,
                                                  name=edge_model)
                print(f"\t\t Edge Model '{edge_model}' = {emvals!s}")
        contacts = ds.get_contact_list(device=device)
        for contact in contacts:
            print("\tContact : " + contact)
            c_eqs = ds.get_contact_equation_list(device=device,
                                                 contact=contact)
            for ceq in c_eqs:
                print("\t\tContact Equation : " + ceq)
예제 #2
0
def plot_charge(device=None,regions=None, charge_names=None):
    """
    Plots the charge along the device
    :param device:
    :param regions:
    :param charge_names:
    :return:
    """
    if device is None:
        device = ds.get_device_list()[0]
    if regions is None:
        regions = ds.get_region_list(device=device)
    if charge_names is None:
        charge_names = ("Electrons", "Holes", "Donors", "Acceptors")
    plt.figure(figsize=(6, 2.7))
    labels = []
    for var_name in charge_names:
        total_x = np.array([])
        total_y = []
        for region in regions:
            labels.append(f"{var_name} in {region}")
            x = np.array(ds.get_node_model_values(device=device, region=region, name="x"))
            # print(var_name, min(x), max(x), min(x)*1e4, max(x)*1e4)
            total_x = np.append(total_x, x)
            y=ds.get_node_model_values(device=device, region=region, name=var_name)
            total_y.extend(y)
        # plt.axis([min(x), max(x), ymin, ymax])
            plt.semilogy(x*1e4, y)
    plt.xlabel('x (um)')
    plt.ylabel('Density (#/cm^3)')
    plt.legend(labels)
    plt.title('Charge Density')
예제 #3
0
def create_thermionic_interface(interface_tag,
                                device=None,
                                e_name='Electrons',
                                h_name='Holes',
                                aff_name='Affinity',
                                vtherm_e='vtherm_e',
                                vtherm_h='vtherm_h',
                                eg_name='EG',
                                ece_name='ElectronContinuityEquation',
                                hce_name='HoleContinuityEquation'):
    if device is None:
        device = ds.get_device_list()[0]
    CreateSiliconOxideInterface(
        device,
        interface_tag)  # Makes the potential continuous across the border?
    delta_EC = f'({aff_name}@r1-{aff_name}@r0)'
    Jn1to2 = f'{vtherm_e}@r0*{e_name}@r0*exp(-{delta_EC}/(k*T)*(step({delta_EC})))'
    Jn2to1 = f'{vtherm_e}@r1*{e_name}@r1*exp(-{delta_EC}/(k*T)*(1-step({delta_EC})))'
    Jn_int = Jn1to2 + " - " + Jn2to1
    delta_EV = f'{eg_name}@r1-{eg_name}@r0+{aff_name}@r1-{aff_name}@r0'
    Jp1to2 = f'{vtherm_h}@r0*{h_name}@r0*exp(-{delta_EV}/(k*T)*(1-step({delta_EV})))'
    Jp2to1 = f'{vtherm_h}@r1*{h_name}@r1*exp(-{delta_EV}/(k*T)*(step({delta_EV})))'
    Jp_int = Jp1to2 + " - " + Jp2to1
    for name, eq, current_eq in [('thermionic_n', Jn_int, ece_name),
                                 ('thermionic_p', Jp_int, hce_name)]:
        ds.interface_model(device=device,
                           interface=interface_tag,
                           name=name,
                           equation=eq)
        ds.interface_equation(device=device,
                              interface=interface_tag,
                              name=current_eq,
                              variable_name=e_name,
                              interface_model=name,
                              type='continuous')
예제 #4
0
def get_ds_status(short=True):
    """
    Prints the status of the current devsim setup and all variables, solutions, node models and edge models
    :return:
    """
    for device in ds.get_device_list():
        print("Device: " + device)
        for region in ds.get_region_list(device=device):
            print("\tRegion :" + region)
            params = ds.get_parameter_list(device=device, region=region)
            for param in params:
                val = ds.get_parameter(device=device,
                                       region=region,
                                       name=param)
                print(f"\t\t{param} = {val}")
            for node_model in ds.get_node_model_list(device=device,
                                                     region=region):
                nmvals = ds.get_node_model_values(device=device,
                                                  region=region,
                                                  name=node_model)
                nmstr = ','.join([f'{val:.3g}' for val in nmvals])
                print(f"\t\tNode Model '{node_model}' = {nmstr!s}")
            e_models = ds.get_edge_model_list(device=device, region=region)
            for edge_model in e_models:
                emvals = ds.get_edge_model_values(device=device,
                                                  region=region,
                                                  name=edge_model)
                emstr = ','.join([f'{val:.3g}' for val in emvals])
                print(f"\t\tEdge Model '{edge_model}' = {emstr}")
        for interface in ds.get_interface_list(device=device):
            print("\tInterface: " + interface)
            for imodel in ds.get_interface_model_list(device=device,
                                                      interface=interface):
                intstr = ','.join([
                    f'{val:.3g}' for val in ds.get_interface_model_values(
                        device=device, interface=interface, name=imodel)
                ])
                print(f"\t\tInterface Model: '{imodel}' = {intstr}")
            for ieq in ds.get_interface_equation_list(device=device,
                                                      interface=interface):
                # comm = ds.get_interface_equation_command(device=device, interface=interface, name=ieq)
                print(f"\t\tInterface Equation: {ieq}")
        contacts = ds.get_contact_list(device=device)
        for contact in contacts:
            print("\tContact : " + contact)
            c_eqs = ds.get_contact_equation_list(device=device,
                                                 contact=contact)
            for ceq in c_eqs:
                print("\t\tContact Equation : " + ceq)
예제 #5
0
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
예제 #6
0
def plot_band_diagram(device=None, regions=None, ec_name='EC', ev_name='EV'):
    if device is None:
        device = ds.get_device_list()[0]
    if regions is None:
        regions = ds.get_region_list(device=device)
    plt.figure(figsize=(6, 2.7))
    labels = []
    for region in regions:
        x = np.array(ds.get_node_model_values(device=device, region=region, name="x"))
        for band in [ec_name, ev_name]:
            band_edge = ds.get_node_model_values(device=device, region=region, name=band)
            plt.plot(x * 1e4, band_edge, marker='o', linestyle='-', markersize=3)
            labels.append(f'{band} in {region}')
    plt.legend(labels)
    plt.xlabel('x (µm)')
    plt.ylabel('Energy (eV)')
    plt.title('Band Diagram')
예제 #7
0
def plot_potential(device=None, regions=None, potential='Potential'):
    if device is None:
        device = ds.get_device_list()[0]
    if regions is None:
        regions = ds.get_region_list(device=device)
    plt.figure()
    pots = np.array([])
    total_x = np.array([])
    for region in regions:
        x = np.array(ds.get_node_model_values(device=device, region=region, name="x"))
        # print(var_name, min(x), max(x), min(x)*1e4, max(x)*1e4)
        total_x = np.append(total_x, x)
        new_pots = ds.get_node_model_values(device=device, region=region, name=potential)
        pots = np.append(pots, new_pots)
        plt.plot(x*1e4, new_pots, marker='o', linestyle='-', markersize=3)
    plt.legend(regions)
    # plt.plot(total_x*1e4, pots)
    plt.xlabel('X (um)')
    plt.ylabel('Potential (V)')
    plt.title(potential)
예제 #8
0
def get_ds_equations():
    devices = ds.get_device_list()
    for device in devices:
        print("Device: " + device)
        regions = ds.get_region_list(device=device)
        for region in regions:
            print("\tRegion :" + region)
            eqs = ds.get_equation_list(device=device, region=region)
            print(f"\t\t{eqs!s}")
            # params = ds.get_parameter_list(device=device, region=region)
            for eq in eqs:
                val = ds.get_equation_command(device=device,
                                              region=region,
                                              name=eq)
                print(f"\t\t{eq} = {val}")
        contacts = ds.get_contact_list(device=device)
        for contact in contacts:
            print("\tContact : " + contact)
            c_eqs = ds.get_contact_equation_list(device=device,
                                                 contact=contact)
            for ceq in c_eqs:
                print("\t\tContact Equation : " + ceq)
예제 #9
0
def create_solution(device=None, regions=None, name=None):
    """
    Creates a variable to be solved during the simulation
    Also creates the edge models for the node solution so you have access on edges and nodes
    :param device:
    :param region:
    :param name:
    :return:
    """
    if device is None:
        device = ds.get_device_list()[0]
    if regions is None:
        regions = ds.get_region_list(device=device)
    if type(regions) is str:
        regions = [regions]
    try:
        regions[0]
    except IndexError:
        regions = [regions]
    for region in regions:
        ds.node_solution(name=name, device=device, region=region)
        ds.edge_from_node_model(node_model=name, device=device, region=region)
예제 #10
0
def plot_current(device=None, regions=None, current_names=None, title='Current Density'):
    if device is None:
        device = ds.get_device_list()[0]
    if regions is None:
        regions = ds.get_region_list(device=device)
    if current_names is None:
        current_names = ('Jn', 'Jp')
    plt.figure()
    for var_name in current_names:
        total_x = np.array([])
        total_y = []
        for region in regions:
            ds.edge_average_model(device=device, region=region, node_model="x", edge_model="xmid")
            x = np.array(ds.get_edge_model_values(device=device, region=region, name="xmid"))
            # print(var_name, min(x), max(x), min(x)*1e4, max(x)*1e4)
            total_x = np.append(total_x, x)
            y=ds.get_edge_model_values(device=device, region=region, name=var_name)
            total_y.extend(y)
        # plt.axis([min(x), max(x), ymin, ymax])
        plt.plot(np.array(total_x)*1e4, total_y)
    plt.xlabel('x (um)')
    plt.ylabel('Current (A/cm^2)')
    plt.legend(current_names)
    plt.title(title)