MATPOWER/most

Is it possible to change 'CommitKey' over time within a time period?

yadong-zhang opened this issue · 5 comments

I am running a MOST case with a 12-hour period, I have some prior knowledge of UC for all generators, so is it possible to force 'CommitKey' in the xgd_table for all generators at every time step? If so, how could I achieve it? Two possible ways occurred to me:

  1. Run
    xgd = loadxgendata(xgd_table, mpc);
    [iwind, mpc, xgd] = addwind(wind_UC, mpc, xgd);
    to get xgd, and then specify UC by adding a time loop;

  2. Run mdi = loadmd(mpc, nt, xgd, [], [], profiles); to get mdi, and then specify UC by adding a time loop

Does anyone have idea regarding this? Thanks a lot for the help!

rdzman commented

This is a good question. You should be able to accomplish this with a profile, such as those used for load or wind. They are designed to be able to provide time-varying values for any parameter in mpc, xgd, or sd.

I haven't tested it, but something like the following should work as a profile to specify CommitKey.

function ckprofile = commitkey_profile

% define constants
[CT_LABEL, CT_PROB, CT_TABLE, CT_TBUS, CT_TGEN, CT_TBRCH, CT_TAREABUS, ...
    CT_TAREAGEN, CT_TAREABRCH, CT_ROW, CT_COL, CT_CHGTYPE, CT_REP, ...
    CT_REL, CT_ADD, CT_NEWVAL, CT_TLOAD, CT_TAREALOAD, CT_LOAD_ALL_PQ, ...
    CT_LOAD_FIX_PQ, CT_LOAD_DIS_PQ, CT_LOAD_ALL_P, CT_LOAD_FIX_P, ...
    CT_LOAD_DIS_P, CT_TGENCOST, CT_TAREAGENCOST, CT_MODCOST_F, ...
    CT_MODCOST_X] = idx_ct;

ckprofile = struct( ...
    'type', 'xGenData', ...
    'table', 'CommitKey', ...
    'rows', [1;3;4], ...  % for generators 1, 3 and 4
    'col', 0, ...
    'chgtype', CT_REP, ...
    'values', [] );
ckprofile.values(:, 1, :) = [
	-1	2	1;
	-1	2	1;
	1	1	-1;
	1	1	-1;
	1	2	1;
	1	2	1;
	1	2	1;
	1	2	1;
	-1	1	1;
	-1	1	1;
	-1	1	1;
	-1	1	1;
];

The first dimension (rows) in the values field correspond to the periods and the 3rd dimension (columns) correspond to the generating units.

Please let us know whether this works as expected.

This is a good question. You should be able to accomplish this with a profile, such as those used for load or wind. They are designed to be able to provide time-varying values for any parameter in mpc, xgd, or sd.

I haven't tested it, but something like the following should work as a profile to specify CommitKey.

function ckprofile = commitkey_profile

% define constants
[CT_LABEL, CT_PROB, CT_TABLE, CT_TBUS, CT_TGEN, CT_TBRCH, CT_TAREABUS, ...
    CT_TAREAGEN, CT_TAREABRCH, CT_ROW, CT_COL, CT_CHGTYPE, CT_REP, ...
    CT_REL, CT_ADD, CT_NEWVAL, CT_TLOAD, CT_TAREALOAD, CT_LOAD_ALL_PQ, ...
    CT_LOAD_FIX_PQ, CT_LOAD_DIS_PQ, CT_LOAD_ALL_P, CT_LOAD_FIX_P, ...
    CT_LOAD_DIS_P, CT_TGENCOST, CT_TAREAGENCOST, CT_MODCOST_F, ...
    CT_MODCOST_X] = idx_ct;

ckprofile = struct( ...
    'type', 'xGenData', ...
    'table', 'CommitKey', ...
    'rows', [1;3;4], ...  % for generators 1, 3 and 4
    'col', 0, ...
    'chgtype', CT_REP, ...
    'values', [] );
ckprofile.values(:, 1, :) = [
	-1	2	1;
	-1	2	1;
	1	1	-1;
	1	1	-1;
	1	2	1;
	1	2	1;
	1	2	1;
	1	2	1;
	-1	1	1;
	-1	1	1;
	-1	1	1;
	-1	1	1;
];

The first dimension (rows) in the values field correspond to the periods and the 3rd dimension (columns) correspond to the generating units.

Please let us know whether this works as expected.

Thanks for the reply! I am doing a test right now, but will the two ways I mentioned work? I have tried the second one, but seems not working.

rdzman commented

I think they should both work as well. You should be able to assign the CommitKey value for generator i in period t, either via the profile I suggested (preferred), or by assigning it to xgd.CommitKey(i, t) in your first option, or mdi.UC.CommitKey(i, t) in your second option.

I think they should both work as well. You should be able to assign the CommitKey value for generator i in period t, either via the profile I suggested (preferred), or by assigning it to xgd.CommitKey(i, t) in your first option, or mdi.UC.CommitKey(i, t) in your second option.

The way you provided worked!! But neither the two ways I mentioned worked :(. At least we know how to proceed in future. Thanks a lot for your help!

rdzman commented

👍