CPF_TARGET_LAM_EVENT Event function to detect a target lambda value EF = CPF_TARGET_LAM_EVENT(CB_DATA, CX) CPF event function to detect the completion of the continuation curve or another target value of lambda. Inputs: CB_DATA : struct of data for callback functions CX : struct containing info about current point (continuation soln) Outputs: EF : event function value
0001 function ef = cpf_target_lam_event(cb_data, cx) 0002 %CPF_TARGET_LAM_EVENT Event function to detect a target lambda value 0003 % EF = CPF_TARGET_LAM_EVENT(CB_DATA, CX) 0004 % 0005 % CPF event function to detect the completion of the continuation curve 0006 % or another target value of lambda. 0007 % 0008 % Inputs: 0009 % CB_DATA : struct of data for callback functions 0010 % CX : struct containing info about current point (continuation soln) 0011 % 0012 % Outputs: 0013 % EF : event function value 0014 0015 % MATPOWER 0016 % Copyright (c) 2016, Power Systems Engineering Research Center (PSERC) 0017 % by Ray Zimmerman, PSERC Cornell 0018 % and Shrirang Abhyankar, Argonne National Laboratory 0019 % 0020 % This file is part of MATPOWER. 0021 % Covered by the 3-clause BSD License (see LICENSE file for details). 0022 % See https://matpower.org for more info. 0023 0024 %% event function value is a scalar equal to: current lambda - target lambda 0025 target = cb_data.mpopt.cpf.stop_at; 0026 if ischar(target) %% 'FULL' trace requested 0027 if cx.z(end) >= 0 %% before the nose point ... 0028 target = -1; %% prevent early termination (e.g. itr 1 rollback to 0) 0029 else %% after the nose point ... 0030 target = 0; %% terminate at lam = 0 0031 end 0032 end 0033 ef = cx.lam - target;