Home > matpower5.1 > 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 %   Copyright (c) 2009-2015 by Power System Engineering Research Center (PSERC)
0011 %   by Rui Bo
0012 %
0013 %   $Id: getV0.m 2644 2015-03-11 19:34:22Z ray $
0014 %
0015 %   This file is part of MATPOWER.
0016 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0017 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0018 
0019 %% define named indices into bus, gen, branch matrices
0020 [PQ, PV, REF, NONE, BUS_I, BUS_TYPE, PD, QD, GS, BS, BUS_AREA, VM, ...
0021     VA, BASE_KV, ZONE, VMAX, VMIN, LAM_P, LAM_Q, MU_VMAX, MU_VMIN] = idx_bus;
0022 [F_BUS, T_BUS, BR_R, BR_X, BR_B, RATE_A, RATE_B, ...
0023     RATE_C, TAP, SHIFT, BR_STATUS, PF, QF, PT, QT, MU_SF, MU_ST] = idx_brch;
0024 [GEN_BUS, PG, QG, QMAX, QMIN, VG, MBASE, ...
0025     GEN_STATUS, PMAX, PMIN, MU_PMAX, MU_PMIN, MU_QMAX, MU_QMIN] = idx_gen;
0026 
0027 %% generator info
0028 on = find(gen(:, GEN_STATUS) > 0);      %% which generators are on?
0029 gbus = gen(on, GEN_BUS);                %% what buses are they at?
0030 if type_initialguess == 1 % using previous value in case data
0031     % NOTE: angle is in degree in case data, but in radians in pf solver,
0032     % so conversion from degree to radians is needed here
0033     V0  = bus(:, VM) .* exp(sqrt(-1) * pi/180 * bus(:, VA)); 
0034 elseif type_initialguess == 2 % using flat start
0035     V0 = ones(size(bus, 1), 1);
0036 elseif type_initialguess == 3 % using given initial voltage
0037     V0 = V0;
0038 else
0039     fprintf('Error: unknow ''type_initialguess''.\n');
0040     pause
0041 end
0042 % set the voltages of PV bus and reference bus into the initial guess
0043 V0(gbus) = gen(on, VG) ./ abs(V0(gbus)).* V0(gbus);

Generated on Fri 20-Mar-2015 18:23:34 by m2html © 2005