0001 function printmkt(r, t, dispatch, success, fd, mpopt)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 if nargin < 6
0023 mpopt = mpoption;
0024 if nargin < 5
0025 fd = 1;
0026 end
0027 end
0028 gen = r.gen;
0029
0030
0031 OUT_RAW = 0;
0032
0033
0034 [GEN_BUS, PG, QG, QMAX, QMIN, VG, MBASE, GEN_STATUS, PMAX, PMIN, ...
0035 MU_PMAX, MU_PMIN, MU_QMAX, MU_QMIN, PC1, PC2, QC1MIN, QC1MAX, ...
0036 QC2MIN, QC2MAX, RAMP_AGC, RAMP_10, RAMP_30, RAMP_Q, APF] = idx_gen;
0037 [QUANTITY, PRICE, FCOST, VCOST, SCOST, PENALTY] = idx_disp;
0038
0039
0040 ng = size(gen, 1);
0041
0042
0043 pay = dispatch(:, PRICE) .* dispatch(:, QUANTITY) * t;
0044 cost = dispatch(:, FCOST) + dispatch(:, VCOST) + dispatch(:, SCOST) + dispatch(:, PENALTY);
0045 if mpopt.out.all
0046
0047 fprintf(fd, '\n================================================================================');
0048 fprintf(fd, '\n| Market Summary |');
0049 fprintf(fd, '\n================================================================================');
0050 fprintf(fd, '\nDispatch period duration: %.2f hours', t);
0051 fprintf(fd, '\nGen Bus Pg Price Revenue Fix+Var Strt/Stp Total Earnings');
0052 fprintf(fd, '\n # # (MW) ($/MWh) ($) Cost ($) Cost ($) Cost ($) ($) ');
0053 fprintf(fd, '\n--- --- -------- -------- -------- -------- -------- -------- --------');
0054 for i = 1:size(gen, 1)
0055 if gen(i, PG)
0056 fprintf(fd, '\n%3d%5d%9.2f%10.3f%10.2f%10.2f%10.2f%10.2f%10.2f', ...
0057 i, gen(i, GEN_BUS), dispatch(i, QUANTITY), dispatch(i, PRICE), pay(i), ...
0058 dispatch(i, FCOST) + dispatch(i, VCOST), ...
0059 dispatch(i, SCOST), cost(i), pay(i) - cost(i));
0060 else
0061 if dispatch(i, SCOST) || dispatch(i, PENALTY)
0062 fprintf(fd, '\n%3d%5d - %10.3f - - %10.2f%10.2f%10.2f', ...
0063 i, gen(i, GEN_BUS), dispatch(i, PRICE), dispatch(i, SCOST), ...
0064 cost(i), pay(i) - cost(i));
0065 else
0066 fprintf(fd, '\n%3d%5d - %10.3f - - - - -', ...
0067 i, gen(i, GEN_BUS), dispatch(i, PRICE));
0068 end
0069 end
0070 if dispatch(i, PENALTY)
0071 fprintf(fd, '%10.2f penalty (included in total cost)', dispatch(i, PENALTY));
0072 end
0073 end
0074 fprintf(fd, '\n -------- -------- -------- -------- -------- --------');
0075 fprintf(fd, '\nTotal: %9.2f %10.2f%10.2f%10.2f%10.2f%10.2f', ...
0076 sum(dispatch(:, QUANTITY)), sum(pay), sum(dispatch(:, FCOST)) + sum(dispatch(:, VCOST)), ...
0077 sum(dispatch(:, SCOST)), sum(cost), sum(pay-cost));
0078 if sum(dispatch(:, PENALTY))
0079 fprintf(fd, '%10.2f penalty (included in total cost)', sum(dispatch(:, PENALTY)));
0080 end
0081 fprintf(fd, '\n');
0082 end
0083
0084
0085 if OUT_RAW
0086 fprintf(fd, '---------- raw PW::Dispatch data below ----------\n');
0087 fprintf(fd, 'dispatch\n');
0088 fprintf(fd, '%d\t%.8g\t%.8g\t%.8g\t%.8g\t%.8g\t%.8g\t%.8g\n', ...
0089 [(1:ng)' dispatch(:, [QUANTITY, PRICE, FCOST, VCOST, SCOST, PENALTY]) pay-cost]');
0090 fprintf(fd, '---------- raw PW::Dispatch data above ----------\n');
0091 end
0092
0093
0094 printpf(r, fd, mpopt);