0001 function t_varGen_case9(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('case9');
0019
0020
0021 dir_all = [0 0 0 0 1 0 0 0 0;
0022 0 0 0 0 0 0 1 0 0;
0023 0 0 0 0 0 0 0 0 1;
0024 0 0 0 0 1 0 1 0 1;
0025 0 0 0 0 1 0 1 0 0;
0026 0 0 0 0 1 0 0 0 1;
0027 0 0 0 0 0 0 1 0 1];
0028 dir_var_gen_all = [0 1 0;
0029 0 0 1;
0030 0 1 1];
0031 idx_nonzero_loads = mpc.bus(:,PD) > 0;
0032
0033 nb_dir_load = size(dir_all,1);
0034 nb_dir_gen = size(dir_var_gen_all,1);
0035
0036 t0 = 'case9: ';
0037
0038 num_tests = nb_dir_load*nb_dir_gen;
0039 t_begin(num_tests, quiet);
0040 for i = 1:nb_dir_load
0041 dir_load = dir_all(i,:)';
0042 dir_load(~idx_nonzero_loads)=0;
0043 for j = 1:nb_dir_gen
0044 dir_var_gen = dir_var_gen_all(j,:)';
0045 idx_var_gen = find(dir_var_gen);
0046 dir_var_gen = dir_var_gen(idx_var_gen);
0047
0048 gen_load_dir = [dir_load;dir_var_gen];
0049 dir_load = dir_load/norm(gen_load_dir);
0050 dir_var_gen = dir_var_gen/norm(gen_load_dir);
0051
0052 results_with_gens = maxloadlim(mpc,dir_load,'verbose',0,'idx_var_gen',idx_var_gen,'dir_var_gen',dir_var_gen);
0053
0054
0055 mpc2 = mpc;
0056 mpc2.gen(:,PG) = results_with_gens.gen(:,PG);
0057 dir_load2 = dir_load/norm(dir_load);
0058
0059 results_without_gens = maxloadlim(mpc2,dir_load2,'verbose',0);
0060
0061 mll_with_gen = results_with_gens.bus(:,PD);
0062 mll_without_gen = results_without_gens.bus(:,PD);
0063
0064 t = sprintf('%sLOAD: %s GEN: %s',t0,mat2str(dir_load),mat2str(dir_var_gen));
0065 t_is(mll_with_gen,mll_without_gen,0,t);
0066 end
0067 end
0068 t_end