Home > matpower6.0 > t > t_cpf_cb1.m

t_cpf_cb1

PURPOSE ^

T_CPF_CB1 User callback function 1 for continuation power flow testing.

SYNOPSIS ^

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

DESCRIPTION ^

T_CPF_CB1  User callback function 1 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_cb1(...
0002         k, nx, cx, px, done, rollback, evnts, cb_data, cb_args, results)
0003 %T_CPF_CB1  User callback function 1 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', 1, ...
0016                     'iteration', 0, ...
0017                     'final', 0  );
0018     nxx = cxx;
0019     cx.cb.cb1 = cxx;
0020     nx.cb.cb1 = nxx;
0021     if ~isfield(cx.cb, 'shared')
0022         cx.cb.shared = '';
0023         nx.cb.shared = '';
0024     end
0025     cx.cb.shared = [cx.cb.shared '1'];
0026     nx.cb.shared = [nx.cb.shared '1'];
0027 else
0028     nxx = nx.cb.cb1;            %% get next callback state
0029     %%-----  ITERATION call  -----
0030     if k > 0
0031         nxx.iteration = nxx.iteration + 1;
0032         nx.cb.cb1 = nxx;        %% update next callback state
0033         nx.cb.shared = [nx.cb.shared '1'];  %% update next callback state
0034     %%-----  FINAL call  -----
0035     else    % k < 0
0036         results.cb1.initial     = nxx.initial;
0037         results.cb1.iteration   = nxx.iteration;
0038         results.cb1.final       = 1;
0039         results.shared          = nx.cb.shared;
0040     end
0041 end

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