Home > matpower7.0 > extras > sdp_pf > t_insolvablepf.m

t_insolvablepf

PURPOSE ^

T_INSOLVABLEPF Test for power flow insolvability condition

SYNOPSIS ^

function t_insolvablepf(quiet)

DESCRIPTION ^

T_INSOLVABLEPF  Test for power flow insolvability condition

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function t_insolvablepf(quiet)
0002 %T_INSOLVABLEPF  Test for power flow insolvability condition
0003 
0004 %   MATPOWER
0005 %   Copyright (c) 2013-2019, Power Systems Engineering Research Center (PSERC)
0006 %   by Daniel Molzahn, PSERC U of Wisc, Madison
0007 %   and Ray Zimmerman, PSERC Cornell
0008 %
0009 %   This file is part of MATPOWER/mx-sdp_pf.
0010 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0011 %   See https://github.com/MATPOWER/mx-sdp_pf/ for more info.
0012 
0013 if nargin < 1
0014     quiet = 0;
0015 end
0016 
0017 num_tests = 8;
0018 
0019 t_begin(num_tests, quiet);
0020 
0021 [PQ, PV, REF, NONE, BUS_I, BUS_TYPE, PD, QD, GS, BS, BUS_AREA, VM, ...
0022     VA, BASE_KV, ZONE, VMAX, VMIN, LAM_P, LAM_Q, MU_VMAX, MU_VMIN] = idx_bus;
0023 [GEN_BUS, PG, QG, QMAX, QMIN, VG, MBASE, GEN_STATUS, PMAX, PMIN, ...
0024     MU_PMAX, MU_PMIN, MU_QMAX, MU_QMIN, PC1, PC2, QC1MIN, QC1MAX, ...
0025     QC2MIN, QC2MAX, RAMP_AGC, RAMP_10, RAMP_30, RAMP_Q, APF] = idx_gen;
0026 [F_BUS, T_BUS, BR_R, BR_X, BR_B, RATE_A, RATE_B, RATE_C, ...
0027     TAP, SHIFT, BR_STATUS, PF, QF, PT, QT, MU_SF, MU_ST, ...
0028     ANGMIN, ANGMAX, MU_ANGMIN, MU_ANGMAX] = idx_brch;
0029 [PW_LINEAR, POLYNOMIAL, MODEL, STARTUP, SHUTDOWN, NCOST, COST] = idx_cost;
0030 
0031 casefile = 't_case9mod_opf';
0032 if quiet
0033     verbose = 0;
0034 else
0035     verbose = 0;
0036 end
0037 
0038 if have_fcn('octave')
0039     if have_fcn('octave', 'vnum') >= 4
0040         file_in_path_warn_id = 'Octave:data-file-in-path';
0041     else
0042         file_in_path_warn_id = 'Octave:load-file-in-path';
0043     end
0044     s1 = warning('query', file_in_path_warn_id);
0045     warning('off', file_in_path_warn_id);
0046 end
0047 
0048 t0 = 'INSOLVABLEPF : ';
0049 
0050 %% test an insolvable case
0051 load soln9mod_opf;     %% defines bus_soln, gen_soln, branch_soln, Vslack_min_soln, sigma_soln, etacomp_soln
0052 
0053 res = loadcase(casefile);
0054 res.bus = bus_soln;
0055 res.gen = gen_soln;
0056 res.branch = branch_soln;
0057 
0058 % Make the case insolvable
0059 mult = 10;
0060 res.bus(:,PD) = mult*res.bus(:,PD);
0061 res.bus(:,QD) = mult*res.bus(:,QD);
0062 res.gen(:,PG) = mult*res.gen(:,PG);
0063 
0064 mpopt = mpoption('out.all', 0, 'verbose', verbose);
0065 
0066 %% get test results for insolvable case
0067 t = [t0 '(insolvable case) :'];
0068 [insolvable,Vslack_min,sigma,eta,mineigratio] = insolvablepf(res,mpopt);
0069 t_ok(insolvable, [t ' insolvable']);
0070 t_is(Vslack_min, Vslack_min_soln, 3, [t ' Vslack_min']);
0071 t_is(sigma, sigma_soln, 3, [t ' sigma']);
0072 t_is(eta, eta_soln, 3, [t ' eta']);
0073 
0074 
0075 %% test a solvable case
0076 load soln9mod_opf;     %% defines bus_soln, gen_soln, branch_soln, Vslack_min_soln, sigma_soln, etacomp_soln
0077 
0078 res = loadcase(casefile);
0079 res.bus = bus_soln;
0080 res.gen = gen_soln;
0081 res.branch = branch_soln;
0082 
0083 %% get test results for insolvable case
0084 t = [t0 '(solvable case) :'];
0085 [insolvable,Vslack_min,sigma,eta,mineigratio] = insolvablepf(res,mpopt);
0086 t_ok(~insolvable, [t ' solvable']);
0087 t_is(Vslack_min, Vslack_min_soln / sqrt(mult), 3, [t ' Vslack_min']);
0088 t_is(sigma, sigma_soln * sqrt(10), 3, [t ' sigma']);
0089 t_is(eta, eta_soln * mult, 3, [t ' eta']);
0090 
0091 if have_fcn('octave')
0092     warning(s1.state, file_in_path_warn_id);
0093 end
0094 
0095 t_end;

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