LOADSHED Returns a vector of curtailments of dispatchable loads. SHED = LOADSHED(GEN) SHED = LOADSHED(GEN, ILD) Returns a column vector of MW curtailments of dispatchable loads. Inputs: GEN - MATPOWER generator matrix ILD - (optional) NLD x 1 vector of generator indices corresponding to the dispatchable loads of interest, default is all dispatchable loads as determined by the ISLOAD() function. Output: SHED - NLD x 1 vector of the MW curtailment for each dispatchable load of interest Example: total_load_shed = max(loadshed(mpc.gen));
0001 function shed = loadshed(gen, ild) 0002 %LOADSHED Returns a vector of curtailments of dispatchable loads. 0003 % SHED = LOADSHED(GEN) 0004 % SHED = LOADSHED(GEN, ILD) 0005 % 0006 % Returns a column vector of MW curtailments of dispatchable loads. 0007 % 0008 % Inputs: 0009 % GEN - MATPOWER generator matrix 0010 % ILD - (optional) NLD x 1 vector of generator indices corresponding 0011 % to the dispatchable loads of interest, default is all 0012 % dispatchable loads as determined by the ISLOAD() function. 0013 % 0014 % Output: 0015 % SHED - NLD x 1 vector of the MW curtailment for each dispatchable 0016 % load of interest 0017 % 0018 % Example: 0019 % total_load_shed = max(loadshed(mpc.gen)); 0020 0021 % MATPOWER 0022 % Copyright (c) 2018, Power Systems Engineering Research Center (PSERC) 0023 % by Ray Zimmerman, PSERC Cornell 0024 % 0025 % This file is part of MATPOWER. 0026 % Covered by the 3-clause BSD License (see LICENSE file for details). 0027 % See https://matpower.org for more info. 0028 0029 [GEN_BUS, PG, QG, QMAX, QMIN, VG, MBASE, GEN_STATUS, PMAX, PMIN, ... 0030 MU_PMAX, MU_PMIN, MU_QMAX, MU_QMIN, PC1, PC2, QC1MIN, QC1MAX, ... 0031 QC2MIN, QC2MAX, RAMP_AGC, RAMP_10, RAMP_30, RAMP_Q, APF] = idx_gen; 0032 0033 %% default input 0034 if nargin < 2 0035 ild = find(isload(gen)); 0036 end 0037 0038 tol = 1e-5; 0039 shed = gen(ild, PG) - gen(ild, PMIN); 0040 0041 %% zero out anything less than tolerance 0042 shed(shed < tol) = 0;