CPF_TANGENT Computes normalized tangent predictor for continuation power flow Z = CPF_TANGENT(V, LAM, YBUS, SBUSB, SBUST, PV, PQ, ... ZPRV, VPRV, LAMPRV, PARAMETERIZATION, DIRECTION) 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. DIRECTION: continuation direction (+1 for postive lambda increase, -1 otherwise) Outputs: Z : the normalized tangent prediction vector
0001 function z = cpf_tangent(V, lam, Ybus, Sbusb, Sbust, pv, pq, ... 0002 zprv, Vprv, lamprv, parameterization, direction) 0003 %CPF_TANGENT Computes normalized tangent predictor for continuation power flow 0004 % Z = CPF_TANGENT(V, LAM, YBUS, SBUSB, SBUST, PV, PQ, ... 0005 % ZPRV, VPRV, LAMPRV, PARAMETERIZATION, DIRECTION) 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 % DIRECTION: continuation direction (+1 for postive lambda 0024 % increase, -1 otherwise) 0025 % 0026 % Outputs: 0027 % Z : the normalized tangent prediction vector 0028 0029 % MATPOWER 0030 % Copyright (c) 1996-2016, Power Systems Engineering Research Center (PSERC) 0031 % by Shrirang Abhyankar, Argonne National Laboratory 0032 % and Ray Zimmerman, PSERC Cornell 0033 % 0034 % This file is part of MATPOWER. 0035 % Covered by the 3-clause BSD License (see LICENSE file for details). 0036 % See https://matpower.org for more info. 0037 0038 %% sizes 0039 nb = length(V); 0040 npv = length(pv); 0041 npq = length(pq); 0042 0043 Vm = abs(V); 0044 0045 %% compute Jacobian for the power flow equations 0046 [dSbus_dVa, dSbus_dVm] = dSbus_dV(Ybus, V); 0047 [dummy, neg_dSdb_dVm] = Sbusb(Vm); 0048 [dummy, neg_dSdt_dVm] = Sbust(Vm); 0049 dSbus_dVm = dSbus_dVm - neg_dSdb_dVm - lam * (neg_dSdt_dVm - neg_dSdb_dVm); 0050 0051 j11 = real(dSbus_dVa([pv; pq], [pv; pq])); 0052 j12 = real(dSbus_dVm([pv; pq], pq)); 0053 j21 = imag(dSbus_dVa(pq, [pv; pq])); 0054 j22 = imag(dSbus_dVm(pq, pq)); 0055 0056 J = [ j11 j12; 0057 j21 j22; ]; 0058 0059 Sxf = Sbust(Vm) - Sbusb(Vm); %% "transfer" at current voltage level 0060 dF_dlam = -[real(Sxf([pv; pq])); imag(Sxf(pq))]; 0061 [dP_dV, dP_dlam] = cpf_p_jac(parameterization, zprv, V, lam, Vprv, lamprv, pv, pq); 0062 0063 %% linear operator for computing the tangent predictor 0064 J = [ J dF_dlam; 0065 dP_dV dP_dlam ]; 0066 0067 % J = [ J, dF_dlam; 0068 % z([pv; pq; nb+pq; 2*nb+1])']; 0069 0070 %% compute normalized tangent predictor 0071 z = zprv; 0072 s = zeros(npv+2*npq+1, 1); 0073 s(end,1) = sign(direction); 0074 z([pv; pq; nb+pq; 2*nb+1]) = J\s; %% tangent vector 0075 z = z/norm(z); %% normalize tangent predictor