MATPOWER / matpower

MATPOWER – steady state power flow simulation and optimization for MATLAB and Octave
https://matpower.org
Other
429 stars 152 forks source link

can DCOPF be solved on a case containing DC lines #218

Closed yanda1234 closed 10 months ago

yanda1234 commented 10 months ago

Hi Dr. Zimmerman,

I attempted to address a DCOPF on case "t_case9_dcline" containing DC lines but failed in the process. Would it be possible to seek your guidance on whether such an undertaking is feasible within the capabilities of Matpower? Kindly advise!

MATPOWER Version 7.0, 20-Jun-2019 -- DC Optimal Power Flow Error using linprog LINPROG(f,A,b,Aeq,beq,LB,UB,X0,OPTIONS) does not accept X0. Use LINPROG(f,A,b,Aeq,beq,LB,UB,OPTIONS) instead.

Error in qps_ot (line 267) linprog(c, Ai, bi, Ae, be, xmin, xmax,x0, ot_opt);

Error in qps_matpower (line 258) qps_ot(H, c, A, l, u, xmin, xmax, x0, opt);

Error in dcopf_solver (line 106) [x, f, info, output, lambda] = qps_matpower(HH, CC, A, l, u, xmin, xmax, x0, opt);

Error in opf_execute (line 48) [results, success, raw] = dcopf_solver(om, mpopt);

Error in opf (line 232) [results, success, raw] = opf_execute(om, mpopt);

Error in dcopf (line 19) [varargout{1:nargout}] = opf(mpc, mpopt);

Best, Yanda

yanda1234 commented 10 months ago

Hi Dr. Zimmerman,

I build a case with some dclines and dcline costs. However, upon executing DCOPF, I observed that these DC lines were seemingly unused, as the branch flows connected to their terminal buses exhibited no changes whatsoever. This also happens after running ACOPF. Do you agree? Kindly let me know your thoughts.

Best, Yanda

yanda1234 commented 10 months ago

function mpc = prepared_case %PREPARED_CASE

%% MATPOWER Case Format : Version 2 mpc.version = '2';

%%----- Power Flow Data -----%% %% system MVA base mpc.baseMVA = 100;

%% bus data % bus_i type Pd Qd Gs Bs area Vm Va baseKV zone Vmax Vmin mpc.bus = [ 1000001 2 51 27 0 0 1 0.955 10.67 138 1 1.06 0.94; 1000002 1 20 9 0 0 1 0.971 11.22 138 1 1.06 0.94; 1000003 1 39 10 0 0 1 0.968 11.56 138 1 1.06 0.94; 1000004 2 39 12 0 0 1 0.998 15.28 138 1 1.06 0.94; 1000005 1 0 0 0 -40 1 1.002 15.73 138 1 1.06 0.94; 1000006 2 52 22 0 0 1 0.99 13 138 1 1.06 0.94; 1000007 1 19 2 0 0 1 0.989 12.56 138 1 1.06 0.94; 1000008 2 28 0 0 0 1 1.015 20.77 345 1 1.06 0.94; 1000009 1 0 0 0 0 1 1.043 28.02 345 1 1.06 0.94; 1000010 2 0 0 0 0 1 1.05 35.61 345 1 1.06 0.94; 1000011 1 70 23 0 0 1 0.985 12.72 138 1 1.06 0.94; 1000012 2 47 10 0 0 1 0.99 12.2 138 1 1.06 0.94; 1000013 1 34 16 0 0 1 0.968 11.35 138 1 1.06 0.94; 1000014 1 14 1 0 0 1 0.984 11.5 138 1 1.06 0.94; 1000015 2 90 30 0 0 1 0.97 11.23 138 1 1.06 0.94; 1000016 1 25 10 0 0 1 0.984 11.91 138 1 1.06 0.94; 1000017 1 11 3 0 0 1 0.995 13.74 138 1 1.06 0.94; 1000018 2 60 34 0 0 1 0.973 11.53 138 1 1.06 0.94; 1000019 2 45 25 0 0 1 0.963 11.05 138 1 1.06 0.94; 1000020 1 18 3 0 0 1 0.958 11.93 138 1 1.06 0.94; 1000021 1 14 8 0 0 1 0.959 13.52 138 1 1.06 0.94; 1000022 1 10 5 0 0 1 0.97 16.08 138 1 1.06 0.94; 1000023 1 7 3 0 0 1 1 21 138 1 1.06 0.94; 1000024 2 13 0 0 0 1 0.992 20.89 138 1 1.06 0.94; 1000025 2 0 0 0 0 1 1.05 27.93 138 1 1.06 0.94; 1000026 2 0 0 0 0 1 1.015 29.71 345 1 1.06 0.94; 1000027 2 71 13 0 0 1 0.968 15.35 138 1 1.06 0.94; 1000028 1 17 7 0 0 1 0.962 13.62 138 1 1.06 0.94; 1000029 1 24 4 0 0 1 0.963 12.63 138 1 1.06 0.94; 1000030 1 0 0 0 0 1 0.968 18.79 345 1 1.06 0.94; 1000031 2 43 27 0 0 1 0.967 12.75 138 1 1.06 0.94; 1000032 2 59 23 0 0 1 0.964 14.8 138 1 1.06 0.94; 1000033 1 23 9 0 0 1 0.972 10.63 138 1 1.06 0.94; 1000034 2 59 26 0 14 1 0.986 11.3 138 1 1.06 0.94; 1000035 1 33 9 0 0 1 0.981 10.87 138 1 1.06 0.94; 1000036 2 31 17 0 0 1 0.98 10.87 138 1 1.06 0.94; 1000037 1 0 0 0 -25 1 0.992 11.77 138 1 1.06 0.94; 1000038 1 0 0 0 0 1 0.962 16.91 345 1 1.06 0.94; 1000039 1 27 11 0 0 1 0.97 8.41 138 1 1.06 0.94; 1000040 2 66 23 0 0 1 0.97 7.35 138 1 1.06 0.94; 1000041 1 37 10 0 0 1 0.967 6.92 138 1 1.06 0.94; 1000042 2 96 23 0 0 1 0.985 8.53 138 1 1.06 0.94; 1000043 1 18 7 0 0 1 0.978 11.28 138 1 1.06 0.94; 1000044 1 16 8 0 10 1 0.985 13.82 138 1 1.06 0.94; 1000045 1 53 22 0 10 1 0.987 15.67 138 1 1.06 0.94; 1000046 2 28 10 0 10 1 1.005 18.49 138 1 1.06 0.94; 1000047 1 34 0 0 0 1 1.017 20.73 138 1 1.06 0.94; 1000048 1 20 11 0 15 1 1.021 19.93 138 1 1.06 0.94; 1000049 2 87 30 0 0 1 1.025 20.94 138 1 1.06 0.94; 1000050 1 17 4 0 0 1 1.001 18.9 138 1 1.06 0.94; 1000051 1 17 8 0 0 1 0.967 16.28 138 1 1.06 0.94; 1000052 1 18 5 0 0 1 0.957 15.32 138 1 1.06 0.94; 1000053 1 23 11 0 0 1 0.946 14.35 138 1 1.06 0.94; 1000054 2 113 32 0 0 1 0.955 15.26 138 1 1.06 0.94; 1000055 2 63 22 0 0 1 0.952 14.97 138 1 1.06 0.94; 1000056 2 84 18 0 0 1 0.954 15.16 138 1 1.06 0.94; 1000057 1 12 3 0 0 1 0.971 16.36 138 1 1.06 0.94; 1000058 1 12 3 0 0 1 0.959 15.51 138 1 1.06 0.94; 1000059 2 277 113 0 0 1 0.985 19.37 138 1 1.06 0.94; 1000060 1 78 3 0 0 1 0.993 23.15 138 1 1.06 0.94; 1000061 2 0 0 0 0 1 0.995 24.04 138 1 1.06 0.94; 1000062 2 77 14 0 0 1 0.998 23.43 138 1 1.06 0.94; 1000063 1 0 0 0 0 1 0.969 22.75 345 1 1.06 0.94; 1000064 1 0 0 0 0 1 0.984 24.52 345 1 1.06 0.94; 1000065 2 0 0 0 0 1 1.005 27.65 345 1 1.06 0.94; 1000066 2 39 18 0 0 1 1.05 27.48 138 1 1.06 0.94; 1000067 1 28 7 0 0 1 1.02 24.84 138 1 1.06 0.94; 1000068 1 0 0 0 0 1 1.003 27.55 345 1 1.06 0.94; 1000069 3 0 0 0 0 1 1.035 30 138 1 1.06 0.94; 1000070 2 66 20 0 0 1 0.984 22.58 138 1 1.06 0.94; 1000071 1 0 0 0 0 1 0.987 22.15 138 1 1.06 0.94; 1000072 2 12 0 0 0 1 0.98 20.98 138 1 1.06 0.94; 1000073 2 6 0 0 0 1 0.991 21.94 138 1 1.06 0.94; 1000074 2 68 27 0 12 1 0.958 21.64 138 1 1.06 0.94; 1000075 1 47 11 0 0 1 0.967 22.91 138 1 1.06 0.94; 1000076 2 68 36 0 0 1 0.943 21.77 138 1 1.06 0.94; 1000077 2 61 28 0 0 1 1.006 26.72 138 1 1.06 0.94; 1000078 1 71 26 0 0 1 1.003 26.42 138 1 1.06 0.94; 1000079 1 39 32 0 20 1 1.009 26.72 138 1 1.06 0.94; 1000080 2 130 26 0 0 1 1.04 28.96 138 1 1.06 0.94; 1000081 1 0 0 0 0 1 0.997 28.1 345 1 1.06 0.94; 1000082 1 54 27 0 20 1 0.989 27.24 138 1 1.06 0.94; 1000083 1 20 10 0 10 1 0.985 28.42 138 1 1.06 0.94; 1000084 1 11 7 0 0 1 0.98 30.95 138 1 1.06 0.94; 1000085 2 24 15 0 0 1 0.985 32.51 138 1 1.06 0.94; 1000086 1 21 10 0 0 1 0.987 31.14 138 1 1.06 0.94; 1000087 2 0 0 0 0 1 1.015 31.4 161 1 1.06 0.94; 1000088 1 48 10 0 0 1 0.987 35.64 138 1 1.06 0.94; 1000089 2 0 0 0 0 1 1.005 39.69 138 1 1.06 0.94; 1000090 2 163 42 0 0 1 0.985 33.29 138 1 1.06 0.94; 1000091 2 10 0 0 0 1 0.98 33.31 138 1 1.06 0.94; 1000092 2 65 10 0 0 1 0.993 33.8 138 1 1.06 0.94; 1000093 1 12 7 0 0 1 0.987 30.79 138 1 1.06 0.94; 1000094 1 30 16 0 0 1 0.991 28.64 138 1 1.06 0.94; 1000095 1 42 31 0 0 1 0.981 27.67 138 1 1.06 0.94; 1000096 1 38 15 0 0 1 0.993 27.51 138 1 1.06 0.94; 1000097 1 15 9 0 0 1 1.011 27.88 138 1 1.06 0.94; 1000098 1 34 8 0 0 1 1.024 27.4 138 1 1.06 0.94; 1000099 2 42 0 0 0 1 1.01 27.04 138 1 1.06 0.94; 1000100 2 37 18 0 0 1 1.017 28.03 138 1 1.06 0.94; 1000101 1 22 15 0 0 1 0.993 29.61 138 1 1.06 0.94; 1000102 1 5 3 0 0 1 0.991 32.3 138 1 1.06 0.94; 1000103 2 23 16 0 0 1 1.001 24.44 138 1 1.06 0.94; 1000104 2 38 25 0 0 1 0.971 21.69 138 1 1.06 0.94; 1000105 2 31 26 0 20 1 0.965 20.57 138 1 1.06 0.94; 1000106 1 43 16 0 0 1 0.962 20.32 138 1 1.06 0.94; 1000107 2 50 12 0 6 1 0.952 17.53 138 1 1.06 0.94; 1000108 1 2 1 0 0 1 0.967 19.38 138 1 1.06 0.94; 1000109 1 8 3 0 0 1 0.967 18.93 138 1 1.06 0.94; 1000110 2 39 30 0 6 1 0.973 18.09 138 1 1.06 0.94; 1000111 2 0 0 0 0 1 0.98 19.74 138 1 1.06 0.94; 1000112 2 68 13 0 0 1 0.975 14.99 138 1 1.06 0.94; 1000113 2 6 0 0 0 1 0.993 13.74 138 1 1.06 0.94; 1000114 1 8 3 0 0 1 0.96 14.46 138 1 1.06 0.94; 1000115 1 22 7 0 0 1 0.96 14.46 138 1 1.06 0.94; 1000116 2 184 0 0 0 1 1.005 27.12 138 1 1.06 0.94; 1000117 1 20 8 0 0 1 0.974 10.67 138 1 1.06 0.94; 1000118 1 33 15 0 0 1 0.949 21.92 138 1 1.06 0.94; ];

%% generator data % bus Pg Qg Qmax Qmin Vg mBase status Pmax Pmin Pc1 Pc2 Qc1min Qc1max Qc2min Qc2max ramp_agc ramp_10 ramp_30 ramp_q apf mpc.gen = [ 1000001 0 0 15 -5 0.955 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000004 0 0 300 -300 0.998 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000006 0 0 50 -13 0.99 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000008 0 0 300 -300 1.015 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000010 450 0 200 -147 1.05 100 1 550 0 0 0 0 0 0 0 0 0 0 0 0; 1000012 85 0 120 -35 0.99 100 1 185 0 0 0 0 0 0 0 0 0 0 0 0; 1000015 0 0 30 -10 0.97 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000018 0 0 50 -16 0.973 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000019 0 0 24 -8 0.962 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000024 0 0 300 -300 0.992 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000025 220 0 140 -47 1.05 100 1 320 0 0 0 0 0 0 0 0 0 0 0 0; 1000026 314 0 1000 -1000 1.015 100 1 414 0 0 0 0 0 0 0 0 0 0 0 0; 1000027 0 0 300 -300 0.968 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000031 7 0 300 -300 0.967 100 1 107 0 0 0 0 0 0 0 0 0 0 0 0; 1000032 0 0 42 -14 0.963 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000034 0 0 24 -8 0.984 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000036 0 0 24 -8 0.98 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000040 0 0 300 -300 0.97 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000042 0 0 300 -300 0.985 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000046 19 0 100 -100 1.005 100 1 119 0 0 0 0 0 0 0 0 0 0 0 0; 1000049 204 0 210 -85 1.025 100 1 304 0 0 0 0 0 0 0 0 0 0 0 0; 1000054 48 0 300 -300 0.955 100 1 148 0 0 0 0 0 0 0 0 0 0 0 0; 1000055 0 0 23 -8 0.952 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000056 0 0 15 -8 0.954 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000059 155 0 180 -60 0.985 100 1 255 0 0 0 0 0 0 0 0 0 0 0 0; 1000061 160 0 300 -100 0.995 100 1 260 0 0 0 0 0 0 0 0 0 0 0 0; 1000062 0 0 20 -20 0.998 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000065 391 0 200 -67 1.005 100 1 491 0 0 0 0 0 0 0 0 0 0 0 0; 1000066 392 0 200 -67 1.05 100 1 492 0 0 0 0 0 0 0 0 0 0 0 0; 1000069 516.4 0 300 -300 1.035 100 1 805.2 0 0 0 0 0 0 0 0 0 0 0 0; 1000070 0 0 32 -10 0.984 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000072 0 0 100 -100 0.98 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000073 0 0 100 -100 0.991 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000074 0 0 9 -6 0.958 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000076 0 0 23 -8 0.943 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000077 0 0 70 -20 1.006 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000080 477 0 280 -165 1.04 100 1 577 0 0 0 0 0 0 0 0 0 0 0 0; 1000085 0 0 23 -8 0.985 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000087 4 0 1000 -100 1.015 100 1 104 0 0 0 0 0 0 0 0 0 0 0 0; 1000089 607 0 300 -210 1.005 100 1 707 0 0 0 0 0 0 0 0 0 0 0 0; 1000090 0 0 300 -300 0.985 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000091 0 0 100 -100 0.98 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000092 0 0 9 -3 0.99 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000099 0 0 100 -100 1.01 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000100 252 0 155 -50 1.017 100 1 352 0 0 0 0 0 0 0 0 0 0 0 0; 1000103 40 0 40 -15 1.01 100 1 140 0 0 0 0 0 0 0 0 0 0 0 0; 1000104 0 0 23 -8 0.971 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000105 0 0 23 -8 0.965 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000107 0 0 200 -200 0.952 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000110 0 0 23 -8 0.973 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000111 36 0 1000 -100 0.98 100 1 136 0 0 0 0 0 0 0 0 0 0 0 0; 1000112 0 0 1000 -100 0.975 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000113 0 0 200 -100 0.993 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; 1000116 0 0 1000 -1000 1.005 100 1 100 0 0 0 0 0 0 0 0 0 0 0 0; ];

%%----- DC Line Data ----- % fbus tbus status Pf Pt Qf Qt Vf Vt Pmin Pmax QminF QmaxF QminT QmaxT loss0 loss1 mpc.dcline = [ 1000030 1000004 1 10 8.9 0 0 1.01 1 1 10 -10 10 -10 10 1 0.01; 1000007 1000009 1 2 1.96 0 0 1 1 2 10 0 0 0 0 0 0; 1000005 1000008 0 0 0 0 0 1 1 1 10 -10 10 -10 10 0 0; 1000005 1000009 1 10 9.5 0 0 1 0.98 0 10 -10 10 -10 10 0 0.05; ];

%% DC line cost data % 1 startup shutdown n x1 y1 ... xn yn % 2 startup shutdown n c(n-1) ... c0 mpc.dclinecost = [ 2 0 0 2 0 0 0 0 0 0 0 0 0 0; 2 0 0 2 0 0 0 0 0 0 0 0 0 0; 2 0 0 2 0 0 0 0 0 0 0 0 0 0; 2 0 0 2 7.3 0 0 0 0 0 0 0 0 0; ]; %% branch data % fbus tbus r x b rateA rateB rateC ratio angle status angmin angmax mpc.branch = [ 1000001 1000002 0.0303 0.0999 0.0254 0 0 0 0 0 1 -360 360; 1000001 1000003 0.0129 0.0424 0.01082 0 0 0 0 0 1 -360 360; 1000002 1000012 0.0187 0.0616 0.01572 0 0 0 0 0 1 -360 360; 1000003 1000005 0.0241 0.108 0.0284 0 0 0 0 0 1 -360 360; 1000003 1000012 0.0484 0.16 0.0406 0 0 0 0 0 1 -360 360; 1000004 1000005 0.00176 0.00798 0.0021 0 0 0 0 0 1 -360 360; 1000004 1000011 0.0209 0.0688 0.01748 0 0 0 0 0 1 -360 360; 1000005 1000006 0.0119 0.054 0.01426 0 0 0 0 0 1 -360 360; 1000005 1000008 0 0.0267 0 0 0 0 0.985 0 1 -360 360; 1000005 1000011 0.0203 0.0682 0.01738 0 0 0 0 0 1 -360 360; 1000006 1000007 0.00459 0.0208 0.0055 0 0 0 0 0 1 -360 360; 1000007 1000012 0.00862 0.034 0.00874 0 0 0 0 0 1 -360 360; 1000008 1000009 0.00244 0.0305 1.162 0 0 0 0 0 1 -360 360; 1000008 1000030 0.00431 0.0504 0.514 0 0 0 0 0 1 -360 360; 1000009 1000010 0.00258 0.0322 1.23 0 0 0 0 0 1 -360 360; 1000011 1000012 0.00595 0.0196 0.00502 0 0 0 0 0 1 -360 360; 1000011 1000013 0.02225 0.0731 0.01876 0 0 0 0 0 1 -360 360; 1000012 1000014 0.0215 0.0707 0.01816 0 0 0 0 0 1 -360 360; 1000012 1000016 0.0212 0.0834 0.0214 0 0 0 0 0 1 -360 360; 1000012 1000117 0.0329 0.14 0.0358 0 0 0 0 0 1 -360 360; 1000013 1000015 0.0744 0.2444 0.06268 0 0 0 0 0 1 -360 360; 1000014 1000015 0.0595 0.195 0.0502 0 0 0 0 0 1 -360 360; 1000015 1000017 0.0132 0.0437 0.0444 0 0 0 0 0 1 -360 360; 1000015 1000019 0.012 0.0394 0.0101 0 0 0 0 0 1 -360 360; 1000015 1000033 0.038 0.1244 0.03194 0 0 0 0 0 1 -360 360; 1000016 1000017 0.0454 0.1801 0.0466 0 0 0 0 0 1 -360 360; 1000017 1000018 0.0123 0.0505 0.01298 0 0 0 0 0 1 -360 360; 1000017 1000030 0 0.0388 0 0 0 0 0.96 0 1 -360 360; 1000017 1000031 0.0474 0.1563 0.0399 0 0 0 0 0 1 -360 360; 1000017 1000113 0.00913 0.0301 0.00768 0 0 0 0 0 1 -360 360; 1000018 1000019 0.01119 0.0493 0.01142 0 0 0 0 0 1 -360 360; 1000019 1000020 0.0252 0.117 0.0298 0 0 0 0 0 1 -360 360; 1000019 1000034 0.0752 0.247 0.0632 0 0 0 0 0 1 -360 360; 1000020 1000021 0.0183 0.0849 0.0216 0 0 0 0 0 1 -360 360; 1000021 1000022 0.0209 0.097 0.0246 0 0 0 0 0 1 -360 360; 1000022 1000023 0.0342 0.159 0.0404 0 0 0 0 0 1 -360 360; 1000023 1000024 0.0135 0.0492 0.0498 0 0 0 0 0 1 -360 360; 1000023 1000025 0.0156 0.08 0.0864 0 0 0 0 0 1 -360 360; 1000023 1000032 0.0317 0.1153 0.1173 0 0 0 0 0 1 -360 360; 1000024 1000070 0.00221 0.4115 0.10198 0 0 0 0 0 1 -360 360; 1000024 1000072 0.0488 0.196 0.0488 0 0 0 0 0 1 -360 360; 1000025 1000026 0 0.0382 0 0 0 0 0.96 0 1 -360 360; 1000025 1000027 0.0318 0.163 0.1764 0 0 0 0 0 1 -360 360; 1000026 1000030 0.00799 0.086 0.908 0 0 0 0 0 1 -360 360; 1000027 1000028 0.01913 0.0855 0.0216 0 0 0 0 0 1 -360 360; 1000027 1000032 0.0229 0.0755 0.01926 0 0 0 0 0 1 -360 360; 1000027 1000115 0.0164 0.0741 0.01972 0 0 0 0 0 1 -360 360; 1000028 1000029 0.0237 0.0943 0.0238 0 0 0 0 0 1 -360 360; 1000029 1000031 0.0108 0.0331 0.0083 0 0 0 0 0 1 -360 360; 1000030 1000038 0.00464 0.054 0.422 0 0 0 0 0 1 -360 360; 1000031 1000032 0.0298 0.0985 0.0251 0 0 0 0 0 1 -360 360; 1000032 1000113 0.0615 0.203 0.0518 0 0 0 0 0 1 -360 360; 1000032 1000114 0.0135 0.0612 0.01628 0 0 0 0 0 1 -360 360; 1000033 1000037 0.0415 0.142 0.0366 0 0 0 0 0 1 -360 360; 1000034 1000036 0.00871 0.0268 0.00568 0 0 0 0 0 1 -360 360; 1000034 1000037 0.00256 0.0094 0.00984 0 0 0 0 0 1 -360 360; 1000034 1000043 0.0413 0.1681 0.04226 0 0 0 0 0 1 -360 360; 1000035 1000036 0.00224 0.0102 0.00268 0 0 0 0 0 1 -360 360; 1000035 1000037 0.011 0.0497 0.01318 0 0 0 0 0 1 -360 360; 1000037 1000038 0 0.0375 0 0 0 0 0.935 0 1 -360 360; 1000037 1000039 0.0321 0.106 0.027 0 0 0 0 0 1 -360 360; 1000037 1000040 0.0593 0.168 0.042 0 0 0 0 0 1 -360 360; 1000038 1000065 0.00901 0.0986 1.046 0 0 0 0 0 1 -360 360; 1000039 1000040 0.0184 0.0605 0.01552 0 0 0 0 0 1 -360 360; 1000040 1000041 0.0145 0.0487 0.01222 0 0 0 0 0 1 -360 360; 1000040 1000042 0.0555 0.183 0.0466 0 0 0 0 0 1 -360 360; 1000041 1000042 0.041 0.135 0.0344 0 0 0 0 0 1 -360 360; 1000042 1000049 0.0715 0.323 0.086 0 0 0 0 0 1 -360 360; 1000042 1000049 0.0715 0.323 0.086 0 0 0 0 0 1 -360 360; 1000043 1000044 0.0608 0.2454 0.06068 0 0 0 0 0 1 -360 360; 1000044 1000045 0.0224 0.0901 0.0224 0 0 0 0 0 1 -360 360; 1000045 1000046 0.04 0.1356 0.0332 0 0 0 0 0 1 -360 360; 1000045 1000049 0.0684 0.186 0.0444 0 0 0 0 0 1 -360 360; 1000046 1000047 0.038 0.127 0.0316 0 0 0 0 0 1 -360 360; 1000046 1000048 0.0601 0.189 0.0472 0 0 0 0 0 1 -360 360; 1000047 1000049 0.0191 0.0625 0.01604 0 0 0 0 0 1 -360 360; 1000047 1000069 0.0844 0.2778 0.07092 0 0 0 0 0 1 -360 360; 1000048 1000049 0.0179 0.0505 0.01258 0 0 0 0 0 1 -360 360; 1000049 1000050 0.0267 0.0752 0.01874 0 0 0 0 0 1 -360 360; 1000049 1000051 0.0486 0.137 0.0342 0 0 0 0 0 1 -360 360; 1000049 1000054 0.073 0.289 0.0738 0 0 0 0 0 1 -360 360; 1000049 1000054 0.0869 0.291 0.073 0 0 0 0 0 1 -360 360; 1000049 1000066 0.018 0.0919 0.0248 0 0 0 0 0 1 -360 360; 1000049 1000066 0.018 0.0919 0.0248 0 0 0 0 0 1 -360 360; 1000049 1000069 0.0985 0.324 0.0828 0 0 0 0 0 1 -360 360; 1000050 1000057 0.0474 0.134 0.0332 0 0 0 0 0 1 -360 360; 1000051 1000052 0.0203 0.0588 0.01396 0 0 0 0 0 1 -360 360; 1000051 1000058 0.0255 0.0719 0.01788 0 0 0 0 0 1 -360 360; 1000052 1000053 0.0405 0.1635 0.04058 0 0 0 0 0 1 -360 360; 1000053 1000054 0.0263 0.122 0.031 0 0 0 0 0 1 -360 360; 1000054 1000055 0.0169 0.0707 0.0202 0 0 0 0 0 1 -360 360; 1000054 1000056 0.00275 0.00955 0.00732 0 0 0 0 0 1 -360 360; 1000054 1000059 0.0503 0.2293 0.0598 0 0 0 0 0 1 -360 360; 1000055 1000056 0.00488 0.0151 0.00374 0 0 0 0 0 1 -360 360; 1000055 1000059 0.04739 0.2158 0.05646 0 0 0 0 0 1 -360 360; 1000056 1000057 0.0343 0.0966 0.0242 0 0 0 0 0 1 -360 360; 1000056 1000058 0.0343 0.0966 0.0242 0 0 0 0 0 1 -360 360; 1000056 1000059 0.0825 0.251 0.0569 0 0 0 0 0 1 -360 360; 1000056 1000059 0.0803 0.239 0.0536 0 0 0 0 0 1 -360 360; 1000059 1000060 0.0317 0.145 0.0376 0 0 0 0 0 1 -360 360; 1000059 1000061 0.0328 0.15 0.0388 0 0 0 0 0 1 -360 360; 1000059 1000063 0 0.0386 0 0 0 0 0.96 0 1 -360 360; 1000060 1000061 0.00264 0.0135 0.01456 0 0 0 0 0 1 -360 360; 1000060 1000062 0.0123 0.0561 0.01468 0 0 0 0 0 1 -360 360; 1000061 1000062 0.00824 0.0376 0.0098 0 0 0 0 0 1 -360 360; 1000061 1000064 0 0.0268 0 0 0 0 0.985 0 1 -360 360; 1000062 1000066 0.0482 0.218 0.0578 0 0 0 0 0 1 -360 360; 1000062 1000067 0.0258 0.117 0.031 0 0 0 0 0 1 -360 360; 1000063 1000064 0.00172 0.02 0.216 0 0 0 0 0 1 -360 360; 1000064 1000065 0.00269 0.0302 0.38 0 0 0 0 0 1 -360 360; 1000065 1000066 0 0.037 0 0 0 0 0.935 0 1 -360 360; 1000065 1000068 0.00138 0.016 0.638 0 0 0 0 0 1 -360 360; 1000066 1000067 0.0224 0.1015 0.02682 0 0 0 0 0 1 -360 360; 1000068 1000069 0 0.037 0 0 0 0 0.935 0 1 -360 360; 1000068 1000081 0.00175 0.0202 0.808 0 0 0 0 0 1 -360 360; 1000068 1000116 0.00034 0.00405 0.164 0 0 0 1 0 1 -360 360; 1000069 1000070 0.03 0.127 0.122 0 0 0 0 0 1 -360 360; 1000069 1000075 0.0405 0.122 0.124 0 0 0 0 0 1 -360 360; 1000069 1000077 0.0309 0.101 0.1038 0 0 0 0 0 1 -360 360; 1000070 1000071 0.00882 0.0355 0.00878 0 0 0 0 0 1 -360 360; 1000070 1000074 0.0401 0.1323 0.03368 0 0 0 0 0 1 -360 360; 1000070 1000075 0.0428 0.141 0.036 0 0 0 0 0 1 -360 360; 1000071 1000072 0.0446 0.18 0.04444 0 0 0 0 0 1 -360 360; 1000071 1000073 0.00866 0.0454 0.01178 0 0 0 0 0 1 -360 360; 1000074 1000075 0.0123 0.0406 0.01034 0 0 0 0 0 1 -360 360; 1000075 1000077 0.0601 0.1999 0.04978 0 0 0 0 0 1 -360 360; 1000075 1000118 0.0145 0.0481 0.01198 0 0 0 0 0 1 -360 360; 1000076 1000077 0.0444 0.148 0.0368 0 0 0 0 0 1 -360 360; 1000076 1000118 0.0164 0.0544 0.01356 0 0 0 0 0 1 -360 360; 1000077 1000078 0.00376 0.0124 0.01264 0 0 0 0 0 1 -360 360; 1000077 1000080 0.017 0.0485 0.0472 0 0 0 0 0 1 -360 360; 1000077 1000080 0.0294 0.105 0.0228 0 0 0 0 0 1 -360 360; 1000077 1000082 0.0298 0.0853 0.08174 0 0 0 0 0 1 -360 360; 1000078 1000079 0.00546 0.0244 0.00648 0 0 0 0 0 1 -360 360; 1000079 1000080 0.0156 0.0704 0.0187 0 0 0 0 0 1 -360 360; 1000080 1000081 0 0.037 0 0 0 0 0.935 0 1 -360 360; 1000080 1000096 0.0356 0.182 0.0494 0 0 0 0 0 1 -360 360; 1000080 1000097 0.0183 0.0934 0.0254 0 0 0 0 0 1 -360 360; 1000080 1000098 0.0238 0.108 0.0286 0 0 0 0 0 1 -360 360; 1000080 1000099 0.0454 0.206 0.0546 0 0 0 0 0 1 -360 360; 1000082 1000083 0.0112 0.03665 0.03796 0 0 0 0 0 1 -360 360; 1000082 1000096 0.0162 0.053 0.0544 0 0 0 0 0 1 -360 360; 1000083 1000084 0.0625 0.132 0.0258 0 0 0 0 0 1 -360 360; 1000083 1000085 0.043 0.148 0.0348 0 0 0 0 0 1 -360 360; 1000084 1000085 0.0302 0.0641 0.01234 0 0 0 0 0 1 -360 360; 1000085 1000086 0.035 0.123 0.0276 0 0 0 0 0 1 -360 360; 1000085 1000088 0.02 0.102 0.0276 0 0 0 0 0 1 -360 360; 1000085 1000089 0.0239 0.173 0.047 0 0 0 0 0 1 -360 360; 1000086 1000087 0.02828 0.2074 0.0445 0 0 0 1 0 1 -360 360; 1000088 1000089 0.0139 0.0712 0.01934 0 0 0 0 0 1 -360 360; 1000089 1000090 0.0518 0.188 0.0528 0 0 0 0 0 1 -360 360; 1000089 1000090 0.0238 0.0997 0.106 0 0 0 0 0 1 -360 360; 1000089 1000092 0.0099 0.0505 0.0548 0 0 0 0 0 1 -360 360; 1000089 1000092 0.0393 0.1581 0.0414 0 0 0 0 0 1 -360 360; 1000090 1000091 0.0254 0.0836 0.0214 0 0 0 0 0 1 -360 360; 1000091 1000092 0.0387 0.1272 0.03268 0 0 0 0 0 1 -360 360; 1000092 1000093 0.0258 0.0848 0.0218 0 0 0 0 0 1 -360 360; 1000092 1000094 0.0481 0.158 0.0406 0 0 0 0 0 1 -360 360; 1000092 1000100 0.0648 0.295 0.0472 0 0 0 0 0 1 -360 360; 1000092 1000102 0.0123 0.0559 0.01464 0 0 0 0 0 1 -360 360; 1000093 1000094 0.0223 0.0732 0.01876 0 0 0 0 0 1 -360 360; 1000094 1000095 0.0132 0.0434 0.0111 0 0 0 0 0 1 -360 360; 1000094 1000096 0.0269 0.0869 0.023 0 0 0 0 0 1 -360 360; 1000094 1000100 0.0178 0.058 0.0604 0 0 0 0 0 1 -360 360; 1000095 1000096 0.0171 0.0547 0.01474 0 0 0 0 0 1 -360 360; 1000096 1000097 0.0173 0.0885 0.024 0 0 0 0 0 1 -360 360; 1000098 1000100 0.0397 0.179 0.0476 0 0 0 0 0 1 -360 360; 1000099 1000100 0.018 0.0813 0.0216 0 0 0 0 0 1 -360 360; 1000100 1000101 0.0277 0.1262 0.0328 0 0 0 0 0 1 -360 360; 1000100 1000103 0.016 0.0525 0.0536 0 0 0 0 0 1 -360 360; 1000100 1000104 0.0451 0.204 0.0541 0 0 0 0 0 1 -360 360; 1000100 1000106 0.0605 0.229 0.062 0 0 0 0 0 1 -360 360; 1000101 1000102 0.0246 0.112 0.0294 0 0 0 0 0 1 -360 360; 1000103 1000104 0.0466 0.1584 0.0407 0 0 0 0 0 1 -360 360; 1000103 1000105 0.0535 0.1625 0.0408 0 0 0 0 0 1 -360 360; 1000103 1000110 0.03906 0.1813 0.0461 0 0 0 0 0 1 -360 360; 1000104 1000105 0.00994 0.0378 0.00986 0 0 0 0 0 1 -360 360; 1000105 1000106 0.014 0.0547 0.01434 0 0 0 0 0 1 -360 360; 1000105 1000107 0.053 0.183 0.0472 0 0 0 0 0 1 -360 360; 1000105 1000108 0.0261 0.0703 0.01844 0 0 0 0 0 1 -360 360; 1000106 1000107 0.053 0.183 0.0472 0 0 0 0 0 1 -360 360; 1000108 1000109 0.0105 0.0288 0.0076 0 0 0 0 0 1 -360 360; 1000109 1000110 0.0278 0.0762 0.0202 0 0 0 0 0 1 -360 360; 1000110 1000111 0.022 0.0755 0.02 0 0 0 0 0 1 -360 360; 1000110 1000112 0.0247 0.064 0.062 0 0 0 0 0 1 -360 360; 1000114 1000115 0.0023 0.0104 0.00276 0 0 0 0 0 1 -360 360; ];

%%----- OPF Data -----%% %% generator cost data % 1 startup shutdown n x1 y1 ... xn yn % 2 startup shutdown n c(n-1) ... c0 mpc.gencost = [ 2 0 0 3 0.01 40 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.0222222222 20 0; 2 0 0 3 0.117647059 20 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.0454545455 20 0; 2 0 0 3 0.0318471338 20 0; 2 0 0 3 0.01 40 0; 2 0 0 3 1.42857143 20 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.526315789 20 0; 2 0 0 3 0.0490196078 20 0; 2 0 0 3 0.208333333 20 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.064516129 20 0; 2 0 0 3 0.0625 20 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.0255754476 20 0; 2 0 0 3 0.0255102041 20 0; 2 0 0 3 0.0193648335 20 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.0209643606 20 0; 2 0 0 3 0.01 40 0; 2 0 0 3 2.5 20 0; 2 0 0 3 0.0164744646 20 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.0396825397 20 0; 2 0 0 3 0.25 20 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.277777778 20 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.01 40 0; 2 0 0 3 0.01 40 0; ];

%% bus names mpc.bus_name = { 'Riversde V2'; 'Pokagon V2'; 'HickryCk V2'; 'NwCarlsl V2'; 'Olive V2'; 'Kankakee V2'; 'JacksnRd V2'; 'Olive V1'; 'Bequine V1'; 'Breed V1'; 'SouthBnd V2'; 'TwinBrch V2'; 'Concord V2'; 'GoshenJt V2'; 'FtWayne V2'; 'N. E. V2'; 'Sorenson V2'; 'McKinley V2'; 'Lincoln V2'; 'Adams V2'; 'Jay V2'; 'Randolph V2'; 'CollCrnr V2'; 'Trenton V2'; 'TannrsCk V2'; 'TannrsCk V1'; 'Madison V2'; 'Mullin V2'; 'Grant V2'; 'Sorenson V1'; 'DeerCrk V2'; 'Delaware V2'; 'Haviland V2'; 'Rockhill V2'; 'WestLima V2'; 'Sterling V2'; 'EastLima V2'; 'EastLima V1'; 'NwLibrty V2'; 'West End V2'; 'S.Tiffin V2'; 'Howard V2'; 'S.Kenton V2'; 'WMVernon V2'; 'N.Newark V2'; 'W.Lancst V2'; 'Crooksvl V2'; 'Zanesvll V2'; 'Philo V2'; 'WCambrdg V2'; 'Newcmrst V2'; 'SCoshoct V2'; 'Wooster V2'; 'Torrey V2'; 'Wagenhls V2'; 'Sunnysde V2'; 'WNwPhil1 V2'; 'WNwPhil2 V2'; 'Tidd V2'; 'SWKammer V2'; 'W.Kammer V2'; 'Natrium V2'; 'Tidd V1'; 'Kammer V1'; 'Muskngum V1'; 'Muskngum V2'; 'Summerfl V2'; 'Sporn V1'; 'Sporn V2'; 'Portsmth V2'; 'NPortsmt V2'; 'Hillsbro V2'; 'Sargents V2'; 'Bellefnt V2'; 'SthPoint V2'; 'Darrah V2'; 'Turner V2'; 'Chemical V2'; 'CapitlHl V2'; 'CabinCrk V2'; 'Kanawha V1'; 'Logan V2'; 'Sprigg V2'; 'BetsyLne V2'; 'BeaverCk V2'; 'Hazard V2'; 'Pinevlle V3'; 'Fremont V2'; 'ClinchRv V2'; 'Holston V2'; 'HolstonT V2'; 'Saltvlle V2'; 'Tazewell V2'; 'Switchbk V2'; 'Caldwell V2'; 'Baileysv V2'; 'Sundial V2'; 'Bradley V2'; 'Hinton V2'; 'Glen Lyn V2'; 'Wythe V2'; 'Smythe V2'; 'Claytor V2'; 'Hancock V2'; 'Roanoke V2'; 'Cloverdl V2'; 'Reusens V2'; 'Blaine V2'; 'Franklin V2'; 'Fieldale V2'; 'DanRiver V2'; 'Danville V2'; 'Deer Crk V2'; 'WMedford V2'; 'Medford V2'; 'KygerCrk V2'; 'Corey V2'; 'WHuntngd V2'; };

rdzman commented 10 months ago

The first error you encountered is unrelated to DC lines. See #209 (or #201) for the solution.

In general, there should be no issue with solving the DC OPF for a system with DC lines. However, while the t_case9_dcline case solves fine for the AC OPF, it appears it is infeasible for the DC OPF.

Did you remember to toggle the DC line extension on using toggle_dcline()? For me, your case above solves fine for both AC and DC OPF.

mpc = loadcase('prepared_case'); 
mpc = toggle_dcline(mpc, 'on');
results_dc = rundcopf(mpc);
results_ac = runopf(mpc);
yanda1234 commented 10 months ago

Hi Dr.Zimmerman,

Happy new year! Thanks for your prompt reply. May I ask two questions?

  1. After achieving convergence in the DCOPF, I observed an anomaly in the results. Please focus on bus 4. In the original IEEE 118 case, there are two branches connecting to this bus, which is associated with a load of 39 MW. However, upon introducing a DC line from bus 30 to bus 4, the branch flows remained unchanged, leading to confusion. Do you know why?

    image
  2. In #201, you mentioned using the two attached files to replace existing files in matlab installation. Do you mean the matlab main folder, such as MATLAB_R2023b or some subfolder such as MATLAB_R2023b/bin?

Kindly let me know your thoughts! Many thanks!

Best, Yanda

rdzman commented 10 months ago
  1. What is the reported flow on the DC line connected to bus 4? Depending on the flow limits and the relative prices, costs, etc., the optimal solution may be to dispatch the line at zero flow.
  2. It should say under your MATPOWER installation, not MATLAB installation. I have corrected that comment. Sorry for the confusion.
yanda1234 commented 10 months ago

Thanks, Dr.Zimmerman.

I just reinstall matpower and use the github folder to replace original one. The DCOPF result is as below.

image image

The sum of flow at bus 4 is zero this time, but I suppose Pf column specifies DC flow amount, how could DC branch flow change?

image

Best, Yanda

rdzman commented 10 months ago

If you are running an OPF, the flow in the DC line is dispatchable. For the DC line from 30 to 4, the flow in the input appears to be 10 MW (= Pmax), but in the solved case, it is 1 MW (=Pmin).

yanda1234 commented 10 months ago

Thanks, Dr. Zimmerman. Is there anyway to fix DC flow in DCOPF? For example, MISO wants to evaluate DCOPF within its territory while keeping some DC lines' power exchange with its neighbors, such as PJM and SPP etc.

rdzman commented 10 months ago

Certainly.

The DC OPF finds the optimal dispatch for the line between the lower and upper limits (Pmin and Pmax), so if you want a fixed value, simply set Pmin = Pmax = desired value.

yanda1234 commented 10 months ago

Thanks, Dr. Zimmerman!