Shri's latest suggestion is a good one. I'm surprised if you are getting a successful OPF solution with a PMIN=PMAX and QMIN=QMAX on all generators. Relaxing it for one should allow it to solve. If you really are getting success = 1 and the constraints are not being satisfied as you say, that is an error and I'd like to be able to reproduce it to find the problem. If this is the case, please send me an example off-list and the output of mpver.
Another suggestion I have is to use the OPF solution from your other tool and run a simple power flow and see if all of the voltages match, if the slack bus PG matches and if the generator QG's match. In this case, you will have to set not only PG and QG (at all but the REF bus), but also VG at all generator buses. -- Ray Zimmerman Senior Research Associate 419A Warren Hall, Cornell University, Ithaca, NY 14853 phone: (607) 255-9645 On May 20, 2013, at 4:04 PM, Shri <[email protected]> wrote: > > On May 20, 2013, at 11:49 AM, spyros gian wrote: > >> This is what I thought you meant and this is what i did. >> I went to the file 'caseConstr.m' and set the following: >> >> % bus Pg Qg Qmax Qmin Vg >> mBase status Pmax Pmin >> mpc.gen = [ >> 1 100 37.832 37.832 37.832 1 100 >> 1 100 100 ; >> 2 30 66.286 66.286 66.286 1 100 >> 1 30 30 ; >> 3 23.039 0 0 0 1 100 >> 1 23.039 23.039 ; >> ]; >> >> So here,you can see that Pg= Pmax=Pmin and Qg=Qmax=Qmin for each of the 3 >> generators. >> >> When previously you mentioned that setting Pgmax=Pgmin=Pg (similarly for Qg) >> solves the problem, did u mean >> a different way of setting them ? > > Hmm, I think the OPF may not converge if you try to set hard limits on all > the generators. This is because there could be some small numerical mismatch > that is not being met by OPF tolerance. For e.g., the actual Pg for generator > 1 could be 100.0045687 but you are asking it to be fixed to 100. Could you > try setting limits on only 2 generators and allow OPF to find the operating > point for the third generator. > > Shri >> >> From: [email protected] >> Subject: Re: Constraining matpower >> Date: Mon, 20 May 2013 11:41:24 -0500 >> To: [email protected] >> >> Try setting Pmax, Pmin, Qmax, Qmin in the case file directly. >> >> On May 20, 2013, at 11:12 AM, spyros gian wrote: >> >> Dear Shri, >> Exactly. >> I am taking the solution (Pgeneration and Qgeneration for each generator) >> from another optimisation tool. >> Then I want to make matpower take these values and produce the remaining >> results ie voltages etc. >> So I want to tell matpower ' only use the values for Pg and Qg that I give >> you, so that i see whether you converge and if yes, >> then what solution you give'. >> >> I then go to the mpc.gen matrix, and - as you say - set Pg=Pmax=Pmin, and >> Qg=Qmax=Qmin, for each generator. >> I run the OPF, and matpower solves the problem without taking this >> constraint into account i.e. giving another Pg and another Qg! >> Ie it converges to the same result as the one I had before constraining >> matpower. >> >> So we say the same thing here. Why doesnt it work? >> >> >> From: [email protected] >> Subject: Re: Constraining matpower >> Date: Mon, 20 May 2013 11:03:37 -0500 >> To: [email protected] >> >> I am not sure if I am understanding you correctly here. What I figured you >> were doing was to compare the solution of another optimization tool with >> MATPOWER's >> OPF. To do this you are taking the generation output (Pg, Qg) from the >> optimization tool and using it as "fixed" input for MATPOWER's OPF. Hence I >> suggested that you set the >> Pmax=Pmin=Pg and Qmax=Qmin=Qg so that Pg and Qg remain fixed in MATPOWER's >> OPF solution. >> >> >> Shri >> >> ***** Note that your assumption of the optimization tool and MATPOWER's >> solutions "matching" also implicitly assumes that the optimization tool uses >> the same objective function, constraints as used in MATPOWER. >> >> On May 20, 2013, at 10:31 AM, spyros gian wrote: >> >> Dear Shri, >> >> I am running an ACOPF not a simple power flow. When I set in the mpc.gen >> matrix that >> Pg= Pmax=Pmin and Qg=Qman=Qmin (ie the corresponding columns having the >> same value) >> and then runopf ('caseExample') then , matpower ignores this constraint, ie >> that pmax=pmin=pg. >> Are you sure it works for you? >> Yes, for MATPOWER's case9 system, I constrained Pg and Qg for generators 2 >> and 3 to fixed values by setting Pmax=Pmin=Pg and >> Qmax=Qmin=Qg and this is what runopf() produces. I don't know why, and its >> strange that, the constraints are being ignored in your case. >> Perhaps you are not setting something correctly? or the solution has not >> converged? >> >> >> MATPOWER Version 4.1, 14-Dec-2011 -- AC Optimal Power Flow >> MATLAB Interior Point Solver -- MIPS, Version 1.0, 07-Feb-2011 >> Converged! >> >> Converged in 0.07 seconds >> Objective Function Value = 5334.26 $/hr >> ================================================================================ >> | System Summary >> | >> ================================================================================ >> >> How many? How much? P (MW) Q (MVAr) >> --------------------- ------------------- ------------- >> ----------------- >> Buses 9 Total Gen Capacity 490.0 -320.3 to 279.7 >> Generators 3 On-line Capacity 490.0 -320.3 to 279.7 >> Committed Gens 3 Generation (actual) 318.7 -6.8 >> Loads 3 Load 315.0 115.0 >> Fixed 3 Fixed 315.0 115.0 >> Dispatchable 0 Dispatchable -0.0 of -0.0 -0.0 >> Shunts 0 Shunt (inj) -0.0 0.0 >> Branches 9 Losses (I^2 * Z) 3.69 39.16 >> Transformers 0 Branch Charging (inj) - 160.9 >> Inter-ties 0 Total Inter-tie Flow 0.0 0.0 >> Areas 1 >> >> Minimum Maximum >> ------------------------- -------------------------------- >> Voltage Magnitude 1.070 p.u. @ bus 9 1.100 p.u. @ bus 8 >> Voltage Angle -3.98 deg @ bus 9 6.66 deg @ bus 2 >> P Losses (I^2*R) - 1.73 MW @ line 8-9 >> Q Losses (I^2*X) - 11.67 MVAr @ line 8-2 >> Lambda P 21.53 $/MWh @ bus 8 22.51 $/MWh @ bus 5 >> Lambda Q -0.02 $/MWh @ bus 2 0.10 $/MWh @ bus 9 >> >> ================================================================================ >> | 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.100 0.000* 78.69 13.54 - - 22.311 - >> 2 1.098 6.662 150.00 1.93 - - 21.536 >> -0.018 >> 3 1.087 3.825 90.00 -22.25 - - 21.630 >> 0.011 >> 4 1.093 -2.161 - - - - 22.311 >> 0.001 >> 5 1.084 -3.545 - - 90.00 30.00 22.510 >> 0.028 >> 6 1.100 1.296 - - - - 21.631 >> 0.011 >> 7 1.089 -0.147 - - 100.00 35.00 21.755 >> 0.026 >> 8 1.100 2.209 - - - - 21.533 >> -0.018 >> 9 1.070 -3.976 - - 125.00 50.00 22.499 >> 0.095 >> -------- -------- -------- -------- >> Total: 318.69 -6.78 315.00 115.00 >> >> ================================================================================ >> | 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 4 78.69 13.54 -78.69 -10.50 0.000 >> 3.04 >> 2 4 5 32.20 -3.57 -32.05 -14.33 0.152 >> 0.82 >> 3 5 6 -57.95 -15.67 59.08 -22.10 1.125 >> 4.90 >> 4 3 6 90.00 -22.25 -90.00 26.51 0.000 >> 4.26 >> 5 6 7 30.92 -4.41 -30.82 -19.78 0.101 >> 0.85 >> 6 7 8 -69.18 -15.22 69.53 0.29 0.346 >> 2.93 >> 7 8 2 -150.00 9.74 150.00 1.93 0.000 >> 11.67 >> 8 8 9 80.47 -10.03 -78.74 -17.30 1.732 >> 8.71 >> 9 9 4 -46.26 -32.70 46.49 14.07 0.231 >> 1.97 >> -------- >> -------- >> Total: 3.687 >> 39.16 >> >> ================================================================================ >> | Voltage Constraints >> | >> ================================================================================ >> Bus # Vmin mu Vmin |V| Vmax Vmax mu >> ----- -------- ----- ----- ----- -------- >> 1 - 0.900 1.100 1.100 0.977 >> 6 - 0.900 1.100 1.100 44.627 >> 8 - 0.900 1.100 1.100 113.932 >> >> ================================================================================ >> | Generation Constraints >> | >> ================================================================================ >> Gen Bus Active Power Limits >> # # Pmin mu Pmin Pg Pmax Pmax mu >> ---- ----- ------- -------- -------- -------- ------- >> 2 2 5.164 150.00 150.00 150.00 0.000 >> 3 3 1.420 90.00 90.00 90.00 0.000 >> >> Gen Bus Reactive Power Limits >> # # Qmin mu Qmin Qg Qmax Qmax mu >> --- --- ------- -------- -------- -------- ------- >> 2 2 0.018 1.93 1.93 1.93 0.000 >> 3 3 0.000 -22.25 -22.25 -22.25 0.011 >> >> >> IS there a way for this Dr Zimmerman? >> >> Thank you >> >> Subject: Re: Constraining matpower >> From: [email protected] >> Date: Mon, 20 May 2013 08:47:09 -0500 >> To: [email protected] >> >> Setting Pgmax=Pgmin=Pg (similarly for Qg) should constrain the generator >> output to a fixed value. >> >> Shri >> >> On May 20, 2013, at 8:01 AM, spyros gian <[email protected]> wrote: >> >> Dear Dr Zimmerman, >> >> I have solved an ACOPF in an optimisation tool. >> I would like to get the solutions from this tool, and plug them to the >> matpower. >> In particular, I want to get the solutions for the Pgeneration and >> Qgeneration for each generator that the optimisation tool gave me, >> and plug them into matpower. >> >> This will allow me to see whether the matpower gives the same values for >> voltage magnitudes that I got. >> >> Should I program some code in matlab so that i constrain matpower's mpc.gen >> matrix to have these values? >> >> I guess that if i put these values to the columns Pg,Qg of the matpower >> mpc.gen matrix, this will not constrain matpower. >> >> >> Thank you for your insight >> >> Syros Giannakos >
