CPF_P Computes the value of the CPF parameterization function. P = CPF_P(PARAMETERIZATION, STEP, Z, V, LAM, VPRV, LAMPRV, PV, PQ) Computes the value of the parameterization function at the current solution point. Inputs: PARAMETERIZATION : Value of cpf.parameterization option STEP : continuation step size 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: P : value of the parameterization function at the current point See also CPF_PREDICTOR, CPF_CORRECTOR.
0001 function P = cpf_p(parameterization, step, z, V, lam, Vprv, lamprv, pv, pq) 0002 %CPF_P Computes the value of the CPF parameterization function. 0003 % 0004 % P = CPF_P(PARAMETERIZATION, STEP, Z, V, LAM, VPRV, LAMPRV, PV, PQ) 0005 % 0006 % Computes the value of the parameterization function at the current 0007 % solution point. 0008 % 0009 % Inputs: 0010 % PARAMETERIZATION : Value of cpf.parameterization option 0011 % STEP : continuation step size 0012 % Z : normalized tangent prediction vector from previous step 0013 % V : complex bus voltage vector at current solution 0014 % LAM : scalar lambda value at current solution 0015 % VPRV : complex bus voltage vector at previous solution 0016 % LAMPRV : scalar lambda value at previous solution 0017 % PV : vector of indices of PV buses 0018 % PQ : vector of indices of PQ buses 0019 % 0020 % Outputs: 0021 % P : value of the parameterization function at the current point 0022 % 0023 % See also CPF_PREDICTOR, CPF_CORRECTOR. 0024 0025 % MATPOWER 0026 % $Id: cpf_p.m 2238 2013-12-12 15:32:29Z ray $ 0027 % by Shrirang Abhyankar, Argonne National Laboratory 0028 % and Ray Zimmerman, PSERC Cornell 0029 % Copyright (c) 1996-2013 by Power System Engineering Research Center (PSERC) 0030 % 0031 % This file is part of MATPOWER. 0032 % See http://www.pserc.cornell.edu/matpower/ for more info. 0033 % 0034 % MATPOWER is free software: you can redistribute it and/or modify 0035 % it under the terms of the GNU General Public License as published 0036 % by the Free Software Foundation, either version 3 of the License, 0037 % or (at your option) any later version. 0038 % 0039 % MATPOWER is distributed in the hope that it will be useful, 0040 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0041 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0042 % GNU General Public License for more details. 0043 % 0044 % You should have received a copy of the GNU General Public License 0045 % along with MATPOWER. If not, see <http://www.gnu.org/licenses/>. 0046 % 0047 % Additional permission under GNU GPL version 3 section 7 0048 % 0049 % If you modify MATPOWER, or any covered work, to interface with 0050 % other modules (such as MATLAB code and MEX-files) available in a 0051 % MATLAB(R) or comparable environment containing parts covered 0052 % under other licensing terms, the licensors of MATPOWER grant 0053 % you additional permission to convey the resulting work. 0054 0055 %% evaluate P(x0, lambda0) 0056 if parameterization == 1 %% natural 0057 if lam >= lamprv 0058 P = lam - lamprv - step; 0059 else 0060 P = lamprv - lam - step; 0061 end 0062 elseif parameterization == 2 %% arc length 0063 Va = angle(V); 0064 Vm = abs(V); 0065 Vaprv = angle(Vprv); 0066 Vmprv = abs(Vprv); 0067 P = sum(([Va([pv; pq]); Vm(pq); lam] - [Vaprv([pv; pq]); Vmprv(pq); lamprv]).^2) - step^2; 0068 elseif parameterization == 3 %% pseudo arc length 0069 nb = length(V); 0070 Va = angle(V); 0071 Vm = abs(V); 0072 Vaprv = angle(Vprv); 0073 Vmprv = abs(Vprv); 0074 P = z([pv; pq; nb+pq; 2*nb+1])' * ... 0075 ( [Va([pv; pq]); Vm(pq); lam] - [Vaprv([pv; pq]); Vmprv(pq); lamprv] )... 0076 - step; 0077 end