0001 function t_cpf_case39(quiet)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 if nargin < 1
0014 quiet = 0;
0015 end
0016 define_constants;
0017
0018 mpc = loadcase('case39');
0019
0020 dir_all = [eye(39);ones(1,39)];
0021 idx_nonzero_loads = mpc.bus(:,PD) > 0;
0022
0023 nb_dir = size(dir_all,1);
0024
0025 t0 = 'case39: ';
0026
0027 num_tests = nb_dir;
0028 t_begin(num_tests, quiet);
0029 for i = 1:nb_dir
0030 dir = dir_all(i,:)';
0031 dir(~idx_nonzero_loads)=0;
0032 if sum(dir) == 0 || i == 31
0033
0034
0035
0036
0037 t = sprintf('%s All load zeros or increase at slack bus',t0);
0038 t_skip(1, t);
0039 else
0040
0041 mpc_target = mpc;
0042 nonzero_loads = mpc_target.bus(:,PD) ~= 0;
0043 Q_P = mpc_target.bus(nonzero_loads,QD)./mpc_target.bus(nonzero_loads,PD);
0044 mpc_target.bus(:,PD) = mpc.bus(:,PD)+2*dir*mpc_target.baseMVA;
0045 mpc_target.bus(nonzero_loads,QD) = Q_P.*mpc_target.bus(nonzero_loads,PD);
0046
0047 [results,~] = runcpf(mpc,mpc_target,mpoption('out.all',0,'verbose',0));
0048
0049 max_loads_cpf = results.bus(:,PD);
0050
0051
0052 results_mll = maxloadlim(mpc,dir,'use_qlim',0,'verbose',0);
0053
0054 max_loads_mll = results_mll.bus(:,PD);
0055
0056 t = sprintf('%sdirection: %s',t0,mat2str(dir));
0057 if i == 9
0058 t_skip(1, sprintf('%s - KNOWN MISMATCH: (%.2f, %.2f)', t, max_loads_mll(9), max_loads_cpf(9)));
0059 else
0060 t_is(max_loads_mll,max_loads_cpf,0,t);
0061 end
0062 end
0063 end
0064 t_end