MATPOWER / most

MOST – MATPOWER Optimal Scheduling Tool, for steady-state power systems scheduling problems.
https://matpower.org/
Other
31 stars 11 forks source link

price computation failure on Example 6 (Deterministic UC) with Opt Tbx #21

Closed ajaythakur01 closed 2 years ago

ajaythakur01 commented 3 years ago

I am working on Deterministic Unit Commitment, after running this program there are some errors. this is my program: close all; clc; casefile = 'ex_case3b'; mpc = loadcase(casefile); xgd = loadxgendata('ex_xgd_uc',mpc); [iwind,mpc,xgd] = addwind('ex_wind_uc',mpc,xgd); profiles = getprofiles('ex_wind_profile_d',iwind); profiles = getprofiles('ex_load_profile',profiles); nt=size(profiles(1).values,1); %number of periods mpc_full = mpc; %save for later xgd_full = xgd; %save for later STARTUP = 2; SHUTDOWN = 3; mpc.gencost(:,[STARTUP SHUTDOWN])= 0; %remove startup/shutdown costs xgd.MinUp(2) = 1; %remove min up-time constraint xgd.PositiveLoadFollowReserveQuantity(3)= 250; %remove ramp reserve xgd.PositiveLoadFollowReservePrice(3)= 1e-6; %constraint and costs xgd.NegativeLoadFollowReservePrice(3)= 1e-6; mpopt = mpoption('out.all', 0, 'verbose', 2); mpopt = mpoption(mpopt,'most.dc_model',1); %use DC network model(default) mdi = loadmd(mpc,nt,xgd,[],[],profiles); mdo = most(mdi,mpopt); ms = most_summary(mdo); %print results,depending on 'vebrose'option mpc.gencost(2,[STARTUP SHUTDOWN])=[200 200]; mpc.gencost(3,[STARTUP SHUTDOWN])=[3000 600]; %equivalent to doing: mpc = mpc_full mdi = loadmd(mpc,nt,xgd,[],[],profiles); mdo = most(mdi,mpopt); xgd.MinUp(2) = 3; mdi = loadmd(mpc,nt,xgd,[],[],profiles); mdo = most(mdi,mpopt); xgd.PositiveLoadFollowReserveQuatity(3)= 100; %restore ramp reserve xgd.PositiveLoadFollowReservePrice(3)= 10; %constraint and costs xgd.NegativeLoadFollowReservePrice(3)= 10; %equivalent to doing:xgd = xgd_full; mdi = loadmd(mpc,nt,xgd,[],[],profiles); %mpopt = mpoption(mpopt,'most.storage.cyclic',1); [iess,mpc,xgd,sd] = addstorage('ex_storage',mpc,xgd); mdo = most(mdi,mpopt);

Errors are: Error using miqps_ot (line 347) miqps_ot: EXITFLAG from price computation stage = -2

Error in miqps_master (line 218) [x, f, eflag, output, lambda] = ...

Error in opt_model/solve (line 189) [x, f, eflag, output, lambda] = ...

Error in most (line 2014) [mdo.QP.x, mdo.QP.f, mdo.QP.exitflag, mdo.QP.output, mdo.QP.lambda ] = ...

Error in TestProgram_MPUC_1 (line 21) mdo = most(mdi,mpopt);

rdzman commented 3 years ago

First of all, please ...

  1. Don't post your issue by replying to an existing issue that is unrelated.
  2. Don't post your issue more than once in the same project.
  3. Don't post your issue in more than one project. Find the project you think is most appropriate (probably this one, in your case), and create a new issue.

I'm going to delete all the duplicate issues and posts elsewhere and keep this discussion here.

So, when running an optimization with integer variables, like unit commitment, MP-Opt-Model runs a price computation stage after solving the initial problem (see Section 4.2 in the MP-Opt-Model User's Manual), by converting the integer variables to continuous and constraining their values to the solved integer values and re-solving the continuous problem to compute constraint shadow prices.

So the error you are seeing is telling you that linprog is returning -2 (no feasible point found). My best guess is that the solution tolerances on the original integer problem solved by intlinprog are the issue. As is often the case for numerical issues when dealing with different architectures, OS's and versions of MATLAB, I'm not able to reproduce the error on my machine.

However, I suggest you start by decreasing the IntegerTolerance and ConstraintTolerance options for intlinprog and see if that helps.

E.g. Maybe, try something like ...

mpopt = mpoption(mpopt, 'intlinprog', struct('IntegerTolerance', 1e-6, 'ConstraintTolerance', 1e-6));

Another option, if you are able, is to install an even better solver like Gurobi, which offers academic licenses free of charge.

ajaythakur01 commented 3 years ago

thank you