Exemple #1
0
def _generate_interface_bounds(mb, i_n, minimum_limit, maximum_limit,
                               neg_slacks, pos_slacks):
    if neg_slacks and i_n in mb.pfi_slack_neg:
        neg_slack = mb.pfi_slack_neg[i_n]
    else:
        neg_slack = None

    if pos_slacks and i_n in mb.pfi_slack_pos:
        pos_slack = mb.pfi_slack_pos[i_n]
    else:
        pos_slack = None

    return libbranch.generate_thermal_bounds(mb.pfi[i_n], minimum_limit,
                                             maximum_limit, neg_slack,
                                             pos_slack)
Exemple #2
0
def _generate_branch_thermal_bounds(mb, bn, thermal_limit, neg_slacks,
                                    pos_slacks):
    if neg_slacks and bn in mb.pf_slack_neg:
        neg_slack = mb.pf_slack_neg[bn]
    else:
        neg_slack = None

    if pos_slacks and bn in mb.pf_slack_pos:
        pos_slack = mb.pf_slack_pos[bn]
    else:
        pos_slack = None

    return libbranch.generate_thermal_bounds(mb.pf[bn], -thermal_limit,
                                             thermal_limit, neg_slack,
                                             pos_slack)
Exemple #3
0
def _generate_contingency_bounds(mb, cn, minimum_limit, maximum_limit):
    if cn in mb.pfc_slack_pos.index_set():
        if cn not in mb.pfc_slack_pos:
            neg_slack = mb.pfc_slack_neg[cn]
            pos_slack = mb.pfc_slack_pos[cn]
            assert len(mb.pfc_slack_pos) == len(mb.pfc_slack_neg)
            new_var = True
        else:  # the constraint could have been added and removed
            neg_slack = mb.pfc_slack_neg[cn]
            pos_slack = mb.pfc_slack_pos[cn]
            new_var = False
        # initialize to 0.
        neg_slack.value = 0.
        pos_slack.value = 0.
    else:
        neg_slack = None
        pos_slack = None
        new_var = False

    return libbranch.generate_thermal_bounds(mb.pfc[cn], minimum_limit,
                                             maximum_limit, neg_slack,
                                             pos_slack), new_var
Exemple #4
0
def _generate_branch_thermal_bounds(mb, bn, thermal_limit):
    if bn in mb.pf_slack_pos.index_set():
        if bn not in mb.pf_slack_pos:
            neg_slack = mb.pf_slack_neg[bn]
            pos_slack = mb.pf_slack_pos[bn]
            assert len(mb.pf_slack_pos) == len(mb.pf_slack_neg)
            new_var = True
        else:  # the constraint could have been added and removed
            neg_slack = mb.pf_slack_neg[bn]
            pos_slack = mb.pf_slack_pos[bn]
            new_var = False
        # initialize to 0.
        neg_slack.value = 0.
        pos_slack.value = 0.
    else:
        neg_slack = None
        pos_slack = None
        new_var = False

    return libbranch.generate_thermal_bounds(mb.pf[bn], -thermal_limit,
                                             thermal_limit, neg_slack,
                                             pos_slack), new_var