function mpc = case30
%   Author: Vincent Roberge
%   Date: 2021-06-23
%
%   Compatible with MATPOWER Case Format v2, but with additional structures to identify SVAR and transformer data
%
%   Based on data from:
%     K. Y. Lee, Y. M. Park, and J. L. Ortiz, “A United Approach to Optimal Real and Reactive Power Dispatch,” Power Appar. Syst. IEEE Trans. On, vol. PAS-104, no. 5, pp. 1147–1153, May 1985.

%% MATPOWER Case Format : Version 2                                                                                      
mpc.version    =    '2'    ;                                                                            

%%-----  Power Flow Data  -----%%                                                                                        
%% system MVA base                                                                                        
mpc.baseMVA    =    100    ;                                                                            


%%    branch    data
%   fbus  tbus     r         x         b      rateA  rateB  rateC  ratio  angle status angmin angmax
mpc.branch    =    [
     1      2    0.0192    0.0575    0.0528    130    130    130    1        0    1    -360    360    ;
     1      3    0.0452    0.1852    0.0408    130    130    130    1        0    1    -360    360    ;
     2      4    0.0570    0.1737    0.0368     65     65     65    1        0    1    -360    360    ;
     3      4    0.0132    0.0379    0.0084    130    130    130    1        0    1    -360    360    ;
     2      5    0.0472    0.1983    0.0418    130    130    130    1        0    1    -360    360    ;
     2      6    0.0581    0.1763    0.0374     65     65     65    1        0    1    -360    360    ;
     4      6    0.0119    0.0414    0.0090     90     90     90    1        0    1    -360    360    ;
     5      7    0.0460    0.1160    0.0204     70     70     70    1        0    1    -360    360    ;
     6      7    0.0267    0.0820    0.0170    130    130    130    1        0    1    -360    360    ;
     6      8    0.0120    0.0420    0.0090     32     32     32    1        0    1    -360    360    ;
     6      9    0.0000    0.2080    0.0000     65     65     65    0.978    0    1    -360    360    ;
     6     10    0.0000    0.5560    0.0000     32     32     32    0.969    0    1    -360    360    ;
     9     11    0.0000    0.2080    0.0000     65     65     65    1        0    1    -360    360    ;
     9     10    0.0000    0.1100    0.0000     65     65     65    1        0    1    -360    360    ;
     4     12    0.0000    0.2560    0.0000     65     65     65    0.932    0    1    -360    360    ;
     12    13    0.0000    0.1400    0.0000     65     65     65    1        0    1    -360    360    ;
     12    14    0.1231    0.2559    0.0000     32     32     32    1        0    1    -360    360    ;
     12    15    0.0662    0.1304    0.0000     32     32     32    1        0    1    -360    360    ;
     12    16    0.0945    0.1987    0.0000     32     32     32    1        0    1    -360    360    ;
     14    15    0.2210    0.1997    0.0000     16     16     16    1        0    1    -360    360    ;
     16    17    0.0824    0.1923    0.0000     16     16     16    1        0    1    -360    360    ;
     15    18    0.1070    0.2185    0.0000     16     16     16    1        0    1    -360    360    ;
     18    19    0.0639    0.1292    0.0000     16     16     16    1        0    1    -360    360    ;
     19    20    0.0340    0.0680    0.0000     32     32     32    1        0    1    -360    360    ;
     10    20    0.0936    0.2090    0.0000     32     32     32    1        0    1    -360    360    ;
     10    17    0.0324    0.0845    0.0000     32     32     32    1        0    1    -360    360    ;
     10    21    0.0348    0.0749    0.0000     32     32     32    1        0    1    -360    360    ;
     10    22    0.0727    0.1499    0.0000     32     32     32    1        0    1    -360    360    ;
     21    22    0.0116    0.0236    0.0000     32     32     32    1        0    1    -360    360    ;
     15    23    0.1000    0.2020    0.0000     16     16     16    1        0    1    -360    360    ;
     22    24    0.1150    0.1790    0.0000     16     16     16    1        0    1    -360    360    ;
     23    24    0.1320    0.2700    0.0000     16     16     16    1        0    1    -360    360    ;
     24    25    0.1885    0.3292    0.0000     16     16     16    1        0    1    -360    360    ;
     25    26    0.2544    0.3800    0.0000     16     16     16    1        0    1    -360    360    ;
     25    27    0.1093    0.2087    0.0000     16     16     16    1        0    1    -360    360    ;
     28    27    0.0000    0.3960    0.0000     65     65     65    0.968    0    1    -360    360    ;
     27    29    0.2198    0.4153    0.0000     16     16     16    1        0    1    -360    360    ;
     27    30    0.3202    0.6027    0.0000     16     16     16    1        0    1    -360    360    ;
     29    30    0.2399    0.4533    0.0000     16     16     16    1        0    1    -360    360    ;
     8     28    0.0636    0.2000    0.0428     32     32     32    1        0    1    -360    360    ;
     6     28    0.0169    0.0599    0.0130     32     32     32    1        0    1    -360    360    ;
];


%%    bus    data
% bus_i  type    Pd      Qd    Gs     Bs     area     Vm     Va   baseKV zone  Vmax  Vmin
mpc.bus    =    [
     1     3     0.0     0.0    0      0        1    1.060    0    135    1    1.1    0.95    ;
     2     2    21.7    12.7    0      0        1    1.043    0    135    1    1.1    0.95    ;
     3     1     2.4     1.2    0      0        1    1.000    0    135    1    1.1    0.95    ;
     4     1     7.6     1.6    0      0        1    1.060    0    135    1    1.1    0.95    ;
     5     2    94.2    19.0    0      0        1    1.010    0    135    1    1.1    0.95    ;
     6     1     0.0     0.0    0      0        1    1.000    0    135    1    1.1    0.95    ;
     7     1    22.8    10.9    0      0        1    1.000    0    135    1    1.1    0.95    ;
     8     2    30.0    30.0    0      0        1    1.010    0    135    1    1.1    0.95    ;
     9     1     0.0     0.0    0      0        1    1.000    0    135    1    1.1    0.95    ;
     10    1     5.8     2.0    0      0        1    1.000    0    135    1    1.1    0.95    ;
     11    2     0.0     0.0    0      0        1    1.082    0    135    1    1.1    0.95    ;
     12    1    11.2     7.5    0      0        1    1.000    0    135    1    1.1    0.95    ;
     13    2     0.0     0.0    0      0        1    1.071    0    135    1    1.1    0.95    ;
     14    1     6.2     1.6    0      0        1    1.000    0    135    1    1.1    0.95    ;
     15    1     8.2     2.5    0      0        1    1.000    0    135    1    1.1    0.95    ;
     16    1     3.5     1.8    0      0        1    1.000    0    135    1    1.1    0.95    ;
     17    1     9.0     5.8    0      0        1    1.000    0    135    1    1.1    0.95    ;
     18    1     3.2     0.9    0      0        1    1.000    0    135    1    1.1    0.95    ;
     19    1     9.5     3.4    0      0        1    1.000    0    135    1    1.1    0.95    ;
     20    1     2.2     0.7    0      0        1    1.000    0    135    1    1.1    0.95    ;
     21    1    17.5    11.2    0      0        1    1.000    0    135    1    1.1    0.95    ;
     22    1     0.0     0.0    0      0        1    1.000    0    135    1    1.1    0.95    ;
     23    1     3.2     1.6    0      0        1    1.000    0    135    1    1.1    0.95    ;
     24    1     8.7     6.7    0      0        1    1.000    0    135    1    1.1    0.95    ;
     25    1     0.0     0.0    0      0        1    1.000    0    135    1    1.1    0.95    ;
     26    1     3.5     2.3    0      0        1    1.000    0    135    1    1.1    0.95    ;
     27    1     0.0     0.0    0      0        1    1.000    0    135    1    1.1    0.95    ;
     28    1     0.0     0.0    0      0        1    1.000    0    135    1    1.1    0.95    ;
     29    1     2.4     0.9    0      0        1    1.000    0    135    1    1.1    0.95    ;
     30    1    10.6     1.9    0      0        1    1.000    0    135    1    1.1    0.95    ;
];


%%    generator    data                                                                                
%    bus   Pg       Qg    Qmax  Qmin    Vg    mBase  status Pmax   Pmin  Pc1 Pc2  Qc1min  Qc1max   Qc2min   Qc2max   ramp_agc    ramp_10   ramp_30   ramp_q    apf
mpc.gen    =    [
     1     99.211    0    200    -20    1.0865    1    1    200    50    0    0    0    0    0    0    0    0    0    0    0    ;
     2     80        0    100    -20    1.0676    1    1     80    20    0    0    0    0    0    0    0    0    0    0    0    ;
     5     50        0     80    -15    1.0385    1    1     50    15    0    0    0    0    0    0    0    0    0    0    0    ;
     8     20        0     60    -15    1.0323    1    1     35    10    0    0    0    0    0    0    0    0    0    0    0    ;
     11    20        0     50    -10    1.0735    1    1     30    10    0    0    0    0    0    0    0    0    0    0    0    ;
     13    20        0     60    -15    1.0515    1    1     40    12    0    0    0    0    0    0    0    0    0    0    0    ;
];


%%    generator    cost    data
%    1    startup    shutdown    n    x1    y1    ...    xn    yn
%    2    startup    shutdown    n    c(n-1)    ...    c0
mpc.gencost    =    [
    2    0    0    3    0.00375    2.000    0    ;
    2    0    0    3    0.01750    1.750    0    ;
    2    0    0    3    0.06250    1.000    0    ;
    2    0    0    3    0.00834    3.250    0    ;
    2    0    0    3    0.02500    3.000    0    ;
    2    0    0    3    0.02500    3.000    0    ;
];


%%    transformer data
%    branch        min_tap    max_tap    increment    tap_setting    min_angle    max_angle    increment    angle_setting
mpc.transformer = [
    6       9       0.90    1.10    0.0125  0.9780  0.00    0.00    30.0000  0.0000;
    6       10      0.90    1.10    0.0125  0.9690  0.00    0.00    30.0000  0.0000;
    4       12      0.90    1.10    0.0125  0.9320  0.00    0.00    30.0000  0.0000;
    28      27      0.90    1.10    0.0125  0.9680  0.00    0.00    30.0000  0.0000;
];


%%    Switchable Volt Ampere Reactive compensator (SVAR) data 
%    bus     min      max      increment      setting
mpc.svar = [
    10      0.000    5.000    0.500    0.000  ;
    12      0.000    5.000    0.500    0.000  ;
    15      0.000    5.000    0.500    0.000  ;
    17      0.000    5.000    0.500    0.000  ;
    20      0.000    5.000    0.500    0.000  ;
    21      0.000    5.000    0.500    0.000  ;
    23      0.000    5.000    0.500    0.000  ;
    24      0.000    5.000    0.500    0.000  ;
    29      0.000    5.000    0.500    0.000  ;
];