makePTDF

makePTDF(baseMVA, bus, branch, slack, bus_idx)

makeLODF() - Builds the DC PTDF matrix for a given choice of slack.

H = MAKEPTDF(MPC)
H = MAKEPTDF(MPC, SLACK)
H = MAKEPTDF(MPC, SLACK, TXFR)
H = MAKEPTDF(MPC, SLACK, BUS_IDX)
H = MAKEPTDF(BASEMVA, BUS, BRANCH)
H = MAKEPTDF(BASEMVA, BUS, BRANCH, SLACK)
H = MAKEPTDF(BASEMVA, BUS, BRANCH, SLACK, TXFR)
H = MAKEPTDF(BASEMVA, BUS, BRANCH, SLACK, BUS_IDX)

Returns the DC PTDF matrix for a given choice of slack. The matrix is
nbr x nb, where nbr is the number of branches and nb is the number of
buses. The SLACK can be a scalar (single slack bus) or an nb x 1 column
vector of weights specifying the proportion of the slack taken up at each
bus. If the SLACK is not specified the reference bus is used by default.
Bus numbers must be consecutive beginning at 1 (i.e. internal ordering).

For convenience, SLACK can also be an nb x nb matrix, where each
column specifies how the slack should be handled for injections
at that bus. This option only applies when computing the full
PTDF matrix (i.e. when TXFR and BUS_IDX are not provided.)

If TXFR is supplied it must be a matrix (or vector) with nb rows whose
columns each sum to zero, where each column defines a specific (slack
independent) transfer. E.g. if k-th transfer is from bus i to bus j,
TXFR(i, k) = 1 and TXFR(j, k) = -1. In this case H has the same number
of columns as TXFR.

If BUS_IDX is supplied, it contains a column vector of bus indices.
The columns of H correspond to these indices, but they are computed
individually rather than computing the full PTDF matrix and selecting
the desired columns.

Examples:
    H = makePTDF(mpc);
    H = makePTDF(baseMVA, bus, branch, 1);
    slack = rand(size(bus, 1), 1);
    H = makePTDF(mpc, slack);

    % for transfer from bus i to bus j
    txfr = zeros(nb, 1); txfr(i) = 1; txfr(j) = -1;
    H = makePTDF(mpc, slack, txfr);

    % for buses i and j only
    H = makePTDF(mpc, slack, [i;j]);

See also makeLODF().