DCPF Solves a DC power flow. [VA, SUCCESS] = DCPF(B, PBUS, VA0, REF, PV, PQ) solves for the bus voltage angles at all but the reference bus, given the full system B matrix and the vector of bus real power injections, the initial vector of bus voltage angles (in radians), and column vectors with the lists of bus indices for the swing bus, PV buses, and PQ buses, respectively. Returns a vector of bus voltage angles in radians. See also RUNDCPF, RUNPF.
0001 function Va = dcpf(B, Pbus, Va0, ref, pv, pq) 0002 %DCPF Solves a DC power flow. 0003 % [VA, SUCCESS] = DCPF(B, PBUS, VA0, REF, PV, PQ) solves for the bus 0004 % voltage angles at all but the reference bus, given the full system 0005 % B matrix and the vector of bus real power injections, the initial 0006 % vector of bus voltage angles (in radians), and column vectors with 0007 % the lists of bus indices for the swing bus, PV buses, and PQ buses, 0008 % respectively. Returns a vector of bus voltage angles in radians. 0009 % 0010 % See also RUNDCPF, RUNPF. 0011 0012 % MATPOWER 0013 % $Id: dcpf.m,v 1.9 2010/04/26 19:45:25 ray Exp $ 0014 % by Carlos E. Murillo-Sanchez, PSERC Cornell & Universidad Autonoma de Manizales 0015 % and Ray Zimmerman, PSERC Cornell 0016 % Copyright (c) 1996-2010 by Power System Engineering Research Center (PSERC) 0017 % 0018 % This file is part of MATPOWER. 0019 % See http://www.pserc.cornell.edu/matpower/ for more info. 0020 % 0021 % MATPOWER is free software: you can redistribute it and/or modify 0022 % it under the terms of the GNU General Public License as published 0023 % by the Free Software Foundation, either version 3 of the License, 0024 % or (at your option) any later version. 0025 % 0026 % MATPOWER is distributed in the hope that it will be useful, 0027 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0028 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0029 % GNU General Public License for more details. 0030 % 0031 % You should have received a copy of the GNU General Public License 0032 % along with MATPOWER. If not, see <http://www.gnu.org/licenses/>. 0033 % 0034 % Additional permission under GNU GPL version 3 section 7 0035 % 0036 % If you modify MATPOWER, or any covered work, to interface with 0037 % other modules (such as MATLAB code and MEX-files) available in a 0038 % MATLAB(R) or comparable environment containing parts covered 0039 % under other licensing terms, the licensors of MATPOWER grant 0040 % you additional permission to convey the resulting work. 0041 0042 %% initialize result vector 0043 Va = Va0; 0044 0045 %% update angles for non-reference buses 0046 Va([pv; pq]) = B([pv; pq], [pv; pq]) \ (Pbus([pv; pq]) - B([pv; pq], ref) * Va0(ref));