CPF_PREDICTOR Performs the predictor step for the continuation power flow [V0, LAM0, Z] = CPF_PREDICTOR(VPRV, LAMPRV, YBUS, SXFR, PV, PQ, STEP, Z) Computes a prediction (approximation) to the next solution of the continuation power flow using a normalized tangent predictor. Inputs: V : complex bus voltage vector at current solution LAM : scalar lambda value at current solution YBUS : complex bus admittance matrix SXFR : complex vector of scheduled transfers (difference between bus injections in base and target cases) PV : vector of indices of PV buses PQ : vector of indices of PQ buses STEP : continuation step length Z : normalized tangent prediction vector from previous step VPRV : complex bus voltage vector at previous solution LAMPRV : scalar lambda value at previous solution PARAMETERIZATION : Value of cpf.parameterization option. Outputs: V0 : predicted complex bus voltage vector LAM0 : predicted lambda continuation parameter Z : the normalized tangent prediction vector
0001 function [V0, lam0, z] = cpf_predictor(V, lam, Ybus, Sxfr, pv, pq, ... 0002 step, z, Vprv, lamprv, parameterization) 0003 %CPF_PREDICTOR Performs the predictor step for the continuation power flow 0004 % [V0, LAM0, Z] = CPF_PREDICTOR(VPRV, LAMPRV, YBUS, SXFR, PV, PQ, STEP, Z) 0005 % 0006 % Computes a prediction (approximation) to the next solution of the 0007 % continuation power flow using a normalized tangent predictor. 0008 % 0009 % Inputs: 0010 % V : complex bus voltage vector at current solution 0011 % LAM : scalar lambda value at current solution 0012 % YBUS : complex bus admittance matrix 0013 % SXFR : complex vector of scheduled transfers (difference between 0014 % bus injections in base and target cases) 0015 % PV : vector of indices of PV buses 0016 % PQ : vector of indices of PQ buses 0017 % STEP : continuation step length 0018 % Z : normalized tangent prediction vector from previous step 0019 % VPRV : complex bus voltage vector at previous solution 0020 % LAMPRV : scalar lambda value at previous solution 0021 % PARAMETERIZATION : Value of cpf.parameterization option. 0022 % 0023 % Outputs: 0024 % V0 : predicted complex bus voltage vector 0025 % LAM0 : predicted lambda continuation parameter 0026 % Z : the normalized tangent prediction vector 0027 0028 % MATPOWER 0029 % $Id: cpf_predictor.m 2235 2013-12-11 13:44:13Z ray $ 0030 % by Shrirang Abhyankar, Argonne National Laboratory 0031 % and Ray Zimmerman, PSERC Cornell 0032 % Copyright (c) 1996-2013 by Power System Engineering Research Center (PSERC) 0033 % 0034 % This file is part of MATPOWER. 0035 % See http://www.pserc.cornell.edu/matpower/ for more info. 0036 % 0037 % MATPOWER is free software: you can redistribute it and/or modify 0038 % it under the terms of the GNU General Public License as published 0039 % by the Free Software Foundation, either version 3 of the License, 0040 % or (at your option) any later version. 0041 % 0042 % MATPOWER is distributed in the hope that it will be useful, 0043 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0044 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0045 % GNU General Public License for more details. 0046 % 0047 % You should have received a copy of the GNU General Public License 0048 % along with MATPOWER. If not, see <http://www.gnu.org/licenses/>. 0049 % 0050 % Additional permission under GNU GPL version 3 section 7 0051 % 0052 % If you modify MATPOWER, or any covered work, to interface with 0053 % other modules (such as MATLAB code and MEX-files) available in a 0054 % MATLAB(R) or comparable environment containing parts covered 0055 % under other licensing terms, the licensors of MATPOWER grant 0056 % you additional permission to convey the resulting work. 0057 0058 %% sizes 0059 nb = length(V); 0060 npv = length(pv); 0061 npq = length(pq); 0062 0063 %% compute Jacobian for the power flow equations 0064 [dSbus_dVm, dSbus_dVa] = dSbus_dV(Ybus, V); 0065 0066 j11 = real(dSbus_dVa([pv; pq], [pv; pq])); 0067 j12 = real(dSbus_dVm([pv; pq], pq)); 0068 j21 = imag(dSbus_dVa(pq, [pv; pq])); 0069 j22 = imag(dSbus_dVm(pq, pq)); 0070 0071 J = [ j11 j12; 0072 j21 j22; ]; 0073 0074 dF_dlam = -[real(Sxfr([pv; pq])); imag(Sxfr(pq))]; 0075 [dP_dV, dP_dlam] = cpf_p_jac(parameterization, z, V, lam, Vprv, lamprv, pv, pq); 0076 0077 %% linear operator for computing the tangent predictor 0078 J = [ J dF_dlam; 0079 dP_dV dP_dlam ]; 0080 0081 % J = [ J, dF_dlam; 0082 % z([pv; pq; nb+pq; 2*nb+1])']; 0083 0084 Vaprv = angle(V); 0085 Vmprv = abs(V); 0086 0087 %% compute normalized tangent predictor 0088 s = zeros(npv+2*npq+1, 1); 0089 s(end,1) = 1; %% increase in the direction of lambda 0090 z([pv; pq; nb+pq; 2*nb+1]) = J\s; %% tangent vector 0091 z = z/norm(z); %% normalize tangent predictor 0092 0093 Va0 = Vaprv; 0094 Vm0 = Vmprv; 0095 lam0 = lam; 0096 0097 %% prediction for next step 0098 Va0([pv; pq]) = Vaprv([pv; pq]) + step * z([pv; pq]); 0099 Vm0([pq]) = Vmprv([pq]) + step * z([nb+pq]); 0100 lam0 = lam + step * z(2*nb+1); 0101 V0 = Vm0 .* exp(1j * Va0);