Home > matpower7.1 > lib > cpf_nose_event_cb.m

cpf_nose_event_cb

PURPOSE ^

CPF_NOSE_EVENT_CB Callback to handle NOSE events

SYNOPSIS ^

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

DESCRIPTION ^

CPF_NOSE_EVENT_CB  Callback to handle NOSE events
   [NX, CX, DONE, ROLLBACK, EVNTS, CB_DATA, RESULTS] = 
       CPF_NOSE_EVENT_CB(K, NX, CX, PX, DONE, ROLLBACK, EVNTS, ...
                               CB_DATA, CB_ARGS, RESULTS)

   Callback to handle NOSE events, triggered by event function
   CPF_NOSE_EVENT to indicate the nose point of the continuation curve.

   This function sets the msg field of the event when the nose point has
   been found, raises the DONE.flag and sets the DONE.msg.

   See CPF_DEFAULT_CALLBACK for details of the input and output arguments.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [nx, cx, done, rollback, evnts, cb_data, results] = cpf_nose_event_cb(...
0002         k, nx, cx, px, done, rollback, evnts, cb_data, cb_args, results)
0003 %CPF_NOSE_EVENT_CB  Callback to handle NOSE events
0004 %   [NX, CX, DONE, ROLLBACK, EVNTS, CB_DATA, RESULTS] =
0005 %       CPF_NOSE_EVENT_CB(K, NX, CX, PX, DONE, ROLLBACK, EVNTS, ...
0006 %                               CB_DATA, CB_ARGS, RESULTS)
0007 %
0008 %   Callback to handle NOSE events, triggered by event function
0009 %   CPF_NOSE_EVENT to indicate the nose point of the continuation curve.
0010 %
0011 %   This function sets the msg field of the event when the nose point has
0012 %   been found, raises the DONE.flag and sets the DONE.msg.
0013 %
0014 %   See CPF_DEFAULT_CALLBACK for details of the input and output arguments.
0015 
0016 %   MATPOWER
0017 %   Copyright (c) 2016, Power Systems Engineering Research Center (PSERC)
0018 %   by Ray Zimmerman, PSERC Cornell
0019 %   and Shrirang Abhyankar, Argonne National Laboratory
0020 %
0021 %   This file is part of MATPOWER.
0022 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0023 %   See https://matpower.org for more info.
0024 
0025 %% skip if initialize, finalize or done
0026 if k <= 0 || done.flag
0027     return;
0028 end
0029 
0030 %% initialize return value
0031 stop_at = cb_data.mpopt.cpf.stop_at;
0032 
0033 %% handle event
0034 if ~rollback || nx.step == 0
0035     for i = 1:length(evnts)
0036         if strcmp(evnts(i).name, 'NOSE') && evnts(i).zero
0037             if nx.step == 0
0038                 evnts(i).msg = ...
0039                     sprintf('Nose point eliminated by limit induced bifurcation at %d continuation steps, lambda = %.4g.', k, nx.lam);
0040             else
0041                 evnts(i).msg = ...
0042                     sprintf('Reached steady state loading limit in %d continuation steps, lambda = %.4g.', k, nx.lam);
0043             end
0044 
0045             %% the following conditional is only necessary if we also allow
0046             %% finding the location of the nose-point without terminating
0047             if ischar(stop_at) && strcmp(stop_at, 'NOSE');
0048                 done.flag = 1;
0049                 done.msg = evnts(i).msg;
0050             end
0051             break;
0052         end
0053     end
0054 end

Generated on Fri 09-Oct-2020 11:21:31 by m2html © 2005