📄 t_auction_fmincopf.m
字号:
t = 'marginal offer @ $50, bid @ $54.50, auction_type = 3'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p, 1130, 100, u0, []/60, mpopt); cp3 = cp; t_is( cq, cq5, 4, [t ' : quantities'] ); t_is( cp, cp5, 3, [t ' : prices'] ); t = 'marginal offer @ $50, bid @ $54.50, auction_type = 4'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p, 1140, 100, u0, []/60, mpopt); cp4 = cp; t_is( cq, cq5, 4, [t ' : quantities'] ); t_is( cp(G(1),:), 50, 3, [t ' : gen 1 price'] ); t_is( cp(G(2:5),:), cp5(G(2:5),:)+frb_p_gap, 3, [t ' : gen 2-5 prices'] ); t_is( cp(G(6),:), 48, 3, [t ' : gen 6 price'] ); t_is( cp(L,:), cp5(L,:)+frb_p_gap, 3, [t ' : load prices'] ); t = 'marginal offer @ $50, bid @ $54.50, auction_type = 6'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p, 1160, 100, u0, []/60, mpopt); t_is( cq, cq5, 4, [t ' : quantities'] ); t_is( cp, cp5, 3, [t ' : prices'] ); t = 'marginal offer @ $50, bid @ $54.50, auction_type = 7'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p, 1170, 100, u0, []/60, mpopt); t_is( cq, cq5, 4, [t ' : quantities'] ); t_is( cp, cp5, 3, [t ' : prices'] ); t = 'marginal offer @ $50, bid @ $54.50, auction_type = 8'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p, 1180, 100, u0, []/60, mpopt); t_is( cq, cq5, 4, [t ' : quantities'] ); t_is( cp, cp5, 3, [t ' : prices'] ); t = 'marginal offer @ $50, bid @ $54.50, auction_type = 0'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p, 1100, 100, u0, []/60, mpopt); t_is( cq, cq5, 4, [t ' : quantities'] ); t_is( cp, p, 3, [t ' : prices'] ); %%----- gen 1 at Pmin, load 3 block 2 marginal @ $60 ----- t = 'gen 1 @ Pmin, marginal bid @ $60, auction_type = 5'; p(L(2),2) = 50; %% undo previous change p2 = p; p2(G(1),2:3) = [65 65]; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p2, 1150, 100, u0, []/60, mpopt); Qfudge = zeros(size(p)); Qfudge(L,:) = diag(gen(L,QG) ./ gen(L,PG) .* bus(Lbus, LAM_Q)) * ones(size(p(L,:))); lao_gap = p2(G(6),2) - bus(Gbus(6), LAM_P); fro_gap = p2(G(6),3) - bus(Gbus(6), LAM_P); lab_p_gap = p2(L(3),2) - (bus(Lbus(3), LAM_P) + Qfudge(L(3),2)); frb_p_gap = p2(L(2),2) - (bus(Lbus(2), LAM_P) + Qfudge(L(2),2)); t_is( lao_gap, -9.2145, 2, 'lao_gap'); t_is( fro_gap, 2.7855, 2, 'fro_gap'); t_is( lab_p_gap, 0, 2, 'lab_p_gap'); t_is( frb_p_gap, -8.3496, 2, 'frb_p_gap'); t_is( cp(G(1),:), 65, 2, [t ' : gen 1 price'] ); t_is( cp(G(2),:), 54.2976, 2, [t ' : gen 2 price'] ); cq5 = cq; cp5 = cp; cp_lam = cp5; cp_lam(1,:) = bus(Gbus(1), LAM_P); %% unclipped t = 'gen 1 @ Pmin, marginal bid @ $60, auction_type = 1'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p2, 1110, 100, u0, []/60, mpopt); cp1 = cp; t_is( cq, cq5, 4, [t ' : quantities'] ); t_is( cp(G(1),:), 65, 3, [t ' : gen 1 price'] ); t_is( cp(G(2:6),:), cp_lam(G(2:6),:)+lao_gap, 3, [t ' : gen 2-6 prices'] ); t_is( cp(L,:), cp_lam(L,:)+lao_gap, 3, [t ' : load prices'] ); t = 'gen 1 @ Pmin, marginal bid @ $60, auction_type = 2'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p2, 1120, 100, u0, []/60, mpopt); t_is( cq, cq5, 4, [t ' : quantities'] ); t_is( cp(G(1),:), 65, 3, [t ' : gen 1 price'] ); t_is( cp(G(2:6),:), cp_lam(G(2:6),:)+fro_gap, 3, [t ' : gen 2-6 prices'] ); t_is( cp(L(1:2),:), cp_lam(L(1:2),:)+fro_gap, 3, [t ' : load 1-2 prices'] ); t_is( cp(L(3),:), 60, 3, [t ' : load 3 price'] ); t = 'gen 1 @ Pmin, marginal bid @ $60, auction_type = 3'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p2, 1130, 100, u0, []/60, mpopt); cp3 = cp; t_is( cq, cq5, 4, [t ' : quantities'] ); t_is( cp(G(1),:), 65, 3, [t ' : gen 1 price'] ); t_is( cp(G(2:6),:), cp_lam(G(2:6),:), 3, [t ' : gen 2-6 prices'] ); t_is( cp(L,:), cp_lam(L,:), 3, [t ' : load prices'] ); t = 'gen 1 @ Pmin, marginal bid @ $60, auction_type = 4'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p2, 1140, 100, u0, []/60, mpopt); cp4 = cp; t_is( cq, cq5, 4, [t ' : quantities'] ); t_is( cp(G(1),:), 65, 3, [t ' : gen 1 price'] ); t_is( cp(G(2:6),:), cp5(G(2:6),:)+frb_p_gap, 3, [t ' : gen 2-6 prices'] ); t_is( cp(L,:), cp5(L,:)+frb_p_gap, 3, [t ' : load prices'] ); t = 'gen 1 @ Pmin, marginal bid @ $60, auction_type = 6'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p2, 1160, 100, u0, []/60, mpopt); t_is( cq, cq5, 4, [t ' : quantities'] ); t_is( cp, cp4, 3, [t ' : prices'] ); t = 'gen 1 @ Pmin, marginal bid @ $60, auction_type = 7'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p2, 1170, 100, u0, []/60, mpopt); t_is( cq, cq5, 4, [t ' : quantities'] ); t_is( cp(G(1),:), 65, 2, [t ' : gen 1 price'] ); t_is( cp(G(2:6),:), cp_lam(G(2:6),:) + lao_gap/2, 3, [t ' : gen 2-6 prices'] ); t_is( cp(L,:), cp_lam(L,:) + lao_gap/2, 3, [t ' : load prices'] ); t_is( cp, (cp1 + cp3) / 2, 3, [t ' : prices'] ); t = 'gen 1 @ Pmin, marginal bid @ $60, auction_type = 8'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p2, 1180, 100, u0, []/60, mpopt); t_is( cq, cq5, 4, [t ' : quantities'] ); t_is( cp(G,:), cp1(G,:), 3, [t ' : prices'] ); t_is( cp(L,:), cp3(L,:), 3, [t ' : prices'] ); t = 'gen 1 @ Pmin, marginal bid @ $60, auction_type = 0'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p2, 1100, 100, u0, []/60, mpopt); t_is( cq, cq5, 4, [t ' : quantities'] ); t_is( cp, p2, 3, [t ' : prices'] ); %%----- gen 1 at Pmin, gen 6 block 3 marginal @ $60 ----- t = 'gen 1 @ Pmin, marginal offer @ $60, auction_type = 5'; p2(L,:) = [ 100 100 100; 100 0 0; 100 100 0 ]; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p2, 1150, 100, u0, []/60, mpopt); Qfudge = zeros(size(p)); Qfudge(L,:) = diag(gen(L,QG) ./ gen(L,PG) .* bus(Lbus, LAM_Q)) * ones(size(p(L,:))); lao_gap = p2(G(6),3) - bus(Gbus(6), LAM_P); fro_gap = p2(G(1),3) - bus(Gbus(1), LAM_P); lab_p_gap = p2(L(3),2) - (bus(Lbus(3), LAM_P) + Qfudge(L(3),2)); frb_p_gap = p2(L(2),2) - (bus(Lbus(2), LAM_P) + Qfudge(L(2),2)); t_is( lao_gap, 0, 2, 'lao_gap'); t_is( fro_gap, 8.1075, 2, 'fro_gap'); t_is( lab_p_gap, 36.7616, 2, 'lab_p_gap'); t_is( frb_p_gap, -61.2157, 2, 'frb_p_gap'); t_is( cp(G(1),:), 65, 2, [t ' : gen 1 price'] ); t_is( cp(G(2),:), 57.1616, 2, [t ' : gen 2 price'] ); cq5 = cq; cp5 = cp; cp_lam = cp5; cp_lam(1,:) = bus(Gbus(1), LAM_P); %% unclipped t = 'gen 1 @ Pmin, marginal offer @ $60, auction_type = 1'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p2, 1110, 100, u0, []/60, mpopt); cp1 = cp; t_is( cq, cq5, 4, [t ' : quantities'] ); t_is( cp, cp5, 3, [t ' : prices'] ); t = 'gen 1 @ Pmin, marginal offer @ $60, auction_type = 2'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p2, 1120, 100, u0, []/60, mpopt); t_is( cq, cq5, 4, [t ' : quantities'] ); t_is( cp, cp_lam+fro_gap, 3, [t ' : prices'] ); t = 'gen 1 @ Pmin, marginal offer @ $60, auction_type = 3'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p2, 1130, 100, u0, []/60, mpopt); cp3 = cp; t_is( cq, cq5, 4, [t ' : quantities'] ); t_is( cp, cp_lam+lab_p_gap, 3, [t ' : prices'] ); t = 'gen 1 @ Pmin, marginal offer @ $60, auction_type = 4'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p2, 1140, 100, u0, []/60, mpopt); t_is( cq, cq5, 4, [t ' : quantities'] ); t_is( cp(G,1), [65;40;42;44;46;60], 2, [t ' : gen prices'] ); t_is( cp(L,:), cp_lam(L,:) + frb_p_gap, 3, [t ' : prices'] ); t = 'gen 1 @ Pmin, marginal offer @ $60, auction_type = 6'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p2, 1160, 100, u0, []/60, mpopt); t_is( cq, cq5, 4, [t ' : quantities'] ); t_is( cp, cp_lam+fro_gap, 3, [t ' : prices'] ); t = 'gen 1 @ Pmin, marginal offer @ $60, auction_type = 7'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p2, 1170, 100, u0, []/60, mpopt); t_is( cq, cq5, 4, [t ' : quantities'] ); t_is( cp, cp_lam + lab_p_gap/2, 3, [t ' : prices'] ); t_is( cp, (cp_lam + cp3) / 2, 3, [t ' : prices'] ); t = 'gen 1 @ Pmin, marginal offer @ $60, auction_type = 8'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p2, 1180, 100, u0, []/60, mpopt); t_is( cq, cq5, 4, [t ' : quantities'] ); t_is( cp(G,:), cp5(G,:), 3, [t ' : prices'] ); t_is( cp(L,:), cp3(L,:), 3, [t ' : prices'] ); t = 'gen 1 @ Pmin, marginal offer @ $60, auction_type = 0'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p2, 1100, 100, u0, []/60, mpopt); t_is( cq, cq5, 4, [t ' : quantities'] ); t_is( cp, p2, 3, [t ' : prices'] ); %%----- gen 2 decommitted, one offer block marginal @ $60 ----- p(G(2),:) = p(G(2),:) + 100; t = 'price of decommited gen, auction_type = 5'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p, 1150, 200, u0, []/60, mpopt); t_is(sum(cq(2,:)), 0, 4, t); t_is(cp(2,1), 59.194, 2, t); t = 'price of decommited gen, auction_type = 1'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p, 1110, 200, u0, []/60, mpopt); t_is(cp(2,1), 59.194, 2, t); t = 'price of decommited gen, auction_type = 2'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p, 1120, 200, u0, []/60, mpopt); t_is(cp(2,1), 60.440, 2, t); t = 'price of decommited gen, auction_type = 3'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p, 1130, 200, u0, []/60, mpopt); t_is(cp(2,1), 69.106, 2, t); t = 'price of decommited gen, auction_type = 4'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p, 1140, 200, u0, []/60, mpopt); t_is(cp(2,1), 59.106, 2, t); t = 'price of decommited gen, auction_type = 6'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p, 1160, 200, u0, []/60, mpopt); t_is(cp(2,1), 60.440, 2, t); t = 'price of decommited gen, auction_type = 7'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p, 1170, 200, u0, []/60, mpopt); t_is(cp(2,1), 64.150, 2, t); t = 'price of decommited gen, auction_type = 0'; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p, 1100, 200, u0, []/60, mpopt); t_is(cp(2,1), 120, 2, t); t = 'single block, marginal offer @ $50, auction_type = 5'; q = [ 60; 36; 36; 36; 36; 36; 30; 10; 20; ]; p = [ 50; 40; 42; 44; 46; 48; 100; 100; 100; ]; [MVAbase, cq, cp, bus, gen, gencost, branch, f, dispatch, success, et] = ... runmkt('t_auction_case', q, p, 1150, 100, u0, []/60, mpopt); t_is( cq(G(1)), 35.32, 2, t ); t_is( cq(G(2:6)), q(G(2:6)), 8, [t ' : gen qtys'] ); t_is( cp(G(1)), 50, 4, t ); t_is( cq(L), q(L), 8, [t ' : load qtys'] ); t_is( cp(L(2),:), 54.03, 2, t ); t_is( cp(G), bus(Gbus, LAM_P), 8, [t ' : gen prices'] ); Qfudge = zeros(size(p)); Qfudge(L,:) = diag(gen(L,QG) ./ gen(L,PG) .* bus(Lbus, LAM_Q)) * ones(size(p(L,:))); t_is( cp(L), bus(Lbus, LAM_P) + Qfudge(L,1), 8, [t ' : load prices'] );endt_end;return;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -