Hello iman, mpc.gen (7, PG) = 10; simply translate to row 7 column PG (2) in the mpc.gen matrix for the case14. It means row 7 column 1 for bus number is empty (or assigned a value ‘0’). Thus, the error “Subscript indices must either be real positive integers or logical” because bus number cannot be zero. The problem lies with the syntax you have used to add the 10MW generator to bus 7. You can check the manual just as explained by Álvaro.
Idris From: [email protected] [mailto:[email protected]] On Behalf Of iman Sent: 16 November 2011 19:17 To: [email protected] Subject: I want to add a 10MW generator to bus 7 Dear All, I have a quick question about MATPOWER. From MATPOWER documentation we know if we want to load the 30-bus system data from case30.m,increase its real power demand at bus 2 to 30 MW, then run an AC optimal power flow with default options, this could be accomplished as follows: >> define_constants; >> mpc = loadcase('case30'); >> mpc.bus(2, PD) = 30; >> runopf(mpc); Now I want to add a 10MW generator to bus 7 and run pf (not opf) for 14 bus system so I write: >> define_constants; >> mpc = loadcase('case14'); >> mpc.gen (7, PG) = 10; //add 10MW to bus 7 >>mpc.bus (7, BUS_TYPE) = 2; // changes the type of bus 7 to PV >> runpf(mpc); but I recieve this error: ??? Subscript indices must either be real positive integers or logicals. Error in ==> ext2int at 230 gs = ( mpc.gen(:, GEN_STATUS) > 0 & ... %% gen status Error in ==> runpf at 131 mpc = ext2int(mpc); Do u know what is wrong with my code? Thanks --_000_F207213409196740B17C2032D7675717021DE726A7D8EXCCR03camp_ 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 12 (filtered medium)"><style><!-- /* Font Definitions */ @font-face {font-family:SimSun; panose-1:2 1 6 0 3 1 1 1 1 1;} @font-face {font-family:SimSun; panose-1:2 1 6 0 3 1 1 1 1 1;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4;} @font-face {font-family:Tahoma; panose-1:2 11 6 4 3 5 4 4 2 4;} @font-face {font-family:Consolas; panose-1:2 11 6 9 2 2 4 3 2 4;} @font-face {font-family:"\@SimSun"; panose-1:2 1 6 0 3 1 1 1 1 1;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm; 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.EmailStyle17 {mso-style-type:personal-reply; font-family:"Calibri","sans-serif"; color:#1F497D;} .MsoChpDefault {mso-style-type:export-only;} @page WordSection1 {size:612.0pt 792.0pt; margin:72.0pt 72.0pt 72.0pt 72.0pt;} 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-GB link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hello iman,<o:p></o:p></span></p><p class=MsoNormal>mpc.gen (7, PG) = 10; simply translate to row 7 column PG (2) in the mpc.gen matrix for the case14. It means row 7 column 1 for bus number is empty (or assigned a value ‘0’). Thus, the error “Subscript indices must either be real positive integers or logical” because bus number cannot be zero. The problem lies with the syntax you have used to add the 10MW generator to bus 7.<o:p></o:p></p><p class=MsoNormal>You can check the manual just as explained by Álvaro. <o:p></o:p></p><p class=MsoNormal><br><br><o:p></o:p></p><p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas;color:#1F497D'>Idris <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> [email protected] [mailto:[email protected]] <b>On Behalf Of </b>iman<br><b>Sent:</b> 16 November 2011 19:17<br><b>To:</b> [email protected]<br><b>Subject:</b> I want to add a 10MW generator to bus 7<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Dear All,<br><br>I have a quick question about MATPOWER.<br><br>From MATPOWER documentation we know if we want to load the 30-bus system data from case30.m,increase its real power demand at bus 2 to 30 MW, then run an AC optimal power flow with default options, this could be accomplished as follows:<br><br>>> define_constants;<br>>> mpc = loadcase('case30');<br>>> mpc.bus(2, PD) = 30;<br>>> runopf(mpc);<br> <br>Now I want to add a 10MW generator to bus 7 and run pf (not opf) for 14 bus system so I write:<br><br>>> define_constants;<br>>> mpc = loadcase('case14');<br>>> mpc.gen (7, PG) = 10; //add 10MW to bus 7<br>>>mpc.bus (7, BUS_TYPE) = 2; // changes the type of bus 7 to PV<br>>> runpf(mpc);<br clear=all><br>but I recieve this error:<br><br>??? Subscript indices must either be real positive integers or logicals.<br><br>Error in ==> ext2int at 230<br> gs = ( mpc.gen(:, GEN_STATUS) > 0 & ... %% gen status<br><br>Error in ==> runpf at 131<br>mpc = ext2int(mpc);<br><br>Do u know what is wrong with my code?<br><br>Thanks <o:p></o:p></p></div></div></body></html> --
