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
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043 if nargin < 6
0044 mpopt = mpoption;
0045 if nargin < 5
0046 fd = 1;
0047 end
0048 end
0049 gen = r.gen;
0050
0051
0052 OUT_RAW = 0;
0053
0054
0055 [GEN_BUS, PG, QG, QMAX, QMIN, VG, MBASE, GEN_STATUS, PMAX, PMIN, ...
0056 MU_PMAX, MU_PMIN, MU_QMAX, MU_QMIN, PC1, PC2, QC1MIN, QC1MAX, ...
0057 QC2MIN, QC2MAX, RAMP_AGC, RAMP_10, RAMP_30, RAMP_Q, APF] = idx_gen;
0058 [QUANTITY, PRICE, FCOST, VCOST, SCOST, PENALTY] = idx_disp;
0059
0060
0061 ng = size(gen, 1);
0062
0063
0064 pay = dispatch(:, PRICE) .* dispatch(:, QUANTITY) * t;
0065 cost = dispatch(:, FCOST) + dispatch(:, VCOST) + dispatch(:, SCOST) + dispatch(:, PENALTY);
0066 if mpopt.out.all
0067
0068 fprintf(fd, '\n================================================================================');
0069 fprintf(fd, '\n| Market Summary |');
0070 fprintf(fd, '\n================================================================================');
0071 fprintf(fd, '\nDispatch period duration: %.2f hours', t);
0072 fprintf(fd, '\nGen Bus Pg Price Revenue Fix+Var Strt/Stp Total Earnings');
0073 fprintf(fd, '\n # # (MW) ($/MWh) ($) Cost ($) Cost ($) Cost ($) ($) ');
0074 fprintf(fd, '\n--- --- -------- -------- -------- -------- -------- -------- --------');
0075 for i = 1:size(gen, 1)
0076 if gen(i, PG)
0077 fprintf(fd, '\n%3d%5d%9.2f%10.3f%10.2f%10.2f%10.2f%10.2f%10.2f', ...
0078 i, gen(i, GEN_BUS), dispatch(i, QUANTITY), dispatch(i, PRICE), pay(i), ...
0079 dispatch(i, FCOST) + dispatch(i, VCOST), ...
0080 dispatch(i, SCOST), cost(i), pay(i) - cost(i));
0081 else
0082 if dispatch(i, SCOST) || dispatch(i, PENALTY)
0083 fprintf(fd, '\n%3d%5d - %10.3f - - %10.2f%10.2f%10.2f', ...
0084 i, gen(i, GEN_BUS), dispatch(i, PRICE), dispatch(i, SCOST), ...
0085 cost(i), pay(i) - cost(i));
0086 else
0087 fprintf(fd, '\n%3d%5d - %10.3f - - - - -', ...
0088 i, gen(i, GEN_BUS), dispatch(i, PRICE));
0089 end
0090 end
0091 if dispatch(i, PENALTY)
0092 fprintf(fd, '%10.2f penalty (included in total cost)', dispatch(i, PENALTY));
0093 end
0094 end
0095 fprintf(fd, '\n -------- -------- -------- -------- -------- --------');
0096 fprintf(fd, '\nTotal: %9.2f %10.2f%10.2f%10.2f%10.2f%10.2f', ...
0097 sum(dispatch(:, QUANTITY)), sum(pay), sum(dispatch(:, FCOST)) + sum(dispatch(:, VCOST)), ...
0098 sum(dispatch(:, SCOST)), sum(cost), sum(pay-cost));
0099 if sum(dispatch(:, PENALTY))
0100 fprintf(fd, '%10.2f penalty (included in total cost)', sum(dispatch(:, PENALTY)));
0101 end
0102 fprintf(fd, '\n');
0103 end
0104
0105
0106 if OUT_RAW
0107 fprintf(fd, '---------- raw PW::Dispatch data below ----------\n');
0108 fprintf(fd, 'dispatch\n');
0109 fprintf(fd, '%d\t%.8g\t%.8g\t%.8g\t%.8g\t%.8g\t%.8g\t%.8g\n', ...
0110 [(1:ng)' dispatch(:, [QUANTITY, PRICE, FCOST, VCOST, SCOST, PENALTY]) pay-cost]');
0111 fprintf(fd, '---------- raw PW::Dispatch data above ----------\n');
0112 end
0113
0114
0115 printpf(r, fd, mpopt);