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>