addstorage

addstorage(storage, mpc, xgd, sd)

addstorage() - Adds storage units and corresponding xGen/StorageData to existing data.

[IDX, NEW_MPC] = ADDSTORAGE(STORAGE, MPC)
[IDX, NEW_MPC, NEW_XGD, NEW_SD] = ADDSTORAGE(STORAGE, MPC)
[IDX, NEW_MPC, NEW_XGD, NEW_SD] = ADDSTORAGE(STORAGE, MPC, XGD)
[IDX, NEW_MPC, NEW_XGD, NEW_SD] = ADDSTORAGE(STORAGE, MPC, XGD, SD)

Given a StorageUnitData structure, or the name of a file containing such
a structure, this function adds the specified storage generators to an
existing MATPOWER case, xGenData struct and StorageData struct.

Inputs:
    STORAGE : a StorageUnitData struct or the name of an M-file
                or MAT-file that returns one, with the following fields
        .gen     : rows to be appended to the GEN matrix from MPC
        .gencost : (optional) rows to be added to the GENCOST matrix
                   from MPC, default is zero cost
        .xgd_table : xGenData table struct or filename providing data for
                     the storage units being added. See LOADSTORAGEDATA
                     for more information on the xGenData table format.
        .sd_table : StorageData table struct or filename providing data
                    for the storage units being added. See LOADSTORAGEDATA
                    for more information on the StorageData table format.
    MPC : MATPOWER case struct to which storage generators will be added
    XGD : (optional) xGenData struct corresponding to the generators
          already in MPC, to which the new xGenData for the storage
          units will be added.
    SD : (optional) StorageData struct corresponding to the generators
         already in MPC, to which the new StorageData for the storage
         units will be added.

Output:
    IDX : Generator indices of newly added storage units.
    NEW_MPC : MPC with storage units appended to MPC.GEN and MPC.GENCOST
              MPC.GENFUEL (= 'ess').
    NEW_XGD : XGD with xGenData for new storage units appended.
    NEW_SD  : SD with StorageData for new storage units appended.

See also loadstoragedata(), loadxgendata().