Home > matpower4.1 > makeB.m

makeB

PURPOSE ^

MAKEB Builds the FDPF matrices, B prime and B double prime.

SYNOPSIS ^

function [Bp, Bpp] = makeB(baseMVA, bus, branch, alg)

DESCRIPTION ^

MAKEB   Builds the FDPF matrices, B prime and B double prime.
   [BP, BPP] = MAKEB(BASEMVA, BUS, BRANCH, ALG) returns the two
   matrices B prime and B double prime used in the fast decoupled power
   flow. Does appropriate conversions to p.u. ALG is the value of the
   PF_ALG option specifying the power flow algorithm.

   Example:
       [Bp, Bpp] = makeB(baseMVA, bus, branch, alg);

   See also FDPF.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [Bp, Bpp] = makeB(baseMVA, bus, branch, alg)
0002 %MAKEB   Builds the FDPF matrices, B prime and B double prime.
0003 %   [BP, BPP] = MAKEB(BASEMVA, BUS, BRANCH, ALG) returns the two
0004 %   matrices B prime and B double prime used in the fast decoupled power
0005 %   flow. Does appropriate conversions to p.u. ALG is the value of the
0006 %   PF_ALG option specifying the power flow algorithm.
0007 %
0008 %   Example:
0009 %       [Bp, Bpp] = makeB(baseMVA, bus, branch, alg);
0010 %
0011 %   See also FDPF.
0012 
0013 %   MATPOWER
0014 %   $Id: makeB.m,v 1.9 2010/04/26 19:45:25 ray Exp $
0015 %   by 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 %% constants
0043 nb = size(bus, 1);          %% number of buses
0044 nl = size(branch, 1);       %% number of lines
0045 
0046 %% define named indices into bus, branch matrices
0047 [PQ, PV, REF, NONE, BUS_I, BUS_TYPE, PD, QD, GS, BS, BUS_AREA, VM, ...
0048     VA, BASE_KV, ZONE, VMAX, VMIN, LAM_P, LAM_Q, MU_VMAX, MU_VMIN] = idx_bus;
0049 [F_BUS, T_BUS, BR_R, BR_X, BR_B, RATE_A, RATE_B, RATE_C, ...
0050     TAP, SHIFT, BR_STATUS, PF, QF, PT, QT, MU_SF, MU_ST, ...
0051     ANGMIN, ANGMAX, MU_ANGMIN, MU_ANGMAX] = idx_brch;
0052 
0053 %%-----  form Bp (B prime)  -----
0054 temp_branch = branch;                       %% modify a copy of branch
0055 temp_bus = bus;                             %% modify a copy of bus
0056 temp_bus(:, BS) = zeros(nb, 1);             %% zero out shunts at buses
0057 temp_branch(:, BR_B) = zeros(nl, 1);        %% zero out line charging shunts
0058 temp_branch(:, TAP) = ones(nl, 1);          %% cancel out taps
0059 if alg == 2                                 %% if XB method
0060     temp_branch(:, BR_R) = zeros(nl, 1);        %% zero out line resistance
0061 end
0062 Bp = -imag( makeYbus(baseMVA, temp_bus, temp_branch) );
0063 
0064 %%-----  form Bpp (B double prime)  -----
0065 if nargout == 2
0066     temp_branch = branch;                       %% modify a copy of branch
0067     temp_branch(:, SHIFT) = zeros(nl, 1);       %% zero out phase shifters
0068     if alg == 3                                 %% if BX method
0069         temp_branch(:, BR_R) = zeros(nl, 1);        %% zero out line resistance
0070     end
0071     Bpp = -imag( makeYbus(baseMVA, bus, temp_branch) );
0072 end

Generated on Mon 26-Jan-2015 15:00:13 by m2html © 2005