MAKEAANG Construct constraints for branch angle difference limits. [AANG, LANG, UANG, IANG] = MAKEAANG(BASEMVA, BRANCH, NB, MPOPT) Constructs the parameters for the following linear constraint limiting the voltage angle differences across branches, where Va is the vector of bus voltage angles. NB is the number of buses. LANG <= AANG * Va <= UANG IANG is the vector of indices of branches with angle difference limits. The limits are given in the ANGMIN and ANGMAX columns of the branch matrix. Voltage angle differences are taken to be unbounded below if ANGMIN < -360 and unbounded above if ANGMAX > 360. If both ANGMIN and ANGMAX are zero, the angle difference is assumed to be unconstrained. Example: [Aang, lang, uang, iang] = makeAang(baseMVA, branch, nb, mpopt);
0001 function [Aang, lang, uang, iang] = makeAang(baseMVA, branch, nb, mpopt) 0002 %MAKEAANG Construct constraints for branch angle difference limits. 0003 % [AANG, LANG, UANG, IANG] = MAKEAANG(BASEMVA, BRANCH, NB, MPOPT) 0004 % 0005 % Constructs the parameters for the following linear constraint limiting 0006 % the voltage angle differences across branches, where Va is the vector 0007 % of bus voltage angles. NB is the number of buses. 0008 % 0009 % LANG <= AANG * Va <= UANG 0010 % 0011 % IANG is the vector of indices of branches with angle difference limits. 0012 % The limits are given in the ANGMIN and ANGMAX columns of the branch 0013 % matrix. Voltage angle differences are taken to be unbounded below if 0014 % ANGMIN < -360 and unbounded above if ANGMAX > 360. If both ANGMIN and 0015 % ANGMAX are zero, the angle difference is assumed to be unconstrained. 0016 % 0017 % Example: 0018 % [Aang, lang, uang, iang] = makeAang(baseMVA, branch, nb, mpopt); 0019 0020 % MATPOWER 0021 % $Id: makeAang.m 2229 2013-12-11 01:28:09Z ray $ 0022 % by Ray Zimmerman, PSERC Cornell 0023 % and Carlos E. Murillo-Sanchez, PSERC Cornell & Universidad Autonoma de Manizales 0024 % Copyright (c) 1996-2010 by Power System Engineering Research Center (PSERC) 0025 % 0026 % This file is part of MATPOWER. 0027 % See http://www.pserc.cornell.edu/matpower/ for more info. 0028 % 0029 % MATPOWER is free software: you can redistribute it and/or modify 0030 % it under the terms of the GNU General Public License as published 0031 % by the Free Software Foundation, either version 3 of the License, 0032 % or (at your option) any later version. 0033 % 0034 % MATPOWER is distributed in the hope that it will be useful, 0035 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0036 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0037 % GNU General Public License for more details. 0038 % 0039 % You should have received a copy of the GNU General Public License 0040 % along with MATPOWER. If not, see <http://www.gnu.org/licenses/>. 0041 % 0042 % Additional permission under GNU GPL version 3 section 7 0043 % 0044 % If you modify MATPOWER, or any covered work, to interface with 0045 % other modules (such as MATLAB code and MEX-files) available in a 0046 % MATLAB(R) or comparable environment containing parts covered 0047 % under other licensing terms, the licensors of MATPOWER grant 0048 % you additional permission to convey the resulting work. 0049 0050 %% define named indices into data matrices 0051 [F_BUS, T_BUS, BR_R, BR_X, BR_B, RATE_A, RATE_B, RATE_C, ... 0052 TAP, SHIFT, BR_STATUS, PF, QF, PT, QT, MU_SF, MU_ST, ... 0053 ANGMIN, ANGMAX, MU_ANGMIN, MU_ANGMAX] = idx_brch; 0054 0055 if mpopt.opf.ignore_angle_lim 0056 Aang = sparse(0, nb); 0057 lang = []; 0058 uang = []; 0059 iang = []; 0060 else 0061 iang = find((branch(:, ANGMIN) & branch(:, ANGMIN) > -360) | ... 0062 (branch(:, ANGMAX) & branch(:, ANGMAX) < 360)); 0063 nang = length(iang); 0064 0065 if nang > 0 0066 ii = [(1:nang)'; (1:nang)']; 0067 jj = [branch(iang, F_BUS); branch(iang, T_BUS)]; 0068 Aang = sparse(ii, jj, [ones(nang, 1); -ones(nang, 1)], nang, nb); 0069 lang = branch(iang, ANGMIN) * pi/180; 0070 uang = branch(iang, ANGMAX) * pi/180; 0071 else 0072 Aang = sparse(0, nb); 0073 lang =[]; 0074 uang =[]; 0075 end 0076 end