CPF_TANGENT Computes normalized tangent predictor for continuation power flow Z = CPF_TANGENT(V, LAM, YBUS, SBUSB, SBUST, PV, PQ, ... Z, VPRV, LAMPRV, PARAMETERIZATION) Computes a normalized tangent predictor for the continuation power flow. Inputs: V : complex bus voltage vector at current solution LAM : scalar lambda value at current solution YBUS : complex bus admittance matrix SBUSB : handle of function returning nb x 1 vector of complex base case injections in p.u. and derivatives w.r.t. |V| SBUST : handle of function returning nb x 1 vector of complex target case injections in p.u. and derivatives w.r.t. |V| PV : vector of indices of PV buses PQ : vector of indices of PQ buses ZPRV : 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: Z : the normalized tangent prediction vector
0001 function z = cpf_tangent(V, lam, Ybus, Sbusb, Sbust, pv, pq, ... 0002 zprv, Vprv, lamprv, parameterization) 0003 %CPF_TANGENT Computes normalized tangent predictor for continuation power flow 0004 % Z = CPF_TANGENT(V, LAM, YBUS, SBUSB, SBUST, PV, PQ, ... 0005 % Z, VPRV, LAMPRV, PARAMETERIZATION) 0006 % 0007 % Computes a normalized tangent predictor for the continuation power flow. 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 % SBUSB : handle of function returning nb x 1 vector of complex 0014 % base case injections in p.u. and derivatives w.r.t. |V| 0015 % SBUST : handle of function returning nb x 1 vector of complex 0016 % target case injections in p.u. and derivatives w.r.t. |V| 0017 % PV : vector of indices of PV buses 0018 % PQ : vector of indices of PQ buses 0019 % ZPRV : normalized tangent prediction vector from previous step 0020 % VPRV : complex bus voltage vector at previous solution 0021 % LAMPRV : scalar lambda value at previous solution 0022 % PARAMETERIZATION : Value of cpf.parameterization option. 0023 % 0024 % Outputs: 0025 % Z : the normalized tangent prediction vector 0026 0027 % MATPOWER 0028 % Copyright (c) 1996-2016, Power Systems Engineering Research Center (PSERC) 0029 % by Shrirang Abhyankar, Argonne National Laboratory 0030 % and Ray Zimmerman, PSERC Cornell 0031 % 0032 % This file is part of MATPOWER. 0033 % Covered by the 3-clause BSD License (see LICENSE file for details). 0034 % See http://www.pserc.cornell.edu/matpower/ for more info. 0035 0036 %% sizes 0037 nb = length(V); 0038 npv = length(pv); 0039 npq = length(pq); 0040 0041 Vm = abs(V); 0042 0043 %% compute Jacobian for the power flow equations 0044 [dSbus_dVm, dSbus_dVa] = dSbus_dV(Ybus, V); 0045 [dummy, neg_dSdb_dVm] = Sbusb(Vm); 0046 [dummy, neg_dSdt_dVm] = Sbust(Vm); 0047 dSbus_dVm = dSbus_dVm - neg_dSdb_dVm - lam * (neg_dSdt_dVm - neg_dSdb_dVm); 0048 0049 j11 = real(dSbus_dVa([pv; pq], [pv; pq])); 0050 j12 = real(dSbus_dVm([pv; pq], pq)); 0051 j21 = imag(dSbus_dVa(pq, [pv; pq])); 0052 j22 = imag(dSbus_dVm(pq, pq)); 0053 0054 J = [ j11 j12; 0055 j21 j22; ]; 0056 0057 Sxf = Sbust(Vm) - Sbusb(Vm); %% "transfer" at current voltage level 0058 dF_dlam = -[real(Sxf([pv; pq])); imag(Sxf(pq))]; 0059 [dP_dV, dP_dlam] = cpf_p_jac(parameterization, zprv, V, lam, Vprv, lamprv, pv, pq); 0060 0061 %% linear operator for computing the tangent predictor 0062 J = [ J dF_dlam; 0063 dP_dV dP_dlam ]; 0064 0065 % J = [ J, dF_dlam; 0066 % z([pv; pq; nb+pq; 2*nb+1])']; 0067 0068 %% compute normalized tangent predictor 0069 z = zprv; 0070 s = zeros(npv+2*npq+1, 1); 0071 s(end,1) = 1; %% increase in the direction of lambda 0072 z([pv; pq; nb+pq; 2*nb+1]) = J\s; %% tangent vector 0073 z = z/norm(z); %% normalize tangent predictor