That's very interesting. I run the case14 as below and get convergence in 1 iteration. However, the convergence aside, I still get different results when I run a PF calculation of my model using the results of a previous OPF calculation - these results are different by 100's of MVAR's. To me this implies that the solution given by the opf is not attainable using pf, ie that it is incorrect, or that the opf voltage results are not matched to the opf power flow results. Could this also be a bug?
Regards, Dominic mpc=loadcase('case14.m'); resultsOPF=runopf(mpc); resultsPF=runpf(resultsOPF); MATPOWER Version 5.0, 17-Dec-2014 -- AC Optimal Power Flow PDIPMOPF Version 4.1, Build 18, 11-Nov-2011 Copyright (c) 2007-2011 by Power System Engineering Research Center (PSERC) Converged in 0.03 seconds Objective Function Value = 8081.53 $/hr ================================================================================ | System Summary | ================================================================================ How many? How much? P (MW) Q (MVAr) --------------------- ------------------- ------------- ----------------- Buses 14 Total Gen Capacity 772.4 -52.0 to 148.0 Generators 5 On-line Capacity 772.4 -52.0 to 148.0 Committed Gens 5 Generation (actual) 268.3 67.6 Loads 11 Load 259.0 73.5 Fixed 11 Fixed 259.0 73.5 Dispatchable 0 Dispatchable -0.0 of -0.0 -0.0 Shunts 1 Shunt (inj) -0.0 20.7 Branches 20 Losses (I^2 * Z) 9.29 39.16 Transformers 3 Branch Charging (inj) - 24.3 Inter-ties 0 Total Inter-tie Flow 0.0 0.0 Areas 1 Minimum Maximum ------------------------- -------------------------------- Voltage Magnitude 1.014 p.u. @ bus 4 1.060 p.u. @ bus 1 Voltage Angle -14.27 deg @ bus 14 0.00 deg @ bus 1 P Losses (I^2*R) - 2.90 MW @ line 1-2 Q Losses (I^2*X) - 8.86 MVAr @ line 1-2 Lambda P 36.72 $/MWh @ bus 1 41.20 $/MWh @ bus 14 Lambda Q -0.09 $/MWh @ bus 1 0.57 $/MWh @ bus 14 ================================================================================ | Bus Data | ================================================================================ Bus Voltage Generation Load Lambda($/MVA-hr) # Mag(pu) Ang(deg) P (MW) Q (MVAr) P (MW) Q (MVAr) P Q ----- ------- -------- -------- -------- -------- -------- ------- ------- 1 1.060 0.000* 194.33 0.00 - - 36.724 -0.094 2 1.041 -4.022 36.72 23.69 21.70 12.70 38.360 - 3 1.016 -9.926 28.74 24.13 94.20 19.00 40.575 - 4 1.014 -8.665 - - 47.80 -3.90 40.190 0.120 5 1.016 -7.428 - - 7.60 1.60 39.661 0.208 6 1.060 -12.689 0.00 11.55 11.20 7.50 39.734 - 7 1.046 -11.188 - - - - 40.172 0.120 8 1.060 -10.415 8.49 8.27 - - 40.170 - 9 1.044 -12.997 - - 29.50 16.60 40.166 0.196 10 1.039 -13.233 - - 9.00 5.80 40.318 0.309 11 1.046 -13.091 - - 3.50 1.80 40.155 0.228 12 1.045 -13.533 - - 6.10 1.60 40.379 0.212 13 1.040 -13.583 - - 13.50 5.80 40.575 0.353 14 1.024 -14.274 - - 14.90 5.00 41.197 0.571 -------- -------- -------- -------- Total: 268.29 67.63 259.00 73.50 ================================================================================ | Branch Data | ================================================================================ Brnch From To From Bus Injection To Bus Injection Loss (I^2 * Z) # Bus Bus P (MW) Q (MVAr) P (MW) Q (MVAr) P (MW) Q (MVAr) ----- ----- ----- -------- -------- -------- -------- -------- -------- 1 1 2 129.67 -6.36 -126.77 9.40 2.902 8.86 2 1 5 64.66 6.37 -62.61 -3.21 2.051 8.47 3 2 3 55.59 0.47 -54.25 0.56 1.344 5.66 4 2 4 48.92 -0.48 -47.63 0.79 1.285 3.90 5 2 5 37.28 1.59 -36.54 -3.00 0.737 2.25 6 3 4 -11.21 4.57 11.31 -5.63 0.099 0.25 7 4 5 -49.17 11.58 49.50 -10.53 0.331 1.04 8 4 7 22.85 -3.99 -22.85 5.04 0.000 1.05 9 4 9 14.84 1.17 -14.84 -0.04 0.000 1.12 10 5 6 42.06 15.14 -42.06 -10.90 0.000 4.23 11 6 11 6.09 4.56 -6.04 -4.46 0.049 0.10 12 6 12 7.65 2.66 -7.58 -2.51 0.072 0.15 13 6 13 17.12 7.73 -16.91 -7.32 0.208 0.41 14 7 8 -8.49 -8.05 8.49 8.27 0.000 0.22 15 7 9 31.34 3.01 -31.34 -2.02 0.000 1.00 16 9 10 6.49 3.20 -6.47 -3.16 0.015 0.04 17 9 14 10.20 2.95 -10.06 -2.67 0.131 0.28 18 10 11 -2.53 -2.64 2.54 2.66 0.010 0.02 19 12 13 1.48 0.91 -1.47 -0.91 0.006 0.01 20 13 14 4.88 2.42 -4.84 -2.33 0.047 0.10 -------- -------- Total: 9.287 39.16 ================================================================================ | Voltage Constraints | ================================================================================ Bus # Vmin mu Vmin |V| Vmax Vmax mu ----- -------- ----- ----- ----- -------- 1 - 0.940 1.060 1.060 583.780 6 - 0.940 1.060 1.060 55.184 8 - 0.940 1.060 1.060 71.069 ================================================================================ | Generation Constraints | ================================================================================ Gen Bus Active Power Limits # # Pmin mu Pmin Pg Pmax Pmax mu ---- ----- ------- -------- -------- -------- ------- 4 6 0.266 0.00 0.00 100.00 - Gen Bus Reactive Power Limits # # Qmin mu Qmin Qg Qmax Qmax mu --- --- ------- -------- -------- -------- ------- 1 1 0.094 0.00 0.00 10.00 - MATPOWER Version 5.0, 17-Dec-2014 -- AC Power Flow (Newton) Newton's method power flow converged in 1 iterations. Converged in 0.00 seconds Objective Function Value = 8081.53 $/hr ================================================================================ | System Summary | ================================================================================ How many? How much? P (MW) Q (MVAr) --------------------- ------------------- ------------- ----------------- Buses 14 Total Gen Capacity 772.4 -52.0 to 148.0 Generators 5 On-line Capacity 772.4 -52.0 to 148.0 Committed Gens 5 Generation (actual) 268.3 67.6 Loads 11 Load 259.0 73.5 Fixed 11 Fixed 259.0 73.5 Dispatchable 0 Dispatchable -0.0 of -0.0 -0.0 Shunts 1 Shunt (inj) -0.0 20.7 Branches 20 Losses (I^2 * Z) 9.29 39.16 Transformers 3 Branch Charging (inj) - 24.3 Inter-ties 0 Total Inter-tie Flow 0.0 0.0 Areas 1 Minimum Maximum ------------------------- -------------------------------- Voltage Magnitude 1.014 p.u. @ bus 4 1.060 p.u. @ bus 1 Voltage Angle -14.27 deg @ bus 14 0.00 deg @ bus 1 P Losses (I^2*R) - 2.90 MW @ line 1-2 Q Losses (I^2*X) - 8.86 MVAr @ line 1-2 Lambda P 36.72 $/MWh @ bus 1 41.20 $/MWh @ bus 14 Lambda Q -0.09 $/MWh @ bus 1 0.57 $/MWh @ bus 14 ================================================================================ | Bus Data | ================================================================================ Bus Voltage Generation Load Lambda($/MVA-hr) # Mag(pu) Ang(deg) P (MW) Q (MVAr) P (MW) Q (MVAr) P Q ----- ------- -------- -------- -------- -------- -------- ------- ------- 1 1.060 0.000* 194.33 0.00 - - 36.724 -0.094 2 1.041 -4.022 36.72 23.69 21.70 12.70 38.360 - 3 1.016 -9.926 28.74 24.13 94.20 19.00 40.575 - 4 1.014 -8.665 - - 47.80 -3.90 40.190 0.120 5 1.016 -7.428 - - 7.60 1.60 39.661 0.208 6 1.060 -12.689 0.00 11.55 11.20 7.50 39.734 - 7 1.046 -11.188 - - - - 40.172 0.120 8 1.060 -10.415 8.49 8.27 - - 40.170 - 9 1.044 -12.997 - - 29.50 16.60 40.166 0.196 10 1.039 -13.233 - - 9.00 5.80 40.318 0.309 11 1.046 -13.091 - - 3.50 1.80 40.155 0.228 12 1.045 -13.533 - - 6.10 1.60 40.379 0.212 13 1.040 -13.583 - - 13.50 5.80 40.575 0.353 14 1.024 -14.274 - - 14.90 5.00 41.197 0.571 -------- -------- -------- -------- Total: 268.29 67.63 259.00 73.50 ================================================================================ | Branch Data | ================================================================================ Brnch From To From Bus Injection To Bus Injection Loss (I^2 * Z) # Bus Bus P (MW) Q (MVAr) P (MW) Q (MVAr) P (MW) Q (MVAr) ----- ----- ----- -------- -------- -------- -------- -------- -------- 1 1 2 129.67 -6.36 -126.77 9.40 2.902 8.86 2 1 5 64.66 6.37 -62.61 -3.21 2.051 8.47 3 2 3 55.59 0.47 -54.25 0.56 1.344 5.66 4 2 4 48.92 -0.48 -47.63 0.79 1.285 3.90 5 2 5 37.28 1.59 -36.54 -3.00 0.737 2.25 6 3 4 -11.21 4.57 11.31 -5.63 0.099 0.25 7 4 5 -49.17 11.58 49.50 -10.53 0.331 1.04 8 4 7 22.85 -3.99 -22.85 5.04 0.000 1.05 9 4 9 14.84 1.17 -14.84 -0.04 0.000 1.12 10 5 6 42.06 15.14 -42.06 -10.90 0.000 4.23 11 6 11 6.09 4.56 -6.04 -4.46 0.049 0.10 12 6 12 7.65 2.66 -7.58 -2.51 0.072 0.15 13 6 13 17.12 7.73 -16.91 -7.32 0.208 0.41 14 7 8 -8.49 -8.05 8.49 8.27 0.000 0.22 15 7 9 31.34 3.01 -31.34 -2.02 0.000 1.00 16 9 10 6.49 3.20 -6.47 -3.16 0.015 0.04 17 9 14 10.20 2.95 -10.06 -2.67 0.131 0.28 18 10 11 -2.53 -2.64 2.54 2.66 0.010 0.02 19 12 13 1.48 0.91 -1.47 -0.91 0.006 0.01 20 13 14 4.88 2.42 -4.84 -2.33 0.047 0.10 -------- -------- Total: 9.287 39.16 ================================================================================ | Voltage Constraints | ================================================================================ Bus # Vmin mu Vmin |V| Vmax Vmax mu ----- -------- ----- ----- ----- -------- 1 - 0.940 1.060 1.060 583.780 6 - 0.940 1.060 1.060 55.184 8 - 0.940 1.060 1.060 71.069 ================================================================================ | Generation Constraints | ================================================================================ Gen Bus Active Power Limits # # Pmin mu Pmin Pg Pmax Pmax mu ---- ----- ------- -------- -------- -------- ------- 4 6 0.266 0.00 0.00 100.00 - Gen Bus Reactive Power Limits # # Qmin mu Qmin Qg Qmax Qmax mu --- --- ------- -------- -------- -------- ------- 1 1 0.094 0.00 0.00 10.00 - >> compare_case(resultsOPF, resultsPF) ---------------- -------------- -------------- -------------- ----- matrix / col case 1 case 2 difference row ---------------- -------------- -------------- -------------- ----- bus VM 1.03914 1.03914 7.68601e-11 10 VA -14.2741 -14.2741 2.45214e-07 14 * gen PG 194.33 194.33 5.37223e-08 1 QG 11.5455 11.5455 1.64362e-07 4 * branch PF 42.0553 42.0553 9.84285e-08 10 * QF -8.05255 -8.05255 3.0924e-08 14 PT -42.0553 -42.0553 9.84285e-08 10 QT 8.27299 8.27299 2.97751e-08 14 >> Von: bounce-118752219-69321...@list.cornell.edu [mailto:bounce-118752219-69321...@list.cornell.edu] Im Auftrag von Abhyankar, Shrirang G. Gesendet: Mittwoch, 28. Januar 2015 20:55 An: MATPOWER discussion forum Betreff: Re: AW: Solved case does not converge in zero iterations I think the runopf routine should update generator set point voltages in the mpc struct once a solution is found. It is clearly a bug if that's not the case. I did a quick check on case14 and found that the power flow converges in 0 iterations given an initial guess from the OPF solution. With case118, the power flow takes 1 iteration. Note that power flow uses a default convergence tolerance of 1e-8. For case14, the mismatch norm at iteration 0 is ~ 1-e10, while for case118 it is ~ 1e-7. Hence, the power flow converges in 0 iterations for case14 and in 1 iteration for case118. Regardless, you should expect almost same solutions (accuracy ~ tolerance settings) for OPF and PF. Shri From: Carlos E Murillo-Sanchez <ce.murillosanc...@gmail.com<mailto:ce.murillosanc...@gmail.com>> Reply-To: MATPOWER discussion forum <matpowe...@list.cornell.edu<mailto:matpowe...@list.cornell.edu>> Date: Wed, 28 Jan 2015 14:39:48 -0500 To: MATPOWER discussion forum <matpowe...@list.cornell.edu<mailto:matpowe...@list.cornell.edu>> Subject: Re: AW: Solved case does not converge in zero iterations Dear Dominic: The PF solver takes the generator voltage setpoint from the gen(:, VG), thus changing the voltage values set by the OPF at generator buses. Try resultsOPF=runopf(mpc) %calculate opf mpc.gen=resultsOPF.gen %update mpc with optimal P,V and angle values mpc.bus=resultsOPF.bus mpc.gen(:, VG) = mpc.bus(mpc.gen(:, GEN_BUS), VM); resultsPF=runpf(mpc) Regards, carlos. Hewes, Dominic wrote: Hi Uriel, Thanks for your quick response. I understand that the opf varies the PV bus voltages (and other variables) in order to achieve an optimal solution. However, if I take the results of the opf (i.e the optimal generator P, V and bus V,Angle etc) and use these to run a pf (which as you say fixes these variables and does not allow them to change) then why should I get different results in comparison to the opf results? Maybe my method description could be clearer. If I first run an opf, and then update my original mpc struct with the voltages, angles and powers from the opf results, and then run a pf, surely I should get the same results as were output by the opf? ie: resultsOPF=runopf(mpc) %calculate opf mpc.gen=resultsOPF.gen %update mpc with optimal P,V and angle values mpc.bus=resultsOPF.bus resultsPF=runpf(mpc) %run pf to calculate power flows given by the optimal P,V and angle values Does this make any sense? Again, thanks for the response. Regards, Dominic Von: bounce-118751957-69321...@list.cornell.edu<mailto:bounce-118751957-69321...@list.cornell.edu> [mailto:bounce-118751957-69321...@list.cornell.edu] Im Auftrag von Uriel Fernando Sandoval Gesendet: Mittwoch, 28. Januar 2015 20:02 An: MATPOWER discussion forum Betreff: Re: Solved case does not converge in zero iterations Hello Dominic, Probably you are confusing what is the objective of each routine: On one hand opf tries to minimize the production cost subject to voltage constraints : Vmin<= V <= Vmax (for all buses, even PV buses) and other network constraints, therefore, opf does not fix the terminal voltage of the generators. On the other hand pf solves and obtain an equilibrium point that satisfy power balance equations, but, in this case pf fixes the terminal voltage the generators (PV buses) Vk == Vref. IMHO that is the reason why your are experiencing those differences. Best, Uriel El 28/01/2015, a las 10:42, Hewes, Dominic <dominic.he...@tum.de<mailto:dominic.he...@tum.de>> escribió: Dear Matpower Community, I am observing a strange problem whereby the results from a successful 'runopf()' do not seem to present a solved power flow case. I want to verify the power flow solution from an OPF by running a PF with the OPF results as the mpc struct. Firstly, the 'runpf()' converges in 1 iteration, whereas i would expect a solved case to converge in 0 iterations- am i mistaken here? Secondly, when i use the 'compare_case()' command to compare the OPF results with the resulting PF results, I see that there are large differences between the solutions. My code is as follows: resultsOPF=runopf(mpc123); resultsPF=runpf(resultsOPF); compare_case(resultsOPF, resultsPF) The comparison shows a maximum reactive power difference of 494 MVAR between the generator results: gen PG 5.00578e-10 9.67145e-09 9.17088e-09 614 QG 7.99959e-11 494.118 494.118 218 * The OPF command converges successfully with no error warnings, and so I assumed that running the results struct through a PF command should give the same power flow solution. Am i mistaken here? If my thinking is correct, this would indicate that the optimiser has provided results that do not represent a feasible power flow solution - is this potentially a bug? I have tested the same method on the 'case14.m' file and observe that this also requires 1 iteration to converge and gives very small differences (~2e-7) between the OPF and PF results. I am using the latest matpower release (5.0), the TSPOPF 5.0 solver and a windows 7 machine (see output of mpver at end of email). I have tried with other solvers and observe the same problem. I am working with a large model (>5000 bus) that i have attached below. Could the size of my model be the cause of this problem? Presently I am not sure whether I am making a simple mistake or if there is a bug in the solver that is causing the output of inaccurate results. Has anyone experienced similar problems? I would very much appreciate any advice on the cause of the problem. Kind Regards, Dominic mpver MATPOWER Version 5.0 17-Dec-2014 MATLAB Version 8.4 08-Sep-2014 Release: (R2014b) Optimization Toolbox Version 7.1 08-Sep-2014 Release: (R2014b) MIPS Version 1.1 17-Dec-2014 SDP_PF -- not installed -- YALMIP -- not installed -- BPMPD_MEX -- not installed -- CPLEX Version 12.6.0.0 PCWIN64 Gurobi -- not installed -- GLPK -- not installed -- IPOPT -- not installed -- KNITRO -- not installed -- MINOPF -- not installed -- MOSEK -- not installed -- PDIPMOPF Version 5.0 17-Dec-2014 PCWIN64 SCPDIPMOPF Version 5.0 17-Dec-2014 PCWIN64 SDPT3 -- not installed -- SeDuMi -- not installed -- TRALMOPF Version 5.0 17-Dec-2014 PCWIN64 Architecture: PCWIN64 <mpc123.mat>