Exemple #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)
Exemple #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')
Exemple #3
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)
Exemple #4
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')
Exemple #5
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)
Exemple #6
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)
Exemple #7
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)
Exemple #8
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)