MAKEINCIDENCE Builds the bus incidence matrix. [Ainc] = MAKEINCIDENCE(MPC) [Ainc] = MAKEINCIDENCE(BUS, BRANCH) Builds the bus incidence matrix. This matrix has size nline by nbus, with each row having two nonzero elements: +1 in the entry for the "from" bus of the corresponding line and -1 in the entry for the "to" bus of the corresponding line. Inputs: MPC : MATPOWER case variable with internal indexing. Outputs: AINC : An nline by nbus size bus incidence matrix.

- idx_brch IDX_BRCH Defines constants for named column indices to branch matrix.
- idx_bus IDX_BUS Defines constants for named column indices to bus matrix.

- insolvablepf INSOLVABLEPF A sufficient condition for power flow insolvability
- sdpopf_solver SDPOPF_SOLVER A semidefinite programming relaxtion of the OPF problem

0001 function [Ainc] = makeIncidence(bus, branch) 0002 %MAKEINCIDENCE Builds the bus incidence matrix. 0003 % [Ainc] = MAKEINCIDENCE(MPC) 0004 % [Ainc] = MAKEINCIDENCE(BUS, BRANCH) 0005 % 0006 % Builds the bus incidence matrix. This matrix has size nline by nbus, 0007 % with each row having two nonzero elements: +1 in the entry for the 0008 % "from" bus of the corresponding line and -1 in the entry for the "to" 0009 % bus of the corresponding line. 0010 % 0011 % Inputs: 0012 % MPC : MATPOWER case variable with internal indexing. 0013 % 0014 % Outputs: 0015 % AINC : An nline by nbus size bus incidence matrix. 0016 0017 % MATPOWER 0018 % Copyright (c) 2013-2016, Power Systems Engineering Research Center (PSERC) 0019 % by Daniel Molzahn, PSERC U of Wisc, Madison 0020 % and Ray Zimmerman, PSERC Cornell 0021 % 0022 % This file is part of MATPOWER. 0023 % Covered by the 3-clause BSD License (see LICENSE file for details). 0024 % See http://www.pserc.cornell.edu/matpower/ for more info. 0025 0026 if nargin < 2 0027 mpc = bus; 0028 bus = mpc.bus; 0029 branch = mpc.branch; 0030 end 0031 0032 %% constants 0033 nb = size(bus, 1); %% number of buses 0034 nl = size(branch, 1); %% number of lines 0035 0036 %% define named indices into bus, branch matrices 0037 [PQ, PV, REF, NONE, BUS_I, BUS_TYPE, PD, QD, GS, BS, BUS_AREA, VM, ... 0038 VA, BASE_KV, ZONE, VMAX, VMIN, LAM_P, LAM_Q, MU_VMAX, MU_VMIN] = idx_bus; 0039 [F_BUS, T_BUS, BR_R, BR_X, BR_B, RATE_A, RATE_B, RATE_C, ... 0040 TAP, SHIFT, BR_STATUS, PF, QF, PT, QT, MU_SF, MU_ST, ... 0041 ANGMIN, ANGMAX, MU_ANGMIN, MU_ANGMAX] = idx_brch; 0042 0043 %% check that bus numbers are equal to indices to bus (one set of bus numbers) 0044 if any(bus(:, BUS_I) ~= (1:nb)') 0045 error('makeIncidence: buses must be numbered consecutively in bus matrix; use ext2int() to convert to internal ordering') 0046 end 0047 0048 %% build connection matrices 0049 f = branch(:, F_BUS); %% list of "from" buses 0050 t = branch(:, T_BUS); %% list of "to" buses 0051 Cf = sparse(1:nl, f, ones(nl, 1), nl, nb); %% connection matrix for line & from buses 0052 Ct = sparse(1:nl, t, ones(nl, 1), nl, nb); %% connection matrix for line & to buses 0053 0054 Ainc = Cf - Ct;

Generated on Fri 16-Dec-2016 12:45:37 by