apply_changes

apply_changes(label, mpc, chgtab)

apply_changes() - Applies a set of changes to a MATPOWER case

mpc_modified = apply_changes(label, mpc_original, chgtab)

Applies the set of changes identified by LABEL to the case in MPC, where
the change sets are specified in CHGTAB.

LABEL is an integer which identifies the set of changes of interest

MPC is a MATPOWER case struct with at least fields bus, gen and branch

CHGTAB is the table of changes that lists the individual changes required
by each change set, one "change" per row (multiple rows or changes
allowed for each change set). Type "help idx_ct" for more complete
information about the format.
1st column: change set label, integer > 0
2nd column: change set probability
3rd column: table to be modified (1:bus, 2:gen, 3:branch) or
            4: bus area changes, apply to all gens/buses/branches in
            a given area; 5: gen table area changes apply to all
            generators in a given area; or 6: branch area changes apply
            to all branches connected to buses in a given area.
4th column: row of table to be modified (if 3rd col is 1-3),
            or area number for overall changes (if 3rd column is 4-6).
5th column: column of table to be modified. It is best to use the
            named column index defined in the corresponding idx_bus,
            idx_gen, idx_branch or idx_cost M-files in MATPOWER.
6th column: type of change: 1: absolute (replace)
                            2: relative (multiply by factor)
                            3: additive (add to value)
7th column: new value or multiplicative or additive factor

Examples:

chgtab = [ ...
    1   0.1   CT_TGEN       2  GEN_STATUS     CT_REP  0;
    2   0.05  CT_TGEN       3  PMAX           CT_REP  100;
    3   0.2   CT_TBRCH      2  BR_STATUS      CT_REP  0;
    4   0.1   CT_TAREALOAD  2  CT_LOAD_ALL_P  CT_REL  1.1;
 ];

Description of each change set:
1. Turn off generator 2, 10% probability.
2. Set generator 3's max output to 100 MW, 5% probability.
3. Take branch 2 out of service, 20% probability.
4. Scale all loads in area 2 (real & reactive, fixed and dispatchable)
   by a factor of 1.1, 10% probability.

See also idx_ct().