⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 t_auction.m

📁 可进行电力系统多节点系统的优化潮流计算
💻 M
📖 第 1 页 / 共 2 页
字号:
        runmkt('t_auction_case', q, p, 1130, 100, [], [], mpopt);    cp3 = cp;    t_is( cq, cq5, 8, [t ' : quantities'] );    t_is( cp, cp5, 8, [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, [], [], mpopt);    cp4 = cp;    t_is( cq, cq5, 8, [t ' : quantities'] );    t_is( cp(G(1),:), 50, 5, [t ' : gen 1 price'] );    t_is( cp(G(2:5),:), cp5(G(2:5),:)+frb_p_gap, 8, [t ' : gen 2-5 prices'] );    t_is( cp(G(6),:), 48, 5, [t ' : gen 6 price'] );    t_is( cp(L,:), cp5(L,:)+frb_p_gap, 8, [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, [], [], mpopt);    t_is( cq, cq5, 8, [t ' : quantities'] );    t_is( cp, cp5, 8, [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, [], [], mpopt);    t_is( cq, cq5, 8, [t ' : quantities'] );    t_is( cp, cp5, 5, [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, [], [], mpopt);    t_is( cq, cq5, 8, [t ' : quantities'] );    t_is( cp, cp5, 5, [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, [], [], mpopt);    t_is( cq, cq5, 8, [t ' : quantities'] );    t_is( cp, p, 8, [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, [], [], 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, 4, 'lao_gap');    t_is( fro_gap, 2.7855, 4, 'fro_gap');    t_is( lab_p_gap, 0, 4, 'lab_p_gap');    t_is( frb_p_gap, -8.3496, 4, 'frb_p_gap');        t_is( cp(G(1),:), 65, 4, [t ' : gen 1 price'] );    t_is( cp(G(2),:), 54.2976, 4, [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, [], [], mpopt);    cp1 = cp;    t_is( cq, cq5, 8, [t ' : quantities'] );    t_is( cp(G(1),:), 65, 8, [t ' : gen 1 price'] );    t_is( cp(G(2:6),:), cp_lam(G(2:6),:)+lao_gap, 8, [t ' : gen 2-6 prices'] );    t_is( cp(L,:), cp_lam(L,:)+lao_gap, 8, [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, [], [], mpopt);    t_is( cq, cq5, 8, [t ' : quantities'] );    t_is( cp(G(1),:), 65, 8, [t ' : gen 1 price'] );    t_is( cp(G(2:6),:), cp_lam(G(2:6),:)+fro_gap, 8, [t ' : gen 2-6 prices'] );    t_is( cp(L(1:2),:), cp_lam(L(1:2),:)+fro_gap, 8, [t ' : load 1-2 prices'] );    t_is( cp(L(3),:), 60, 8, [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, [], [], mpopt);    cp3 = cp;    t_is( cq, cq5, 8, [t ' : quantities'] );    t_is( cp(G(1),:), 65, 8, [t ' : gen 1 price'] );    t_is( cp(G(2:6),:), cp_lam(G(2:6),:), 8, [t ' : gen 2-6 prices'] );    t_is( cp(L,:), cp_lam(L,:), 8, [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, [], [], mpopt);    cp4 = cp;    t_is( cq, cq5, 8, [t ' : quantities'] );    t_is( cp(G(1),:), 65, 5, [t ' : gen 1 price'] );    t_is( cp(G(2:6),:), cp5(G(2:6),:)+frb_p_gap, 8, [t ' : gen 2-6 prices'] );    t_is( cp(L,:), cp5(L,:)+frb_p_gap, 8, [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, [], [], mpopt);    t_is( cq, cq5, 8, [t ' : quantities'] );    t_is( cp, cp4, 8, [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, [], [], mpopt);    t_is( cq, cq5, 8, [t ' : quantities'] );    t_is( cp(G(1),:), 65, 4, [t ' : gen 1 price'] );    t_is( cp(G(2:6),:), cp_lam(G(2:6),:) + lao_gap/2, 8, [t ' : gen 2-6 prices'] );    t_is( cp(L,:), cp_lam(L,:) + lao_gap/2, 8, [t ' : load prices'] );    t_is( cp, (cp1 + cp3) / 2, 8, [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, [], [], mpopt);    t_is( cq, cq5, 8, [t ' : quantities'] );    t_is( cp(G,:), cp1(G,:), 8, [t ' : prices'] );    t_is( cp(L,:), cp3(L,:), 8, [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, [], [], mpopt);    t_is( cq, cq5, 8, [t ' : quantities'] );    t_is( cp, p2, 8, [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, [], [], 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, 4, 'lao_gap');    t_is( fro_gap, 8.1075, 4, 'fro_gap');    t_is( lab_p_gap, 36.7616, 4, 'lab_p_gap');    t_is( frb_p_gap, -61.2157, 4, 'frb_p_gap');        t_is( cp(G(1),:), 65, 4, [t ' : gen 1 price'] );    t_is( cp(G(2),:), 57.1616, 4, [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, [], [], mpopt);    cp1 = cp;    t_is( cq, cq5, 8, [t ' : quantities'] );    t_is( cp, cp5, 8, [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, [], [], mpopt);    t_is( cq, cq5, 8, [t ' : quantities'] );    t_is( cp, cp_lam+fro_gap, 8, [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, [], [], mpopt);    cp3 = cp;    t_is( cq, cq5, 8, [t ' : quantities'] );    t_is( cp, cp_lam+lab_p_gap, 8, [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, [], [], mpopt);    t_is( cq, cq5, 8, [t ' : quantities'] );    t_is( cp(G,1), [65;40;42;44;46;60], 4, [t ' : gen prices'] );    t_is( cp(L,:), cp_lam(L,:) + frb_p_gap, 8, [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, [], [], mpopt);    t_is( cq, cq5, 8, [t ' : quantities'] );    t_is( cp, cp_lam+fro_gap, 8, [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, [], [], mpopt);    t_is( cq, cq5, 8, [t ' : quantities'] );    t_is( cp, cp_lam + lab_p_gap/2, 8, [t ' : prices'] );    t_is( cp, (cp_lam + cp3) / 2, 8, [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, [], [], mpopt);    t_is( cq, cq5, 8, [t ' : quantities'] );    t_is( cp(G,:), cp5(G,:), 8, [t ' : prices'] );    t_is( cp(L,:), cp3(L,:), 8, [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, [], [], mpopt);    t_is( cq, cq5, 8, [t ' : quantities'] );    t_is( cp, p2, 8, [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, [], [], mpopt);    t_is(sum(cq(2,:)), 0, 8, t);    t_is(cp(2,1), 59.194, 3, 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, [], [], mpopt);    t_is(cp(2,1), 59.194, 3, 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, [], [], mpopt);    t_is(cp(2,1), 60.440, 3, 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, [], [], mpopt);    t_is(cp(2,1), 69.106, 3, 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, [], [], mpopt);    t_is(cp(2,1), 59.106, 3, 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, [], [], mpopt);    t_is(cp(2,1), 60.440, 3, 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, [], [], mpopt);    t_is(cp(2,1), 64.150, 3, 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, [], [], mpopt);    t_is(cp(2,1), 120, 3, 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, [], [], 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 + -