OPF in AMPL — amplpower 0.0.0 documentation

# OPF in AMPL

Optimal Power Flow

      1########## SETS ##########
      2
      3set N;
      4set G;
      5set L;
      6
      7########## PARAMETERS ##########
      8
      9param OPF_TYPE symbolic;
     10param CONNECTIVITY symbolic;
     11param BASEMVA;
     12param MAXVOL;
     13param MINVOL;
     14param MAXANGLE;
     15param MINANGLE;
     16param COST_2 {G};
     17param COST_1 {G};
     18param COST_0 {G};
     19param PG {G};
     20param QG {G};
     21param PMAX {G};
     22param PMIN {G};
     23param QMAX {G};
     24param QMIN {G};
     25param GEN_BUS {G};
     26param PD {N};
     27param QD {N};
     28param GS {N};
     29param BS {N};
     30param VMAX {N};
     31param VMIN {N};
     32param AMAX {N};
     33param AMIN {N};
     34param VOL0 {N};
     35param ANG0 {N};
     36param VOLR0 {N};
     37param VOLI0 {N};
     38param CF {L,N};
     39param CT {L,N};
     40param CG {G,N};
     41param GFF {L};
     42param BFF {L};
     43param GFT {L};
     44param BFT {L};
     45param GTF {L};
     46param BTF {L};
     47param GTT {L};
     48param BTT {L};
     49param BUS_I {N};
     50param BUS_TYPE {N};
     51param BUS_AREA {N};
     52param VM {N};
     53param VA {N};
     54param BASE_KV {N};
     55param ZONE {N};
     56param F_BUS {L};
     57param T_BUS {L};
     58param BR_R {L};
     59param BR_X {L};
     60param BR_B {L};
     61param RATE_A {L};
     62param RATE_B {L};
     63param RATE_C {L};
     64param TAP {L};
     65param SHIFT {L};
     66param BR_STATUS {L};
     67param ANGMIN {L};
     68param ANGMAX {L};
     69param VG {G};
     70param MBASE {G};
     71param GEN_STATUS {G};
     72param PC1 {G};
     73param PC2 {G};
     74param QC1MIN {G};
     75param QC1MAX {G};
     76param QC2MIN {G};
     77param QC2MAX {G};
     78param RAMP_AGC {G};
     79param RAMP_10 {G};
     80param RAMP_30 {G};
     81param RAMP_Q {G};
     82param APF {G};
     83param MODEL {G};
     84param STARTUP {G};
     85param SHUTDOWN {G};
     86param NCOST {G};
     87param PG0 {G};
     88param QG0 {G};
     89param PF0 {L};
     90param QF0 {L};
     91param PT0 {L};
     92param QT0 {L};
     93param PFLODC {L};
     94param PFUPDC {L};
     95param PFLOAC {L};
     96param PFUPAC {L};
     97param PTLOAC {L};
     98param PTUPAC {L};
     99param QFLOAC {L};
    100param QFUPAC {L};
    101param QTLOAC {L};
    102param QTUPAC {L};
    103param COSFTMAX {L};
    104param COSFTMIN {L};
    105param SINFTMAX {L};
    106param SINFTMIN {L};
    107
    108########## VARIABLES ##########
    109
    110var Pg {g in G} >= PMIN[g], <= PMAX[g]:= PG0[g];
    111var Qg {g in G} >= QMIN[g], <= QMAX[g]:= QG0[g];
    112var Pf {l in L} >= -RATE_A[l], <=RATE_A[l] := PF0[l];
    113var Pt {l in L} >= -RATE_A[l], <=RATE_A[l] := PT0[l];
    114var Qf {l in L} >= -RATE_A[l], <=RATE_A[l] := QF0[l];
    115var Qt {l in L} >= -RATE_A[l], <=RATE_A[l] := QT0[l];
    116var Vm {n in N} >= VMIN[n], <= VMAX[n] := VOL0[n];
    117var Vr {n in N} >= 0, <=VMAX[n] := VOLR0[n];
    118var Vi {n in N} >= -VMAX[n], <=VMAX[n] := VOLI0[n];
    119var V2 {n in N} >= VMIN[n]^2, <= VMAX[n]^2 := VOL0[n]^2;
    120var Va {n in N} >= AMIN[n], <= AMAX[n] := ANG0[n];
    121var cosft {l in L} >= COSFTMIN[l], <= COSFTMAX[l] := VOL0[F_BUS[l]]*VOL0[T_BUS[l]]*cos(ANG0[F_BUS[l]]-ANG0[T_BUS[l]]);
    122var sinft {l in L} >= SINFTMIN[l], <= SINFTMAX[l] := VOL0[F_BUS[l]]*VOL0[T_BUS[l]]*sin(ANG0[F_BUS[l]]-ANG0[T_BUS[l]]);
    123var Pfa {l in L} >= min(PFLODC[l],PFLOAC[l]), <= max(PFUPDC[l],PFUPAC[l]) := PF0[l];
    124var Pta {l in L} >= PTLOAC[l], <= PTUPAC[l] := PT0[l];
    125var Qfa {l in L} >= QFLOAC[l], <= QFUPAC[l] := QF0[l];
    126var Qta {l in L} >= QTLOAC[l], <= QTUPAC[l] := QT0[l];
    127var u {n in N} >= 1, <= card(N);
    128var status {l in L} binary;
    129var statusf {l in L} binary;
    130var statust {l in L} binary;
    131
    132########## OBJECTIVE FUNCTION ##########
    133
    134minimize total_cost:
    135    sum {g in G} (COST_2[g] * (BASEMVA*Pg[g])^2 + COST_1[g] * (BASEMVA*Pg[g]) + COST_0[g]);
    136
    137########## POWER BALANCE ##########
    138
    139subject to active_power_balance_1 {n in N:OPF_TYPE='dc'}:
    140    sum {g in G} CG[g,n] * Pg[g] - PD[n] = sum {l in L} (CF[l,n] * Pf[l] + CT[l,n] * Pt[l]);
    141
    142subject to active_power_balance_2 {n in N:OPF_TYPE='acpolar'}:
    143    sum {g in G} CG[g,n] * Pg[g] - PD[n] = GS[n]*Vm[n]*Vm[n] + sum {l in L} (CF[l,n] * Pf[l] + CT[l,n] * Pt[l]);
    144
    145subject to reactive_power_balance_2 {n in N:OPF_TYPE='acpolar'}:
    146    sum {g in G} CG[g,n] * Qg[g] - QD[n] = -BS[n]*Vm[n]*Vm[n] + sum {l in L} (CF[l,n] * Qf[l] + CT[l,n] * Qt[l]);
    147
    148subject to active_power_balance_3_4 {n in N: OPF_TYPE = 'acrect' or OPF_TYPE = 'acjabr'}:
    149    sum {g in G} CG[g,n] * Pg[g] - PD[n] = GS[n]*V2[n] + sum {l in L} (CF[l,n] * Pf[l] + CT[l,n] * Pt[l]);
    150
    151subject to reactive_power_balance_3_4 {n in N: OPF_TYPE = 'acrect' or OPF_TYPE = 'acjabr'}:
    152    sum {g in G} CG[g,n] * Qg[g] - QD[n] = -BS[n]*V2[n] + sum {l in L} (CF[l,n] * Qf[l] + CT[l,n] * Qt[l]);
    153
    154########## POWER FLOW DEFINITIONS (BR_STATUS = 0) ##########
    155
    156subject to active_flow_from_0 {l in L:BR_STATUS[l] == 0}:
    157    Pf[l] = 0;
    158
    159subject to active_flow_to_0 {l in L:BR_STATUS[l] == 0}:
    160    Pt[l] = 0;
    161
    162subject to reactive_flow_from_0 {l in L:BR_STATUS[l] == 0}:
    163    Qf[l] = 0;
    164
    165subject to reactive_flow_to_0 {l in L:BR_STATUS[l] == 0}:
    166    Qt[l] = 0;
    167
    168########## POWER FLOW DEFINITIONS (BR_STATUS = 1) ##########
    169
    170subject to active_flow_from_1 {l in L:OPF_TYPE='dc' and BR_STATUS[l] == 1}:
    171    Pf[l] = (1 / BR_X[l]) * (Va[F_BUS[l]] - Va[T_BUS[l]]);
    172
    173subject to active_flow_to_1 {l in L:OPF_TYPE='dc' and BR_STATUS[l] == 1}:
    174    Pt[l] = (1 / BR_X[l]) * (Va[T_BUS[l]] - Va[F_BUS[l]]);
    175
    176subject to active_flow_from_2 {l in L:OPF_TYPE='acpolar' and BR_STATUS[l] == 1}:
    177    Pf[l] = GFF[l]*Vm[F_BUS[l]]*Vm[F_BUS[l]] + Vm[F_BUS[l]]*Vm[T_BUS[l]]*(GFT[l]*cos(Va[F_BUS[l]]-Va[T_BUS[l]])+BFT[l]*sin(Va[F_BUS[l]]-Va[T_BUS[l]]));
    178
    179subject to active_flow_to_2 {l in L:OPF_TYPE='acpolar' and BR_STATUS[l] == 1}:
    180    Pt[l] = GTT[l]*Vm[T_BUS[l]]*Vm[T_BUS[l]] + Vm[F_BUS[l]]*Vm[T_BUS[l]]*(GTF[l]*cos(Va[T_BUS[l]]-Va[F_BUS[l]])+BTF[l]*sin(Va[T_BUS[l]]-Va[F_BUS[l]]));
    181
    182subject to reactive_flow_from_2 {l in L:OPF_TYPE='acpolar' and BR_STATUS[l] == 1}:
    183    Qf[l] = -BFF[l]*Vm[F_BUS[l]]*Vm[F_BUS[l]] - Vm[F_BUS[l]]*Vm[T_BUS[l]]*(BFT[l]*cos(Va[F_BUS[l]]-Va[T_BUS[l]])-GFT[l]*sin(Va[F_BUS[l]]-Va[T_BUS[l]]));
    184
    185subject to reactive_flow_to_2 {l in L:OPF_TYPE='acpolar' and BR_STATUS[l] == 1}:
    186    Qt[l] = -BTT[l]*Vm[T_BUS[l]]*Vm[T_BUS[l]] - Vm[F_BUS[l]]*Vm[T_BUS[l]]*(BTF[l]*cos(Va[T_BUS[l]]-Va[F_BUS[l]])-GTF[l]*sin(Va[T_BUS[l]]-Va[F_BUS[l]]));
    187
    188subject to active_flow_from_3_4 {l in L:(OPF_TYPE='acrect' or OPF_TYPE = 'acjabr') and BR_STATUS[l] == 1}:
    189    Pf[l] = GFF[l]*V2[F_BUS[l]] + GFT[l]*cosft[l] + BFT[l]*sinft[l];
    190
    191subject to active_flow_to_3_4 {l in L:(OPF_TYPE='acrect' or OPF_TYPE = 'acjabr') and BR_STATUS[l] == 1}:
    192    Pt[l] = GTT[l]*V2[T_BUS[l]] + GTF[l]*cosft[l] - BTF[l]*sinft[l];
    193
    194subject to reactive_flow_from_3_4 {l in L:(OPF_TYPE='acrect' or OPF_TYPE = 'acjabr') and BR_STATUS[l] == 1}:
    195    Qf[l] = -BFF[l]*V2[F_BUS[l]] - BFT[l]*cosft[l] + GFT[l]*sinft[l];
    196
    197subject to reactive_flow_to_3_4 {l in L:(OPF_TYPE='acrect' or OPF_TYPE = 'acjabr') and BR_STATUS[l] == 1}:
    198    Qt[l] = -BTT[l]*V2[T_BUS[l]] - BTF[l]*cosft[l] - GTF[l]*sinft[l];
    199
    200########## POWER FLOW DEFINITIONS (BR_STATUS = 2) ##########
    201
    202subject to active_flow_from_1_switch {l in L: OPF_TYPE == 'dc' and BR_STATUS[l] == 2}:
    203    Pf[l] = status[l] * (1 / BR_X[l]) * (Va[F_BUS[l]] - Va[T_BUS[l]]);
    204
    205subject to active_flow_to_1_switch {l in L: OPF_TYPE == 'dc' and BR_STATUS[l] == 2}:
    206    Pt[l] = status[l] * (1 / BR_X[l]) * (Va[T_BUS[l]] - Va[F_BUS[l]]);
    207
    208subject to active_flow_from_2_switch {l in L: OPF_TYPE == 'acpolar' and BR_STATUS[l] == 2}:
    209    Pf[l] = status[l] * (GFF[l]*Vm[F_BUS[l]]*Vm[F_BUS[l]] + Vm[F_BUS[l]]*Vm[T_BUS[l]]*(GFT[l]*cos(Va[F_BUS[l]]-Va[T_BUS[l]])+BFT[l]*sin(Va[F_BUS[l]]-Va[T_BUS[l]])));
    210
    211subject to active_flow_to_2_switch {l in L: OPF_TYPE == 'acpolar' and BR_STATUS[l] == 2}:
    212    Pt[l] = status[l] * (GTT[l]*Vm[T_BUS[l]]*Vm[T_BUS[l]] + Vm[F_BUS[l]]*Vm[T_BUS[l]]*(GTF[l]*cos(Va[T_BUS[l]]-Va[F_BUS[l]])+BTF[l]*sin(Va[T_BUS[l]]-Va[F_BUS[l]])));
    213
    214subject to reactive_flow_from_2_switch {l in L: OPF_TYPE == 'acpolar' and BR_STATUS[l] == 2}:
    215    Qf[l] = status[l] * (-BFF[l]*Vm[F_BUS[l]]*Vm[F_BUS[l]] - Vm[F_BUS[l]]*Vm[T_BUS[l]]*(BFT[l]*cos(Va[F_BUS[l]]-Va[T_BUS[l]])-GFT[l]*sin(Va[F_BUS[l]]-Va[T_BUS[l]])));
    216
    217subject to reactive_flow_to_2_switch {l in L: OPF_TYPE == 'acpolar' and BR_STATUS[l] == 2}:
    218    Qt[l] = status[l] * (-BTT[l]*Vm[T_BUS[l]]*Vm[T_BUS[l]] - Vm[F_BUS[l]]*Vm[T_BUS[l]]*(BTF[l]*cos(Va[T_BUS[l]]-Va[F_BUS[l]])-GTF[l]*sin(Va[T_BUS[l]]-Va[F_BUS[l]])));
    219
    220subject to active_flow_from_3_4_switch {l in L: (OPF_TYPE == 'acrect' or OPF_TYPE == 'acjabr') and BR_STATUS[l] == 2}:
    221    Pf[l] = status[l] * (GFF[l]*V2[F_BUS[l]] + GFT[l]*cosft[l] + BFT[l]*sinft[l]);
    222
    223subject to active_flow_to_3_4_switch {l in L: (OPF_TYPE == 'acrect' or OPF_TYPE == 'acjabr') and BR_STATUS[l] == 2}:
    224    Pt[l] = status[l] * (GTT[l]*V2[T_BUS[l]] + GTF[l]*cosft[l] - BTF[l]*sinft[l]);
    225
    226subject to reactive_flow_from_3_4_switch {l in L: (OPF_TYPE == 'acrect' or OPF_TYPE == 'acjabr') and BR_STATUS[l] == 2}:
    227    Qf[l] = status[l] * (-BFF[l]*V2[F_BUS[l]] - BFT[l]*cosft[l] + GFT[l]*sinft[l]);
    228
    229subject to reactive_flow_to_3_4_switch {l in L: (OPF_TYPE == 'acrect' or OPF_TYPE == 'acjabr') and BR_STATUS[l] == 2}:
    230    Qt[l] = status[l] * (-BTT[l]*V2[T_BUS[l]] - BTF[l]*cosft[l] - GTF[l]*sinft[l]);
    231
    232########## POWER FLOW DEFINITIONS (BR_STATUS = 3) ##########
    233
    234subject to active_flow_from_1_bigm {l in L: OPF_TYPE == 'dc' and BR_STATUS[l] == 3}:
    235    Pfa[l] = (1 / BR_X[l]) * (Va[F_BUS[l]] - Va[T_BUS[l]]);
    236
    237subject to active_flow_to_1_bigm {l in L: OPF_TYPE == 'dc' and BR_STATUS[l] == 3}:
    238    Pta[l] = (1 / BR_X[l]) * (Va[T_BUS[l]] - Va[F_BUS[l]]);
    239
    240subject to Pfa_lower_1 {l in L: OPF_TYPE == 'dc' and BR_STATUS[l] == 3}:
    241    PFLODC[l] * (1 - status[l]) <= -Pf[l] + Pfa[l];
    242
    243subject to Pfa_upper_1 {l in L: OPF_TYPE == 'dc' and BR_STATUS[l] == 3}:
    244    -Pf[l] + Pfa[l] <= PFUPDC[l] * (1 - status[l]);
    245
    246subject to Pta_lower_1 {l in L: OPF_TYPE == 'dc' and BR_STATUS[l] == 3}:
    247    PFLODC[l] * (1 - status[l]) <= -Pt[l] + Pta[l];
    248
    249subject to Pta_upper_1 {l in L: OPF_TYPE == 'dc' and BR_STATUS[l] == 3}:
    250    -Pt[l] + Pta[l] <= PFUPDC[l] * (1 - status[l]);
    251
    252subject to active_flow_from_2_bigm {l in L: (OPF_TYPE == 'acrect' or OPF_TYPE == 'acjabr') and BR_STATUS[l] == 3}:
    253    Pfa[l] = GFF[l] * V2[F_BUS[l]] + GFT[l] * cosft[l] + BFT[l] * sinft[l];
    254
    255subject to active_flow_to_2_bigm {l in L: (OPF_TYPE == 'acrect' or OPF_TYPE == 'acjabr') and BR_STATUS[l] == 3}:
    256    Pta[l] = GTT[l] * V2[T_BUS[l]] + GTF[l] * cosft[l] - BTF[l] * sinft[l];
    257
    258subject to reactive_flow_from_2_bigm {l in L: (OPF_TYPE == 'acrect' or OPF_TYPE == 'acjabr') and BR_STATUS[l] == 3}:
    259    Qfa[l] = -BFF[l] * V2[F_BUS[l]] - BFT[l] * cosft[l] + GFT[l] * sinft[l];
    260
    261subject to reactive_flow_to_2_bigm {l in L: (OPF_TYPE == 'acrect' or OPF_TYPE == 'acjabr') and BR_STATUS[l] == 3}:
    262    Qta[l] = -BTT[l] * V2[T_BUS[l]] - BTF[l] * cosft[l] - GTF[l] * sinft[l];
    263
    264subject to Pfa_lower_2 {l in L: (OPF_TYPE == 'acrect' or OPF_TYPE == 'acjabr') and BR_STATUS[l] == 3}:
    265    PFLOAC[l] * (1 - status[l]) <= -Pf[l] + Pfa[l];
    266
    267subject to Pfa_upper_2 {l in L: (OPF_TYPE == 'acrect' or OPF_TYPE == 'acjabr') and BR_STATUS[l] == 3}:
    268    -Pf[l] + Pfa[l] <= PFUPAC[l] * (1 - status[l]);
    269
    270subject to Pta_lower_2 {l in L: (OPF_TYPE == 'acrect' or OPF_TYPE == 'acjabr') and BR_STATUS[l] == 3}:
    271    PTLOAC[l] * (1 - status[l]) <= -Pt[l] + Pta[l];
    272
    273subject to Pta_upper_2 {l in L: (OPF_TYPE == 'acrect' or OPF_TYPE == 'acjabr') and BR_STATUS[l] == 3}:
    274    -Pt[l] + Pta[l] <= PTUPAC[l] * (1 - status[l]);
    275
    276subject to Qfa_lower_2 {l in L: (OPF_TYPE == 'acrect' or OPF_TYPE == 'acjabr') and BR_STATUS[l] == 3}:
    277    QFLOAC[l] * (1 - status[l]) <= -Qf[l] + Qfa[l];
    278
    279subject to Qfa_upper_2 {l in L: (OPF_TYPE == 'acrect' or OPF_TYPE == 'acjabr') and BR_STATUS[l] == 3}:
    280    -Qf[l] + Qfa[l] <= QFUPAC[l] * (1 - status[l]);
    281
    282subject to Qta_lower_2 {l in L: (OPF_TYPE == 'acrect' or OPF_TYPE == 'acjabr') and BR_STATUS[l] == 3}:
    283    QTLOAC[l] * (1 - status[l]) <= -Qt[l] + Qta[l];
    284
    285subject to Qta_upper_2 {l in L: (OPF_TYPE == 'acrect' or OPF_TYPE == 'acjabr') and BR_STATUS[l] == 3}:
    286    -Qt[l] + Qta[l] <= QTUPAC[l] * (1 - status[l]);
    287
    288########## POWER FLOW LIMITS ##########
    289
    290subject to flowf_limits_1 {l in L:OPF_TYPE='dc' and (BR_STATUS[l] == 1 or BR_STATUS[l] == 2)}:
    291    -RATE_A[l] <= Pf[l] <= RATE_A[l];
    292
    293subject to flowt_limits_1 {l in L:OPF_TYPE='dc' and (BR_STATUS[l] == 1 or BR_STATUS[l] == 2)}:
    294    -RATE_A[l] <= Pt[l] <= RATE_A[l];
    295
    296subject to flowf_limits_dc_lower {l in L: OPF_TYPE == 'dc' and BR_STATUS[l] == 3}:
    297    Pf[l] >= -RATE_A[l] * status[l];
    298
    299subject to flowf_limits_dc_upper {l in L: OPF_TYPE == 'dc' and BR_STATUS[l] == 3}:
    300    Pf[l] <= RATE_A[l] * status[l];
    301
    302subject to flowt_limits_dc_lower {l in L: OPF_TYPE == 'dc' and BR_STATUS[l] == 3}:
    303    Pt[l] >= -RATE_A[l] * status[l];
    304
    305subject to flowt_limits_dc_upper {l in L: OPF_TYPE == 'dc' and BR_STATUS[l] == 3}:
    306    Pt[l] <= RATE_A[l] * status[l];
    307
    308subject to flow_limits_from_23_4 {l in L:(OPF_TYPE='acpolar' or OPF_TYPE = 'acrect' or OPF_TYPE = 'acjabr') and (BR_STATUS[l] == 1 or BR_STATUS[l] == 2)}:
    309    Pf[l]^2 + Qf[l]^2 <= RATE_A[l]^2;
    310
    311subject to flow_limits_to_23_4 {l in L:(OPF_TYPE='acpolar' or OPF_TYPE = 'acrect' or OPF_TYPE = 'acjabr') and (BR_STATUS[l] == 1 or BR_STATUS[l] == 2)}:
    312    Pt[l]^2 + Qt[l]^2 <= RATE_A[l]^2;
    313
    314subject to flow_limits_from_acrect {l in L: (OPF_TYPE == 'acpolar' or OPF_TYPE == 'acrect' or OPF_TYPE == 'acjabr') and BR_STATUS[l] == 3}:
    315    Pf[l]^2 + Qf[l]^2 <= RATE_A[l]^2 * status[l];
    316
    317subject to flow_limits_to_acrect {l in L: (OPF_TYPE == 'acpolar' or OPF_TYPE == 'acrect' or OPF_TYPE == 'acjabr') and BR_STATUS[l] == 3}:
    318    Pt[l]^2 + Qt[l]^2 <= RATE_A[l]^2 * status[l];
    319
    320########## RECTANGULAR DEFINITIONS ##########
    321
    322subject to eq_vol_squared {n in N:OPF_TYPE = 'acrect'}:
    323    V2[n] == Vr[n]*Vr[n] + Vi[n]*Vi[n];
    324
    325subject to eq_cosft {l in L:OPF_TYPE = 'acrect'}:
    326    cosft[l] == Vr[F_BUS[l]]*Vr[T_BUS[l]] + Vi[F_BUS[l]]*Vi[T_BUS[l]];
    327
    328subject to eq_sinft {l in L:OPF_TYPE = 'acrect'}:
    329    sinft[l] == Vi[F_BUS[l]]*Vr[T_BUS[l]] - Vr[F_BUS[l]]*Vi[T_BUS[l]];
    330
    331########## JABR RELAXATION ##########
    332
    333subject to jabr_relaxation_ft {l in L:OPF_TYPE = 'acrect' or OPF_TYPE = 'acjabr'}:
    334    cosft[l]^2 + sinft[l]^2 <= V2[F_BUS[l]]*V2[T_BUS[l]];
    335
    336# TODO: Add the relaxation by Muñoz where losses are positive?
    337
    338########## SLACK BUS ##########
    339
    340subject to eq_slack:
    341    Va[0] == 0;
    342
    343subject to eq_slack_imag:
    344    Vi[0] == 0;
    345
    346########## CONNECTIVITY CONSTRAINTS ##########
    347
    348subject to status_split {l in L: CONNECTIVITY = 'on' and (BR_STATUS[l] == 2 or BR_STATUS[l] == 3)}:
    349    statusf[l] + statust[l] == status[l];
    350
    351subject to connectivity {n in N: CONNECTIVITY = 'on'}:
    352    sum {l in L: F_BUS[l] == n} statusf[l] + sum {l in L: T_BUS[l] == n} statust[l] >= 1;
    353
    354subject to mtz_connectivity_f {l in L: CONNECTIVITY = 'on' and F_BUS[l] != 0 and T_BUS[l] != 0}:
    355    u[F_BUS[l]] - u[T_BUS[l]] + card(N) * statusf[l] <= card(N) - 1;
    356
    357subject to mtz_connectivity_t {l in L: CONNECTIVITY = 'on' and F_BUS[l] != 0 and T_BUS[l] != 0}:
    358    u[T_BUS[l]] - u[F_BUS[l]] + card(N) * statust[l] <= card(N) - 1;
    359
    360subject to eq_slack_mtz:
    361    u[0] == 1;
    362
    363########## STATUS FIX ##########
    364
    365subject to fix_status_0 {l in L: BR_STATUS[l] == 0}:
    366    status[l] == 0;
    367
    368subject to fix_status_1 {l in L: BR_STATUS[l] == 1}:
    369    status[l] == 1;
    370
    371# TODO: Split AMPL models?