Home > matpower7.0 > lib > t > t_makeLODF.m

t_makeLODF

PURPOSE ^

T_MAKELODF Tests for MAKELODF.

SYNOPSIS ^

function t_makeLODF(quiet)

DESCRIPTION ^

T_MAKELODF  Tests for MAKELODF.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function t_makeLODF(quiet)
0002 %T_MAKELODF  Tests for MAKELODF.
0003 
0004 %   MATPOWER
0005 %   Copyright (c) 2008-2016, Power Systems Engineering Research Center (PSERC)
0006 %   by Ray Zimmerman, PSERC Cornell
0007 %
0008 %   This file is part of MATPOWER.
0009 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0010 %   See https://matpower.org for more info.
0011 
0012 if nargin < 1
0013     quiet = 0;
0014 end
0015 
0016 ntests = 31;
0017 t_begin(ntests, quiet);
0018 
0019 casefile = 't_auction_case';
0020 if quiet
0021     verbose = 0;
0022 else
0023     verbose = 0;
0024 end
0025 
0026 [PQ, PV, REF, NONE, BUS_I, BUS_TYPE, PD, QD, GS, BS, BUS_AREA, VM, ...
0027     VA, BASE_KV, ZONE, VMAX, VMIN, LAM_P, LAM_Q, MU_VMAX, MU_VMIN] = idx_bus;
0028 [F_BUS, T_BUS, BR_R, BR_X, BR_B, RATE_A, RATE_B, RATE_C, ...
0029     TAP, SHIFT, BR_STATUS, PF, QF, PT, QT, MU_SF, MU_ST, ...
0030     ANGMIN, ANGMAX, MU_ANGMIN, MU_ANGMAX] = idx_brch;
0031 [GEN_BUS, PG, QG, QMAX, QMIN, VG, MBASE, GEN_STATUS, PMAX, PMIN, ...
0032     MU_PMAX, MU_PMIN, MU_QMAX, MU_QMIN, PC1, PC2, QC1MIN, QC1MAX, ...
0033     QC2MIN, QC2MAX, RAMP_AGC, RAMP_10, RAMP_30, RAMP_Q, APF] = idx_gen;
0034 
0035 %% load case
0036 mpc = loadcase(casefile);
0037 mpopt = mpoption('out.all', 0, 'verbose', verbose);
0038 [baseMVA, bus, gen, gencost, branch, f, success, et] = ...
0039     rundcopf(mpc, mpopt);
0040 [i2e, bus, gen, branch] = ext2int(bus, gen, branch);
0041 
0042 %% compute injections and flows
0043 F0  = branch(:, PF);
0044 
0045 %% create some PTDF matrices
0046 H  = makePTDF(baseMVA, bus, branch, 1);
0047 
0048 %% create some PTDF matrices
0049 s = warning('query', 'MATLAB:divideByZero');
0050 warning('off', 'MATLAB:divideByZero');
0051 LODF = makeLODF(branch, H);
0052 warning(s.state, 'MATLAB:divideByZero');
0053 
0054 %% take out non-essential lines one-by-one and see what happens
0055 mpc.bus = bus;
0056 mpc.gen = gen;
0057 branch0 = branch;
0058 outages = [1:12 14:15 17:18 20 27:33 35:41];
0059 for k = outages
0060     mpc.branch = branch0;
0061     mpc.branch(k, BR_STATUS) = 0;
0062     [baseMVA, bus, gen, branch, success, et] = rundcpf(mpc, mpopt);
0063     F = branch(:, PF);
0064 
0065     t_is(LODF(:, k), (F - F0) / F0(k), 6, sprintf('LODF(:, %d)', k));
0066 end
0067 
0068 t_end;

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