CPF_FLIM_EVENT Event function to detect branch flow limit (MVA) violations EF = CPF_FLIM_EVENT(CB_DATA, CX) CPF event function to detect branch flow limit (MVA) violations, i.e. max(Sf,St) >= SrateA. 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_flim_event(cb_data, cx) 0002 %CPF_FLIM_EVENT Event function to detect branch flow limit (MVA) violations 0003 % EF = CPF_FLIM_EVENT(CB_DATA, CX) 0004 % 0005 % CPF event function to detect branch flow limit (MVA) violations, 0006 % i.e. max(Sf,St) >= SrateA. 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-2017, Power Systems Engineering Research Center (PSERC) 0017 % by Ray Zimmerman, PSERC Cornell 0018 % and Ahmad Abubakar Sadiq, Federal University of Technology Minna, Nigeria 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 %% event function value is nl x 1 vector equal to: 0026 %% [ max(Sf,St) - SrateA ] 0027 0028 %% define named indices into bus, gen, branch matrices 0029 [F_BUS, T_BUS, BR_R, BR_X, BR_B, RATE_A, RATE_B, RATE_C, ... 0030 TAP, SHIFT, BR_STATUS, PF, QF, PT, QT, MU_SF, MU_ST, ... 0031 ANGMIN, ANGMAX, MU_ANGMIN, MU_ANGMAX] = idx_brch; 0032 0033 %% get updated MPC 0034 d = cb_data; 0035 mpc = cpf_current_mpc(d.mpc_base, d.mpc_target, ... 0036 d.Ybus, d.Yf, d.Yt, d.ref, d.pv, d.pq, cx.V, cx.lam, d.mpopt); 0037 0038 %% compute line flow MVA violations 0039 SrateA = d.mpc_base.branch(:,RATE_A); 0040 Sf = sqrt((mpc.branch(:, PF)).^2 + (mpc.branch(:, QF)).^2); 0041 St = sqrt((mpc.branch(:, PT)).^2 + (mpc.branch(:, QT)).^2); 0042 0043 %% line flow event function 0044 ef = max(Sf,St) - SrateA;