T_CPF_CB2 User callback function 2 for continuation power flow testing.
0001 function [cb_state, results] = t_cpf_cb2(k, V_c, lam_c, V_p, lam_p, ... 0002 cb_data, cb_state, cb_args, results) 0003 %T_CPF_CB2 User callback function 2 for continuation power flow testing. 0004 0005 % MATPOWER 0006 % $Id: t_cpf_cb2.m 2235 2013-12-11 13:44:13Z ray $ 0007 % by Ray Zimmerman, PSERC Cornell 0008 % Copyright (c) 2013 by Power System Engineering Research Center (PSERC) 0009 % 0010 % This file is part of MATPOWER. 0011 % See http://www.pserc.cornell.edu/matpower/ for more info. 0012 % 0013 % MATPOWER is free software: you can redistribute it and/or modify 0014 % it under the terms of the GNU General Public License as published 0015 % by the Free Software Foundation, either version 3 of the License, 0016 % or (at your option) any later version. 0017 % 0018 % MATPOWER is distributed in the hope that it will be useful, 0019 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0020 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0021 % GNU General Public License for more details. 0022 % 0023 % You should have received a copy of the GNU General Public License 0024 % along with MATPOWER. If not, see <http://www.gnu.org/licenses/>. 0025 % 0026 % Additional permission under GNU GPL version 3 section 7 0027 % 0028 % If you modify MATPOWER, or any covered work, to interface with 0029 % other modules (such as MATLAB code and MEX-files) available in a 0030 % MATLAB(R) or comparable environment containing parts covered 0031 % under other licensing terms, the licensors of MATPOWER grant 0032 % you additional permission to convey the resulting work. 0033 0034 %%----- INITIAL call ----- 0035 if k == 0 0036 cb_state.cb2.initial = cb_args.cb2.initial; 0037 cb_state.cb2.iteration = 0; 0038 cb_state.cb2.final = 0; 0039 %%----- FINAL call ----- 0040 elseif nargout == 2 0041 results.cb2.final = cb_args.cb2.final; 0042 %%----- ITERATION call ----- 0043 else 0044 cb_state.cb2.iteration = cb_state.cb2.iteration + cb_args.cb2.iteration; 0045 end