Hmmm … I thought I fixed such an issue in version 5 of MATPOWER. Are you using 
the latest version? If so, can you send me (off-list) the case and I’ll see if 
I can track down the problem.

    Ray


> On Mar 24, 2016, at 9:48 PM, Bai, Wenlei <[email protected]> wrote:
> 
> Thank you Ray, It helped.
> But When I try to run load flow with enfore_Q_ lims, it has such error:
> 
> Attempted to access pv(1); index out of bounds because numel(pv)=0.
> 
> Error in bustypes (line 61)
>    ref = pv(1);                %% use the first PV bus
> 
> Error in runpf (line 291)
>                [ref, pv, pq] = bustypes(bus, gen);
> 
> Is this possiblely because all PV buseshave been converted to PQ bus? Do you 
> have suggestion to fix it?
> Thanks
> 
> Wenlei
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Ray Zimmerman
> Sent: Thursday, March 24, 2016 2:59 PM
> To: MATPOWER discussion forum <[email protected]>
> Subject: Re: PV bus generator reactive power exceeding limits
> 
> MATPOWER does not return this information explicitly (though it does print it 
> if the verbose option is on. However, you can find it by comparing the 
> BUS_TYPE column of the bus matrix before and after solving the power flow.
> 
>>> mpc = loadcase('case118');
>>> results = runpf(mpc, mpopt);
> 
> MATPOWER Version 6.0-dev, 14-Mar-2016 -- AC Power Flow (Newton)
> 
> Newton's method power flow converged in 3 iterations.
> Gen 46 at upper Q limit, converting to PQ bus
> Gen 9 at lower Q limit, converting to PQ bus
> Gen 15 at lower Q limit, converting to PQ bus
> Gen 16 at lower Q limit, converting to PQ bus
> Gen 43 at lower Q limit, converting to PQ bus
> Gen 48 at lower Q limit, converting to PQ bus
> 
> Newton's method power flow converged in 3 iterations.
>>> k = find(mpc.bus(:, BUS_TYPE) == PV & results.bus(:, BUS_TYPE) == PQ);
>>> mpc.bus(k, BUS_I)
> 
> ans =
> 
>    19
>    32
>    34
>    92
>   103
>   105
> 
> 
> Hope this helps,
> 
>    Ray
> 
> 
> On Mar 24, 2016, at 11:59 AM, Bai, Wenlei 
> <[email protected]<mailto:[email protected]>> wrote:
> 
> Hi Jose,
> Thanks for reminder. I didn’t know this option before. It solved my question.
> So how do we know which PV bus, is there is any, is converted to PQ bus after 
> using ENFORCE_Q_LIMS option 1 or 2?
> 
> Wenlei
> 
> From: 
> [email protected]<mailto:[email protected]>
>  [mailto:[email protected]] On Behalf Of Jose Luis 
> Marin
> Sent: Thursday, March 24, 2016 3:57 AM
> To: MATPOWER discussion forum 
> <[email protected]<mailto:[email protected]>>
> Subject: Re: PV bus generator reactive power exceeding limits
> 
> 
> Quick question, did you use the option pf.enforce_q_lims?  (see Table C-2 in 
> the manual)
> 
> Also, be aware that options 1 and 2 may yield different solutions, in general.
> 
> --
> Jose L. Marin
> Grupo AIA
> 
> 
> 
> On Thu, Mar 24, 2016 at 6:08 AM, Bai, Wenlei 
> <[email protected]<mailto:[email protected]>> wrote:
> Dear Ray,
> I’ve encountered a situation: the real power and voltage are specified in PV 
> buses, and as I run the load flow on modified 30 bus case, somehow the 
> reactive power of PV bus are exceeding the limits. Some even exceed the 
> negative limits.
> The thing is the reactive power demand of the load and system isn’t large.  
> Can you see what might be wrong?
> 
> Blessings,
> Wenlei
> 
> 
> --_000_BLUPR06MB1747B4FA46E56AD48C12540F82830BLUPR06MB1747namp_
> Content-Type: text/html;
>       charset="utf-8"
> Content-Transfer-Encoding: base64
> 
> <html xmlns:v="urn:schemas-microsoft-com:vml" 
> xmlns:o="urn:schemas-microsoft-com:office:office" 
> xmlns:w="urn:schemas-microsoft-com:office:word" 
> xmlns:m="http://schemas.microsoft.com/office/2004/12/omml"; 
> xmlns="http://www.w3.org/TR/REC-html40";>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
> <meta name="Generator" content="Microsoft Word 15 (filtered medium)">
> <style><!--
> /* Font Definitions */
> @font-face
>       {font-family:Courier;
>       panose-1:2 7 4 9 2 2 5 2 4 4;}
> @font-face
>       {font-family:"Cambria Math";
>       panose-1:2 4 5 3 5 4 6 3 2 4;}
> @font-face
>       {font-family:Calibri;
>       panose-1:2 15 5 2 2 2 4 3 2 4;}
> @font-face
>       {font-family:Menlo;
>       panose-1:0 0 0 0 0 0 0 0 0 0;}
> /* Style Definitions */
> p.MsoNormal, li.MsoNormal, div.MsoNormal
>       {margin:0in;
>       margin-bottom:.0001pt;
>       font-size:12.0pt;
>       font-family:"Times New Roman",serif;}
> a:link, span.MsoHyperlink
>       {mso-style-priority:99;
>       color:blue;
>       text-decoration:underline;}
> a:visited, span.MsoHyperlinkFollowed
>       {mso-style-priority:99;
>       color:purple;
>       text-decoration:underline;}
> span.apple-converted-space
>       {mso-style-name:apple-converted-space;}
> span.EmailStyle18
>       {mso-style-type:personal-reply;
>       font-family:"Calibri",sans-serif;
>       color:#1F497D;}
> .MsoChpDefault
>       {mso-style-type:export-only;
>       font-size:10.0pt;}
> @page WordSection1
>       {size:8.5in 11.0in;
>       margin:1.0in 1.0in 1.0in 1.0in;}
> div.WordSection1
>       {page:WordSection1;}
> --></style><!--[if gte mso 9]><xml>
> <o:shapedefaults v:ext="edit" spidmax="1026" />
> </xml><![endif]--><!--[if gte mso 9]><xml>
> <o:shapelayout v:ext="edit">
> <o:idmap v:ext="edit" data="1" />
> </o:shapelayout></xml><![endif]-->
> </head>
> <body lang="EN-US" link="blue" vlink="purple">
> <div class="WordSection1">
> <p class="MsoNormal"><span 
> style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">Thank
>  you Ray, It helped.<o:p></o:p></span></p>
> <p class="MsoNormal"><span 
> style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">But
>  When I try to run load flow with enfore_Q_ lims, it has such 
> error:<o:p></o:p></span></p>
> <p class="MsoNormal"><span 
> style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
> <p class="MsoNormal"><span 
> style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:red">Attempted
>  to access pv(1); index out of bounds because 
> numel(pv)=0.<o:p></o:p></span></p>
> <p class="MsoNormal"><span 
> style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:red"><o:p>&nbsp;</o:p></span></p>
> <p class="MsoNormal"><span 
> style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:red">Error
>  in bustypes (line 61)<o:p></o:p></span></p>
> <p class="MsoNormal"><span 
> style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:red">&nbsp;&nbsp;&nbsp;
>  ref = 
> pv(1);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>  %% use the first PV bus<o:p></o:p></span></p>
> <p class="MsoNormal"><span 
> style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:red"><o:p>&nbsp;</o:p></span></p>
> <p class="MsoNormal"><span 
> style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:red">Error
>  in runpf (line 291)<o:p></o:p></span></p>
> <p class="MsoNormal"><span 
> style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>  [ref, pv, pq] = bustypes(bus, gen);<o:p></o:p></span></p>
> <p class="MsoNormal"><span 
> style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
> <p class="MsoNormal"><span 
> style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">Is
>  this possiblely because all PV buseshave been converted to PQ bus? Do you 
> have suggestion to fix it?<o:p></o:p></span></p>
> <p class="MsoNormal"><span 
> style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">Thanks<o:p></o:p></span></p>
> <p class="MsoNormal"><span 
> style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
> <p class="MsoNormal"><span 
> style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">Wenlei<o:p></o:p></span></p>
> <div>
> <div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 
> 0in">
> <p class="MsoNormal"><b><span 
> style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif">From:</span></b><span
>  style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif"> 
> [email protected] 
> [mailto:[email protected]]
> <b>On Behalf Of </b>Ray Zimmerman<br>
> <b>Sent:</b> Thursday, March 24, 2016 2:59 PM<br>
> <b>To:</b> MATPOWER discussion forum &lt;[email protected]&gt;<br>
> <b>Subject:</b> Re: PV bus generator reactive power exceeding 
> limits<o:p></o:p></span></p>
> </div>
> </div>
> <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
> <div>
> <p class="MsoNormal">MATPOWER does not return this information explicitly 
> (though it does print it if the verbose option is on. However, you can find 
> it by comparing the BUS_TYPE column of the bus matrix before and after 
> solving the power flow.<o:p></o:p></p>
> </div>
> <div>
> <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
> </div>
> <div>
> <div>
> <div>
> <p class="MsoNormal"><span 
> style="font-size:7.5pt;font-family:Courier">&gt;&gt; mpc = 
> loadcase('case118');&nbsp;</span><span 
> style="font-size:7.5pt"><o:p></o:p></span></p>
> </div>
> <div>
> <p class="MsoNormal"><span 
> style="font-size:7.5pt;font-family:Courier">&gt;&gt; results = runpf(mpc, 
> mpopt);</span><span style="font-size:7.5pt"><o:p></o:p></span></p>
> </div>
> <div>
> <p class="MsoNormal"><span 
> style="font-size:7.5pt"><o:p>&nbsp;</o:p></span></p>
> </div>
> <div>
> <p class="MsoNormal"><span 
> style="font-size:7.5pt;font-family:Courier">MATPOWER Version 6.0-dev, 
> 14-Mar-2016 -- AC Power Flow (Newton)</span><span 
> style="font-size:7.5pt"><o:p></o:p></span></p>
> </div>
> <div>
> <p class="MsoNormal"><span 
> style="font-size:7.5pt"><o:p>&nbsp;</o:p></span></p>
> </div>
> <div>
> <p class="MsoNormal"><span 
> style="font-size:7.5pt;font-family:Courier">Newton's method power flow 
> converged in 3 iterations.</span><span 
> style="font-size:7.5pt"><o:p></o:p></span></p>
> </div>
> <div>
> <p class="MsoNormal"><span style="font-size:7.5pt;font-family:Courier">Gen 46 
> at upper Q limit, converting to PQ bus</span><span 
> style="font-size:7.5pt"><o:p></o:p></span></p>
> </div>
> <div>
> <p class="MsoNormal"><span style="font-size:7.5pt;font-family:Courier">Gen 9 
> at lower Q limit, converting to PQ bus</span><span 
> style="font-size:7.5pt"><o:p></o:p></span></p>
> </div>
> <div>
> <p class="MsoNormal"><span style="font-size:7.5pt;font-family:Courier">Gen 15 
> at lower Q limit, converting to PQ bus</span><span 
> style="font-size:7.5pt"><o:p></o:p></span></p>
> </div>
> <div>
> <p class="MsoNormal"><span style="font-size:7.5pt;font-family:Courier">Gen 16 
> at lower Q limit, converting to PQ bus</span><span 
> style="font-size:7.5pt"><o:p></o:p></span></p>
> </div>
> <div>
> <p class="MsoNormal"><span style="font-size:7.5pt;font-family:Courier">Gen 43 
> at lower Q limit, converting to PQ bus</span><span 
> style="font-size:7.5pt"><o:p></o:p></span></p>
> </div>
> <div>
> <p class="MsoNormal"><span style="font-size:7.5pt;font-family:Courier">Gen 48 
> at lower Q limit, converting to PQ bus</span><span 
> style="font-size:7.5pt"><o:p></o:p></span></p>
> </div>
> <div>
> <p class="MsoNormal"><span 
> style="font-size:7.5pt"><o:p>&nbsp;</o:p></span></p>
> </div>
> <div>
> <p class="MsoNormal"><span 
> style="font-size:7.5pt;font-family:Courier">Newton's method power flow 
> converged in 3 iterations.</span><span 
> style="font-size:7.5pt"><o:p></o:p></span></p>
> </div>
> <div>
> <p class="MsoNormal"><span 
> style="font-size:7.5pt;font-family:Courier">&gt;&gt; k = find(mpc.bus(:, 
> BUS_TYPE) == PV &amp; results.bus(:, BUS_TYPE) == PQ);</span><span 
> style="font-size:7.5pt"><o:p></o:p></span></p>
> </div>
> <div>
> <p class="MsoNormal"><span 
> style="font-size:7.5pt;font-family:Courier">&gt;&gt; mpc.bus(k, BUS_I)&nbsp; 
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
> &nbsp; &nbsp; &nbsp; &nbsp;</span><span 
> style="font-size:7.5pt"><o:p></o:p></span></p>
> </div>
> <div>
> <p class="MsoNormal"><span 
> style="font-size:7.5pt"><o:p>&nbsp;</o:p></span></p>
> </div>
> <div>
> <p class="MsoNormal"><span style="font-size:7.5pt;font-family:Courier">ans 
> =</span><span style="font-size:7.5pt"><o:p></o:p></span></p>
> </div>
> <div>
> <p class="MsoNormal"><span 
> style="font-size:7.5pt"><o:p>&nbsp;</o:p></span></p>
> </div>
> <div>
> <p class="MsoNormal"><span style="font-size:7.5pt;font-family:Courier">&nbsp; 
> &nbsp; 19</span><span style="font-size:7.5pt"><o:p></o:p></span></p>
> </div>
> <div>
> <p class="MsoNormal"><span style="font-size:7.5pt;font-family:Courier">&nbsp; 
> &nbsp; 32</span><span style="font-size:7.5pt"><o:p></o:p></span></p>
> </div>
> <div>
> <p class="MsoNormal"><span style="font-size:7.5pt;font-family:Courier">&nbsp; 
> &nbsp; 34</span><span style="font-size:7.5pt"><o:p></o:p></span></p>
> </div>
> <div>
> <p class="MsoNormal"><span style="font-size:7.5pt;font-family:Courier">&nbsp; 
> &nbsp; 92</span><span style="font-size:7.5pt"><o:p></o:p></span></p>
> </div>
> <div>
> <p class="MsoNormal"><span 
> style="font-size:7.5pt;font-family:Courier">&nbsp;&nbsp; 103</span><span 
> style="font-size:7.5pt"><o:p></o:p></span></p>
> </div>
> <div>
> <p class="MsoNormal"><span 
> style="font-size:7.5pt;font-family:Courier">&nbsp;&nbsp; 105</span><span 
> style="font-size:7.5pt"><o:p></o:p></span></p>
> </div>
> <div>
> <p class="MsoNormal"><span 
> style="font-size:7.5pt;font-family:&quot;Menlo&quot;,serif"><br>
> <br>
> <o:p></o:p></span></p>
> </div>
> </div>
> </div>
> <div>
> <p class="MsoNormal">Hope this helps,<o:p></o:p></p>
> </div>
> <div>
> <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
> </div>
> <div>
> <p class="MsoNormal">&nbsp; &nbsp; Ray<o:p></o:p></p>
> </div>
> <div>
> <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
> </div>
> <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
> <div>
> <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
> <div>
> <p class="MsoNormal">On Mar 24, 2016, at 11:59 AM, Bai, Wenlei &lt;<a 
> href="mailto:[email protected]";>[email protected]</a>&gt; 
> wrote:<o:p></o:p></p>
> </div>
> <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
> <div>
> <div>
> <p class="MsoNormal"><span 
> style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">Hi
>  Jose,</span><o:p></o:p></p>
> </div>
> <div>
> <p class="MsoNormal"><span 
> style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">Thanks
>  for reminder. I didn’t know this option before. It solved my 
> question.</span><o:p></o:p></p>
> </div>
> <div>
> <p class="MsoNormal"><span 
> style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">So
>  how do we know which PV bus, is there is any, is converted to PQ bus after 
> using ENFORCE_Q_LIMS option 1 or 2?</span><o:p></o:p></p>
> </div>
> <div>
> <p class="MsoNormal"><span 
> style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">&nbsp;</span><o:p></o:p></p>
> </div>
> <div>
> <p class="MsoNormal"><span 
> style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">Wenlei</span><o:p></o:p></p>
> </div>
> <div>
> <p class="MsoNormal"><span 
> style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">&nbsp;</span><o:p></o:p></p>
> </div>
> <div>
> <p class="MsoNormal"><b><span 
> style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif">From:</span></b><span
>  class="apple-converted-space"><span 
> style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif">&nbsp;</span></span><span
>  style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif"><a 
> href="mailto:[email protected]";><span 
> style="color:purple">[email protected]</span></a><span
>  class="apple-converted-space">&nbsp;</span>[<a 
> href="mailto:[email protected]";><span 
> style="color:purple">mailto:[email protected]</span></a>]<span
>  class="apple-converted-space">&nbsp;</span><b>On
> Behalf Of<span class="apple-converted-space">&nbsp;</span></b>Jose Luis 
> Marin<br>
> <b>Sent:</b><span class="apple-converted-space">&nbsp;</span>Thursday, March 
> 24, 2016 3:57 AM<br>
> <b>To:</b><span class="apple-converted-space">&nbsp;</span>MATPOWER 
> discussion forum &lt;<a href="mailto:[email protected]";><span 
> style="color:purple">[email protected]</span></a>&gt;<br>
> <b>Subject:</b><span class="apple-converted-space">&nbsp;</span>Re: PV bus 
> generator reactive power exceeding limits</span><o:p></o:p></p>
> </div>
> <div>
> <p class="MsoNormal">&nbsp;<o:p></o:p></p>
> </div>
> <div>
> <div>
> <div>
> <p class="MsoNormal">&nbsp;<o:p></o:p></p>
> </div>
> </div>
> <div>
> <p class="MsoNormal">Quick question, did you use the option 
> pf.enforce_q_lims?&nbsp; (see Table C-2 in the manual)<br>
> <br>
> Also, be aware that options 1 and 2 may yield different solutions, in 
> general.<o:p></o:p></p>
> </div>
> <div>
> <div>
> <p class="MsoNormal">&nbsp;<o:p></o:p></p>
> </div>
> <div>
> <div>
> <div>
> <div>
> <div>
> <p class="MsoNormal">--<span 
> class="apple-converted-space">&nbsp;</span><o:p></o:p></p>
> </div>
> </div>
> <div>
> <p class="MsoNormal">Jose L. Marin<o:p></o:p></p>
> </div>
> </div>
> <div>
> <div>
> <p class="MsoNormal">Grupo AIA<o:p></o:p></p>
> </div>
> </div>
> <div>
> <p class="MsoNormal" style="margin-bottom:12.0pt"><br>
> <br>
> <br>
> <o:p></o:p></p>
> </div>
> </div>
> </div>
> <div>
> <div>
> <p class="MsoNormal">On Thu, Mar 24, 2016 at 6:08 AM, Bai, Wenlei &lt;<a 
> href="mailto:[email protected]"; target="_blank"><span 
> style="color:purple">[email protected]</span></a>&gt; 
> wrote:<o:p></o:p></p>
> </div>
> <blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 
> 0in 0in 
> 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
> <div>
> <div>
> <div>
> <p class="MsoNormal">Dear Ray,<o:p></o:p></p>
> </div>
> <div>
> <p class="MsoNormal">I’ve encountered a situation: the real power and voltage 
> are specified in PV buses, and as I run the load flow on modified 30 bus 
> case, somehow the reactive power of PV bus are exceeding the limits. Some 
> even exceed the negative limits.<o:p></o:p></p>
> </div>
> <div>
> <p class="MsoNormal">The thing is the reactive power demand of the load and 
> system isn’t large.&nbsp; Can you see what might be wrong?<o:p></o:p></p>
> </div>
> <div>
> <p class="MsoNormal">&nbsp;<o:p></o:p></p>
> </div>
> <div>
> <p class="MsoNormal">Blessings,<o:p></o:p></p>
> </div>
> <div>
> <p class="MsoNormal">Wenlei<o:p></o:p></p>
> </div>
> </div>
> </div>
> </blockquote>
> </div>
> </div>
> </div>
> </div>
> </blockquote>
> </div>
> <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
> </div>
> </body>
> </html>
> 
> --



Reply via email to