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 % Copyright (c) 1996-2015 by Power System Engineering Research Center (PSERC) 0014 % by Carlos E. Murillo-Sanchez, PSERC Cornell & Universidad Autonoma de Manizales 0015 % and Ray Zimmerman, PSERC Cornell 0016 % 0017 % $Id: dcpf.m 2644 2015-03-11 19:34:22Z ray $ 0018 % 0019 % This file is part of MATPOWER. 0020 % Covered by the 3-clause BSD License (see LICENSE file for details). 0021 % See http://www.pserc.cornell.edu/matpower/ for more info. 0022 0023 %% initialize result vector 0024 Va = Va0; 0025 0026 %% update angles for non-reference buses 0027 Va([pv; pq]) = B([pv; pq], [pv; pq]) \ (Pbus([pv; pq]) - B([pv; pq], ref) * Va0(ref));