Home > matpower5.1 > 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-2015 by Power System Engineering Research Center (PSERC)
0006 %   by Ray Zimmerman, PSERC Cornell
0007 %
0008 %   $Id: t_makeLODF.m 2644 2015-03-11 19:34:22Z ray $
0009 %
0010 %   This file is part of MATPOWER.
0011 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0012 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0013 
0014 if nargin < 1
0015     quiet = 0;
0016 end
0017 
0018 ntests = 31;
0019 t_begin(ntests, quiet);
0020 
0021 casefile = 't_auction_case';
0022 if quiet
0023     verbose = 0;
0024 else
0025     verbose = 0;
0026 end
0027 
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 [F_BUS, T_BUS, BR_R, BR_X, BR_B, RATE_A, RATE_B, RATE_C, ...
0031     TAP, SHIFT, BR_STATUS, PF, QF, PT, QT, MU_SF, MU_ST, ...
0032     ANGMIN, ANGMAX, MU_ANGMIN, MU_ANGMAX] = idx_brch;
0033 [GEN_BUS, PG, QG, QMAX, QMIN, VG, MBASE, GEN_STATUS, PMAX, PMIN, ...
0034     MU_PMAX, MU_PMIN, MU_QMAX, MU_QMIN, PC1, PC2, QC1MIN, QC1MAX, ...
0035     QC2MIN, QC2MAX, RAMP_AGC, RAMP_10, RAMP_30, RAMP_Q, APF] = idx_gen;
0036 
0037 %% load case
0038 mpc = loadcase(casefile);
0039 mpopt = mpoption('out.all', 0, 'verbose', verbose);
0040 [baseMVA, bus, gen, gencost, branch, f, success, et] = ...
0041     rundcopf(mpc, mpopt);
0042 [i2e, bus, gen, branch] = ext2int(bus, gen, branch);
0043 
0044 %% compute injections and flows
0045 F0  = branch(:, PF);
0046 
0047 %% create some PTDF matrices
0048 H  = makePTDF(baseMVA, bus, branch, 1);
0049 
0050 %% create some PTDF matrices
0051 s = warning('query', 'MATLAB:divideByZero');
0052 warning('off', 'MATLAB:divideByZero');
0053 LODF = makeLODF(branch, H);
0054 warning(s.state, 'MATLAB:divideByZero');
0055 
0056 %% take out non-essential lines one-by-one and see what happens
0057 mpc.bus = bus;
0058 mpc.gen = gen;
0059 branch0 = branch;
0060 outages = [1:12 14:15 17:18 20 27:33 35:41];
0061 for k = outages
0062     mpc.branch = branch0;
0063     mpc.branch(k, BR_STATUS) = 0;
0064     [baseMVA, bus, gen, branch, success, et] = rundcpf(mpc, mpopt);
0065     F = branch(:, PF);
0066 
0067     t_is(LODF(:, k), (F - F0) / F0(k), 6, sprintf('LODF(:, %d)', k));
0068 end
0069 
0070 t_end;

Generated on Fri 20-Mar-2015 18:23:34 by m2html © 2005