Home > matpower7.0 > lib > cpf_plim_event.m

cpf_plim_event

PURPOSE ^

CPF_PLIM_EVENT Event function to detect gen active power limit violations

SYNOPSIS ^

function ef = cpf_plim_event(cb_data, cx)

DESCRIPTION ^

CPF_PLIM_EVENT  Event function to detect gen active power limit violations
   EF = CPF_PLIM_EVENT(CB_DATA, CX)

   CPF event function to detect generator active power limit violations,
   i.e. Pg >= Pmax.

   Inputs:
       CB_DATA : struct of data for callback functions
       CX : struct containing info about current point (continuation soln)

   Outputs:
       EF : event function value

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function ef = cpf_plim_event(cb_data, cx)
0002 %CPF_PLIM_EVENT  Event function to detect gen active power limit violations
0003 %   EF = CPF_PLIM_EVENT(CB_DATA, CX)
0004 %
0005 %   CPF event function to detect generator active power limit violations,
0006 %   i.e. Pg >= Pmax.
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 ng x 1 vector equal to:
0025 %%      [ Pg - Pmax ]
0026 
0027 %% define named indices into bus, gen, branch matrices
0028 [PQ, PV, REF, NONE, BUS_I, BUS_TYPE, PD, QD, GS, BS, BUS_AREA, VM, ...
0029     VA, BASE_KV, ZONE, VMAX, VMIN, LAM_P, LAM_Q, MU_VMAX, MU_VMIN] = idx_bus;
0030 [GEN_BUS, PG, QG, QMAX, QMIN, VG, MBASE, GEN_STATUS, PMAX, PMIN, ...
0031     MU_PMAX, MU_PMIN, MU_QMAX, MU_QMIN, PC1, PC2, QC1MIN, QC1MAX, ...
0032     QC2MIN, QC2MAX, RAMP_AGC, RAMP_10, RAMP_30, RAMP_Q, APF] = idx_gen;
0033 
0034 %% get updated MPC
0035 d = cb_data;
0036 mpc = cpf_current_mpc(d.mpc_base, d.mpc_target, ...
0037     d.Ybus, d.Yf, d.Yt, d.ref, d.pv, d.pq, cx.V, cx.lam, d.mpopt);
0038 
0039 %% compute Pg violations for on-line gens, that weren't previously at Pmax
0040 ng = size(mpc.gen, 1);
0041 v_Pmax = NaN(ng, 1);
0042 on = find(mpc.gen(:, GEN_STATUS) > 0);   %% which generators are on?
0043 v_Pmax(on) = mpc.gen(on, PG) - mpc.gen(on, PMAX);
0044 v_Pmax(d.idx_pmax) = NaN;
0045 
0046 %% assemble event function value
0047 ef = v_Pmax;

Generated on Mon 24-Jun-2019 15:58:45 by m2html © 2005