Home > matpower5.0 > 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 %   $Id: t_makeLODF.m 2229 2013-12-11 01:28:09Z ray $
0006 %   by Ray Zimmerman, PSERC Cornell
0007 %   Copyright (c) 2008-2010 by Power System Engineering Research Center (PSERC)
0008 %
0009 %   This file is part of MATPOWER.
0010 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0011 %
0012 %   MATPOWER is free software: you can redistribute it and/or modify
0013 %   it under the terms of the GNU General Public License as published
0014 %   by the Free Software Foundation, either version 3 of the License,
0015 %   or (at your option) any later version.
0016 %
0017 %   MATPOWER is distributed in the hope that it will be useful,
0018 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0019 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0020 %   GNU General Public License for more details.
0021 %
0022 %   You should have received a copy of the GNU General Public License
0023 %   along with MATPOWER. If not, see <http://www.gnu.org/licenses/>.
0024 %
0025 %   Additional permission under GNU GPL version 3 section 7
0026 %
0027 %   If you modify MATPOWER, or any covered work, to interface with
0028 %   other modules (such as MATLAB code and MEX-files) available in a
0029 %   MATLAB(R) or comparable environment containing parts covered
0030 %   under other licensing terms, the licensors of MATPOWER grant
0031 %   you additional permission to convey the resulting work.
0032 
0033 if nargin < 1
0034     quiet = 0;
0035 end
0036 
0037 ntests = 31;
0038 t_begin(ntests, quiet);
0039 
0040 casefile = 't_auction_case';
0041 if quiet
0042     verbose = 0;
0043 else
0044     verbose = 0;
0045 end
0046 
0047 [PQ, PV, REF, NONE, BUS_I, BUS_TYPE, PD, QD, GS, BS, BUS_AREA, VM, ...
0048     VA, BASE_KV, ZONE, VMAX, VMIN, LAM_P, LAM_Q, MU_VMAX, MU_VMIN] = idx_bus;
0049 [F_BUS, T_BUS, BR_R, BR_X, BR_B, RATE_A, RATE_B, RATE_C, ...
0050     TAP, SHIFT, BR_STATUS, PF, QF, PT, QT, MU_SF, MU_ST, ...
0051     ANGMIN, ANGMAX, MU_ANGMIN, MU_ANGMAX] = idx_brch;
0052 [GEN_BUS, PG, QG, QMAX, QMIN, VG, MBASE, GEN_STATUS, PMAX, PMIN, ...
0053     MU_PMAX, MU_PMIN, MU_QMAX, MU_QMIN, PC1, PC2, QC1MIN, QC1MAX, ...
0054     QC2MIN, QC2MAX, RAMP_AGC, RAMP_10, RAMP_30, RAMP_Q, APF] = idx_gen;
0055 
0056 %% load case
0057 mpc = loadcase(casefile);
0058 mpopt = mpoption('out.all', 0, 'verbose', verbose);
0059 [baseMVA, bus, gen, gencost, branch, f, success, et] = ...
0060     rundcopf(mpc, mpopt);
0061 [i2e, bus, gen, branch] = ext2int(bus, gen, branch);
0062 
0063 %% compute injections and flows
0064 F0  = branch(:, PF);
0065 
0066 %% create some PTDF matrices
0067 H  = makePTDF(baseMVA, bus, branch, 1);
0068 
0069 %% create some PTDF matrices
0070 s = warning('query', 'MATLAB:divideByZero');
0071 warning('off', 'MATLAB:divideByZero');
0072 LODF = makeLODF(branch, H);
0073 warning(s.state, 'MATLAB:divideByZero');
0074 
0075 %% take out non-essential lines one-by-one and see what happens
0076 mpc.bus = bus;
0077 mpc.gen = gen;
0078 branch0 = branch;
0079 outages = [1:12 14:15 17:18 20 27:33 35:41];
0080 for k = outages
0081     mpc.branch = branch0;
0082     mpc.branch(k, BR_STATUS) = 0;
0083     [baseMVA, bus, gen, branch, success, et] = rundcpf(mpc, mpopt);
0084     F = branch(:, PF);
0085 
0086     t_is(LODF(:, k), (F - F0) / F0(k), 6, sprintf('LODF(:, %d)', k));
0087 end
0088 
0089 t_end;

Generated on Mon 26-Jan-2015 15:21:31 by m2html © 2005