Home > matpower5.0 > extras > se > getV0.m

getV0

PURPOSE ^

GETV0 Get initial voltage profile for power flow calculation.

SYNOPSIS ^

function V0 = getV0(bus, gen, type_initialguess, V0)

DESCRIPTION ^

GETV0  Get initial voltage profile for power flow calculation.
   Note: The pv bus voltage will remain at the given value even for
   flat start.
   type_initialguess: 1 - initial guess from case data
                      2 - flat start
                      3 - from input

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function V0 = getV0(bus, gen, type_initialguess, V0)
0002 %GETV0  Get initial voltage profile for power flow calculation.
0003 %   Note: The pv bus voltage will remain at the given value even for
0004 %   flat start.
0005 %   type_initialguess: 1 - initial guess from case data
0006 %                      2 - flat start
0007 %                      3 - from input
0008 
0009 %   MATPOWER
0010 %   $Id: getV0.m 1635 2010-04-26 19:45:26Z ray $
0011 %   by Rui Bo
0012 %   Copyright (c) 2009-2010 by Rui Bo
0013 %
0014 %   This file is part of MATPOWER.
0015 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0016 %
0017 %   MATPOWER is free software: you can redistribute it and/or modify
0018 %   it under the terms of the GNU General Public License as published
0019 %   by the Free Software Foundation, either version 3 of the License,
0020 %   or (at your option) any later version.
0021 %
0022 %   MATPOWER is distributed in the hope that it will be useful,
0023 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0024 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0025 %   GNU General Public License for more details.
0026 %
0027 %   You should have received a copy of the GNU General Public License
0028 %   along with MATPOWER. If not, see <http://www.gnu.org/licenses/>.
0029 %
0030 %   Additional permission under GNU GPL version 3 section 7
0031 %
0032 %   If you modify MATPOWER, or any covered work, to interface with
0033 %   other modules (such as MATLAB code and MEX-files) available in a
0034 %   MATLAB(R) or comparable environment containing parts covered
0035 %   under other licensing terms, the licensors of MATPOWER grant
0036 %   you additional permission to convey the resulting work.
0037 
0038 %% define named indices into bus, gen, branch matrices
0039 [PQ, PV, REF, NONE, BUS_I, BUS_TYPE, PD, QD, GS, BS, BUS_AREA, VM, ...
0040     VA, BASE_KV, ZONE, VMAX, VMIN, LAM_P, LAM_Q, MU_VMAX, MU_VMIN] = idx_bus;
0041 [F_BUS, T_BUS, BR_R, BR_X, BR_B, RATE_A, RATE_B, ...
0042     RATE_C, TAP, SHIFT, BR_STATUS, PF, QF, PT, QT, MU_SF, MU_ST] = idx_brch;
0043 [GEN_BUS, PG, QG, QMAX, QMIN, VG, MBASE, ...
0044     GEN_STATUS, PMAX, PMIN, MU_PMAX, MU_PMIN, MU_QMAX, MU_QMIN] = idx_gen;
0045 
0046 %% generator info
0047 on = find(gen(:, GEN_STATUS) > 0);      %% which generators are on?
0048 gbus = gen(on, GEN_BUS);                %% what buses are they at?
0049 if type_initialguess == 1 % using previous value in case data
0050     % NOTE: angle is in degree in case data, but in radians in pf solver,
0051     % so conversion from degree to radians is needed here
0052     V0  = bus(:, VM) .* exp(sqrt(-1) * pi/180 * bus(:, VA)); 
0053 elseif type_initialguess == 2 % using flat start
0054     V0 = ones(size(bus, 1), 1);
0055 elseif type_initialguess == 3 % using given initial voltage
0056     V0 = V0;
0057 else
0058     fprintf('Error: unknow ''type_initialguess''.\n');
0059     pause
0060 end
0061 % set the voltages of PV bus and reference bus into the initial guess
0062 V0(gbus) = gen(on, VG) ./ abs(V0(gbus)).* V0(gbus);

Generated on Mon 26-Jan-2015 15:21:31 by m2html © 2005