0001 function mso = most_summary(mdo)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 [PQ, PV, REF, NONE, BUS_I, BUS_TYPE, PD, QD, GS, BS, BUS_AREA, VM, ...
0037 VA, BASE_KV, ZONE, VMAX, VMIN, LAM_P, LAM_Q, MU_VMAX, MU_VMIN] = idx_bus;
0038 [GEN_BUS, PG, QG, QMAX, QMIN, VG, MBASE, GEN_STATUS, PMAX, PMIN, ...
0039 MU_PMAX, MU_PMIN, MU_QMAX, MU_QMIN, PC1, PC2, QC1MIN, QC1MAX, ...
0040 QC2MIN, QC2MAX, RAMP_AGC, RAMP_10, RAMP_30, RAMP_Q, APF] = idx_gen;
0041 [F_BUS, T_BUS, BR_R, BR_X, BR_B, RATE_A, RATE_B, RATE_C, ...
0042 TAP, SHIFT, BR_STATUS, PF, QF, PT, QT, MU_SF, MU_ST, ...
0043 ANGMIN, ANGMAX, MU_ANGMIN, MU_ANGMAX] = idx_brch;
0044
0045 tol = 1e-4;
0046 verbose = mdo.QP.opt.verbose;
0047
0048 mpc = mdo.mpc;
0049 nb = size(mpc.bus, 1);
0050 nl = size(mpc.branch, 1);
0051 ng = size(mpc.gen, 1);
0052 nt = mdo.idx.nt;
0053 nj_max = max(mdo.idx.nj);
0054 nc_max = max(max(mdo.idx.nc));
0055
0056
0057 psi = zeros(nt, nj_max, nc_max+1);
0058 Pg = zeros(ng, nt, nj_max, nc_max+1);
0059 if mdo.idx.ntramp
0060 Rup = [zeros(ng, 1) mdo.results.Rrp];
0061 Rdn = [zeros(ng, 1) mdo.results.Rrm];
0062 else
0063 Rup = [];
0064 Rdn = [];
0065 end
0066 u = zeros(ng, nt);
0067 lamP = zeros(nb, nt, nj_max, nc_max+1);
0068 muF = zeros(nl, nt, nj_max, nc_max+1);
0069 Pf = zeros(nl, nt, nj_max, nc_max+1);
0070 for t = 1:nt
0071 for j = 1:mdo.idx.nj(t)
0072 for k = 1:mdo.idx.nc(t,j)+1
0073 rr = mdo.flow(t,j,k).mpc;
0074 psi(t, j, k) = mdo.CostWeightsAdj(k, j, t);
0075 u(:, t) = rr.gen(:, GEN_STATUS);
0076 Pg(:, t, j, k) = rr.gen(:, PG);
0077 lamP(:, t, j, k) = rr.bus(:, LAM_P);
0078 Pf(:, t, j, k) = rr.branch(:, PF);
0079 muF(:, t, j, k) = rr.branch(:, MU_SF) + rr.branch(:, MU_ST);
0080 end
0081 end
0082 end
0083
0084 ms = struct(...
0085 'f', mdo.QP.f + mdo.QP.c1, ...
0086 'nb', nb, ...
0087 'ng', ng, ...
0088 'nl', nl, ...
0089 'nt', nt, ...
0090 'nj_max', nj_max, ...
0091 'nc_max', nc_max, ...
0092 'psi', psi, ...
0093 'Pg', Pg, ...
0094 'Rup', Rup, ...
0095 'Rdn', Rdn, ...
0096 'Pf', Pf, ...
0097 'u', u, ...
0098 'lamP', lamP, ...
0099 'muF', muF ...
0100 );
0101
0102
0103 if verbose
0104 fprintf('\n========== OBJECTIVE ==========\n');
0105 fprintf('f = %.12g\n', ms.f);
0106
0107 fprintf('\n========== GEN_STATUS ==========\n');
0108 fprintf(' Gen ');
0109 for t = 1:nt
0110 fprintf(' t =%2d ', t);
0111 end
0112 fprintf('\n');
0113 fprintf('----');
0114 for t = 1:nt
0115 fprintf(' -------');
0116 end
0117 fprintf('\n');
0118 for i = 1:ng
0119 fprintf('%4d', i);
0120
0121 for t = 1:nt
0122 qty = u(i, t);
0123 if abs(qty) > tol
0124 fprintf(' 1 ');
0125 else
0126 fprintf(' --0--');
0127 end
0128 end
0129 fprintf('\n');
0130 end
0131 fprintf('\n');
0132
0133 print_most_summary_section('PG', 'Gen', nt, nj_max, nc_max, Pg);
0134 if mdo.idx.ntramp
0135 print_most_summary_section('RAMP UP', 'Gen', nt, 1, 0, Rup);
0136 print_most_summary_section('RAMP DOWN', 'Gen', nt, 1, 0, Rdn);
0137 end
0138 print_most_summary_section('LAM_P', 'Bus', nt, nj_max, nc_max, lamP);
0139 print_most_summary_section('PF', 'Brch', nt, nj_max, nc_max, Pf);
0140 print_most_summary_section('MU_F', 'Brch', nt, nj_max, nc_max, muF);
0141 end
0142
0143 if nargout
0144 mso = ms;
0145 end
0146
0147
0148 function print_most_summary_section(label, section_type, nt, nj_max, nc_max, data, tol)
0149 if nargin < 7
0150 tol = 1e-4;
0151 end
0152 n = size(data, 1);
0153 bl = blanks(fix((12-length(label)) / 2));
0154 fprintf('\n==========%-12s==========\n', sprintf('%s%s', bl, label));
0155 for j = 1:nj_max
0156 for k = 1:nc_max+1
0157 if nj_max > 1 || nc_max > 0
0158 fprintf('\nSCENARIO %d', j);
0159 if nc_max == 0
0160 fprintf('\n');
0161 elseif k == 1
0162 fprintf(', base case\n');
0163 else
0164 fprintf(', contingency %d\n', k-1);
0165 end
0166 end
0167 fprintf('%4s ', section_type);
0168 for t = 1:nt
0169 fprintf(' t =%2d ', t);
0170 end
0171 fprintf('\n');
0172 fprintf('----');
0173 for t = 1:nt
0174 fprintf(' -------');
0175 end
0176 fprintf('\n');
0177 for i = 1:n
0178 fprintf('%4d', i);
0179 for t = 1:nt
0180 qty = data(i, t, j, k);
0181 if abs(qty) > tol
0182 fprintf('%9.2f', qty);
0183 else
0184 fprintf(' - ');
0185 end
0186 end
0187 fprintf('\n');
0188 end
0189 end
0190 end
0191 fprintf('\n');