Home > matpower6.0 > t > t_cpf_cb2.m

t_cpf_cb2

PURPOSE ^

T_CPF_CB2 User callback function 2 for continuation power flow testing.

SYNOPSIS ^

function [nx, cx, done, rollback, evnts, cb_data, results] = t_cpf_cb2(k, nx, cx, px, done, rollback, evnts, cb_data, cb_args, results)

DESCRIPTION ^

T_CPF_CB2  User callback function 2 for continuation power flow testing.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [nx, cx, done, rollback, evnts, cb_data, results] = t_cpf_cb2(...
0002         k, nx, cx, px, done, rollback, evnts, cb_data, cb_args, results)
0003 %T_CPF_CB2  User callback function 2 for continuation power flow testing.
0004 
0005 %   MATPOWER
0006 %   Copyright (c) 2013-2016, Power Systems Engineering Research Center (PSERC)
0007 %   by Ray Zimmerman, PSERC Cornell
0008 %
0009 %   This file is part of MATPOWER.
0010 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0011 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0012 
0013 %%-----  INITIAL call  -----
0014 if k == 0
0015     cxx = struct(   'initial', cb_args.initial, ...
0016                     'iteration', 0, ...
0017                     'final', 0  );
0018     nxx = cxx;
0019     cx.cb.cb2 = cxx;
0020     nx.cb.cb2 = nxx;
0021     if ~isfield(cx.cb, 'shared')
0022         cx.cb.shared = '';
0023         nx.cb.shared = '';
0024     end
0025     cx.cb.shared = [cx.cb.shared '2'];
0026     nx.cb.shared = [nx.cb.shared '2'];
0027 else
0028     nxx = nx.cb.cb2;            %% get next callback state
0029     %%-----  ITERATION call  -----
0030     if k > 0
0031         nxx.iteration = nxx.iteration + cb_args.iteration;
0032         nx.cb.cb2 = nxx;        %% update next callback state
0033         nx.cb.shared = [nx.cb.shared '2'];  %% update next callback state
0034     %%-----  FINAL call  -----
0035     else    % k < 0
0036         results.cb2.initial     = nxx.initial;
0037         results.cb2.iteration   = nxx.iteration;
0038         results.cb2.final       = cb_args.final;
0039         results.shared          = nx.cb.shared;
0040     end
0041 end

Generated on Fri 16-Dec-2016 12:45:37 by m2html © 2005