CPF_P_JAC Computes partial derivatives of CPF parameterization function. [DP_DV, DP_DLAM ] = CPF_P_JAC(PARAMETERIZATION, Z, V, LAM, ... VPRV, LAMPRV, PV, PQ) Computes the partial derivatives of the continuation power flow parameterization function w.r.t. bus voltages and the continuation parameter lambda. Inputs: PARAMETERIZATION : Value of cpf.parameterization option. Z : normalized tangent prediction vector from previous step V : complex bus voltage vector at current solution LAM : scalar lambda value at current solution VPRV : complex bus voltage vector at previous solution LAMPRV : scalar lambda value at previous solution PV : vector of indices of PV buses PQ : vector of indices of PQ buses Outputs: DP_DV : partial of parameterization function w.r.t. voltages DP_DLAM : partial of parameterization function w.r.t. lambda See also CPF_PREDICTOR, CPF_CORRECTOR.
0001 function [dP_dV, dP_dlam] = cpf_p_jac(parameterization, z, V, lam, Vprv, lamprv, pv, pq) 0002 %CPF_P_JAC Computes partial derivatives of CPF parameterization function. 0003 % 0004 % [DP_DV, DP_DLAM ] = CPF_P_JAC(PARAMETERIZATION, Z, V, LAM, ... 0005 % VPRV, LAMPRV, PV, PQ) 0006 % 0007 % Computes the partial derivatives of the continuation power flow 0008 % parameterization function w.r.t. bus voltages and the continuation 0009 % parameter lambda. 0010 % 0011 % Inputs: 0012 % PARAMETERIZATION : Value of cpf.parameterization option. 0013 % Z : normalized tangent prediction vector from previous step 0014 % V : complex bus voltage vector at current solution 0015 % LAM : scalar lambda value at current solution 0016 % VPRV : complex bus voltage vector at previous solution 0017 % LAMPRV : scalar lambda value at previous solution 0018 % PV : vector of indices of PV buses 0019 % PQ : vector of indices of PQ buses 0020 % 0021 % Outputs: 0022 % DP_DV : partial of parameterization function w.r.t. voltages 0023 % DP_DLAM : partial of parameterization function w.r.t. lambda 0024 % 0025 % See also CPF_PREDICTOR, CPF_CORRECTOR. 0026 0027 % MATPOWER 0028 % Copyright (c) 1996-2015 by Power System Engineering Research Center (PSERC) 0029 % by Shrirang Abhyankar, Argonne National Laboratory 0030 % and Ray Zimmerman, PSERC Cornell 0031 % 0032 % $Id: cpf_p_jac.m 2644 2015-03-11 19:34:22Z ray $ 0033 % 0034 % This file is part of MATPOWER. 0035 % Covered by the 3-clause BSD License (see LICENSE file for details). 0036 % See http://www.pserc.cornell.edu/matpower/ for more info. 0037 0038 if parameterization == 1 %% natural 0039 npv = length(pv); 0040 npq = length(pq); 0041 dP_dV = zeros(1, npv+2*npq); 0042 if lam >= lamprv 0043 dP_dlam = 1.0; 0044 else 0045 dP_dlam = -1.0; 0046 end 0047 elseif parameterization == 2 %% arc length 0048 Va = angle(V); 0049 Vm = abs(V); 0050 Vaprv = angle(Vprv); 0051 Vmprv = abs(Vprv); 0052 dP_dV = 2*([Va([pv; pq]); Vm(pq)] - [Vaprv([pv; pq]); Vmprv(pq)])'; 0053 if lam == lamprv %% first step 0054 dP_dlam = 1.0; %% avoid singular Jacobian that would result 0055 %% from [dP_dV, dP_dlam] = 0 0056 else 0057 dP_dlam = 2*(lam-lamprv); 0058 end 0059 elseif parameterization == 3 %% pseudo arc length 0060 nb = length(V); 0061 dP_dV = z([pv; pq; nb+pq])'; 0062 dP_dlam = z(2*nb+1); 0063 end