CPF_VLIM_EVENT Event function to detect bus voltage limit violations EF = CPF_VLIM_EVENT(CB_DATA, CX) CPF event function to detect bus voltage limits violations, i.e. Vm <= Vmin or Vm >= Vmax. 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_vlim_event(cb_data, cx) 0002 %CPF_VLIM_EVENT Event function to detect bus voltage limit violations 0003 % EF = CPF_VLIM_EVENT(CB_DATA, CX) 0004 % 0005 % CPF event function to detect bus voltage limits violations, 0006 % i.e. Vm <= Vmin or Vm >= Vmax. 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 2 nb x 1 vector equal to: 0026 %% [ Vmin - Vm ] 0027 %% [ Vm - Vmax ] 0028 0029 %% define named indices into bus, gen, branch matrices 0030 [PQ, PV, REF, NONE, BUS_I, BUS_TYPE, PD, QD, GS, BS, BUS_AREA, VM, ... 0031 VA, BASE_KV, ZONE, VMAX, VMIN, LAM_P, LAM_Q, MU_VMAX, MU_VMIN] = idx_bus; 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 %% voltage magnitude violations 0039 v_Vmin = mpc.bus(:, VMIN) - mpc.bus(:, VM); 0040 v_Vmax = mpc.bus(:, VM) - mpc.bus(:, VMAX); 0041 0042 %% assemble event function value 0043 ef = [v_Vmin;v_Vmax];