Esempio n. 1
0
def load_module_specific_data(m, data_portal, scenario_directory, subproblem,
                              stage):
    """
    :param m:
    :param data_portal:
    :param scenario_directory:
    :param subproblem:
    :param stage:
    :return:
    """
    # Figure out which projects have this availability type
    project_subset = determine_project_subset(
        scenario_directory=scenario_directory,
        subproblem=subproblem,
        stage=stage,
        column="availability_type",
        type="exogenous")

    data_portal.data()["AVL_EXOG"] = {None: project_subset}

    # Availability derates
    # Get any derates from the project_availability.tab file if it exists;
    # if it does not exist, all projects will get 1 as a derate; if it does
    # exist but projects are not specified in it, they will also get 1
    # assigned as their derate
    # The test examples do not currently have a
    # project_availability_exogenous.tab, but use the default instead
    availability_file = os.path.join(scenario_directory, subproblem, stage,
                                     "inputs",
                                     "project_availability_exogenous.tab")

    if os.path.exists(availability_file):
        data_portal.load(filename=availability_file, param=m.avl_exog_derate)
    else:
        pass
Esempio n. 2
0
def load_model_data(m, d, data_portal, scenario_directory, subproblem, stage):
    """
    :param m:
    :param data_portal:
    :param scenario_directory:
    :param subproblem:
    :param stage:
    :return:
    """
    # Figure out which projects have this availability type
    project_subset = determine_project_subset(
        scenario_directory=scenario_directory,
        subproblem=subproblem,
        stage=stage,
        column="availability_type",
        type="continuous",
        prj_or_tx="project",
    )

    data_portal.data()["AVL_CONT"] = {None: project_subset}

    avl_cont_unavl_hrs_per_prd_dict = {}
    avl_cont_min_unavl_hrs_per_event_dict = {}
    avl_cont_min_avl_hrs_between_events_dict = {}

    with open(
            os.path.join(
                scenario_directory,
                str(subproblem),
                str(stage),
                "inputs",
                "project_availability_endogenous.tab",
            ),
            "r",
    ) as f:
        reader = csv.reader(f, delimiter="\t", lineterminator="\n")
        next(reader)

        for row in reader:
            if row[0] in project_subset:
                avl_cont_unavl_hrs_per_prd_dict[row[0]] = float(row[1])
                avl_cont_min_unavl_hrs_per_event_dict[row[0]] = float(row[2])
                avl_cont_min_avl_hrs_between_events_dict[row[0]] = float(
                    row[3])

    data_portal.data(
    )["avl_cont_unavl_hrs_per_prd"] = avl_cont_unavl_hrs_per_prd_dict
    data_portal.data(
    )["avl_cont_min_unavl_hrs_per_event"] = avl_cont_min_unavl_hrs_per_event_dict
    data_portal.data(
    )["avl_cont_min_avl_hrs_between_events"] = avl_cont_min_avl_hrs_between_events_dict
Esempio n. 3
0
def load_model_data(m, d, data_portal, scenario_directory, subproblem, stage):
    """
    :param m:
    :param data_portal:
    :param scenario_directory:
    :param subproblem:
    :param stage:
    :return:
    """
    # Figure out which lines have this availability type
    # TODO: move determine_project_subset and rename, as we're using for tx too
    tx_subset = determine_project_subset(
        scenario_directory=scenario_directory,
        subproblem=subproblem,
        stage=stage,
        column="tx_availability_type",
        type="exogenous_monthly",
        prj_or_tx="transmission_line",
    )

    data_portal.data()["TX_AVL_EXOG_MNTH"] = {None: tx_subset}

    # Availability derates
    # Get any derates from the tx_availability.tab file if it exists;
    # if it does not exist, all transmission lines will get 1 as a derate; if
    # it does exist but tx lines are not specified in it, they will also get 1
    # assigned as their derate
    # The test examples do not currently have a
    # transmission_availability_exogenous.tab, but use the default instead
    availability_file = os.path.join(
        scenario_directory,
        subproblem,
        stage,
        "inputs",
        "transmission_availability_exogenous_monthly.tab",
    )

    if os.path.exists(availability_file):
        data_portal.load(filename=availability_file,
                         param=m.tx_avl_exog_mnth_derate)
    else:
        pass