Hi ,
For PF you do not need the mpc.gencost matrix.

Idris
.

From: [email protected] 
[mailto:[email protected]] On Behalf Of Álvaro 
Jaramillo Duque
Sent: 17 November 2011 15:04
To: MATPOWER discussion forum
Cc: [email protected]
Subject: Re: I want to add a 10MW generator to bus 7

Hello

I think the error is due because there wasn't a generator at bus 7 and you 
didn't add all the information concerning a that generator.

Look in the manual, Appendix B Data File Format, or just open the case in a 
editor text and see what is required for a generator, this is the best way to 
understad the MATPOWER file format.

I think you mistook the "id" of the node with the position on the matrix mpc.gen

>> define_constants;
>> mpc = loadcase('case14');
>> size(mpc.gen)
ans =

    5   21

See that the dimension is 5 rows, 7 out of the dimension.

What I am not sure if is mandatory for a PF add the mpc.gencost information of 
the new generator.

The The rest I think is OK, because you have to modify the node type.

Best regards.

Álvaro

On Wed, Nov 16, 2011 at 8:16 PM, iman 
<[email protected]<mailto:[email protected]>> wrote:
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_F207213409196740B17C2032D7675717021DE726A7D9EXCCR03camp_
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'>Hi 
,<o:p></o:p></span></p><p class=MsoNormal><span 
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>For 
PF you do not need the mpc.gencost matrix. <o:p></o:p></span></p><p 
class=MsoNormal><span 
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></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>&nbsp;</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>Álvaro 
Jaramillo Duque<br><b>Sent:</b> 17 November 2011 15:04<br><b>To:</b> MATPOWER 
discussion forum<br><b>Cc:</b> [email protected]<br><b>Subject:</b> Re: I 
want to add a 10MW generator to bus 7<o:p></o:p></span></p></div></div><p 
class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal 
style='margin-bottom:12.0pt'>Hello <br><br>I think the error is due because 
there wasn't a generator at bus 7 and you didn't add all the information 
concerning a that generator.<br><br>Look in the manual, Appendix B Data File 
Format, or just open the case in a editor text and see what is required for a 
generator, this is the best way to understad the MATPOWER file format.<br><br>I 
think you mistook the &quot;id&quot; of the node with the position on the 
matrix mpc.gen<br><br>&gt;&gt; define_constants;<br>&gt;&gt; mpc = 
loadcase('case14');<br>&gt;&gt; size(mpc.gen)<br>ans 
=<br><br>&nbsp;&nbsp;&nbsp; 5&nbsp;&nbsp; 21<br>&nbsp;&nbsp;&nbsp; <br>See that 
the dimension is 5 rows, 7 out of the dimension.<br><br>What I am not sure if 
is mandatory for a PF add the mpc.gencost information of the new 
generator.<br><br>The The rest I think is OK, because you have to modify the 
node type.<br><br>Best regards.<br><br>Álvaro<br><br><o:p></o:p></p><div><p 
class=MsoNormal>On Wed, Nov 16, 2011 at 8:16 PM, iman &lt;<a 
href="mailto:[email protected]";>[email protected]</a>&gt; 
wrote:<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&nbsp; 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>&gt;&gt; 
define_constants;<br>&gt;&gt; mpc = loadcase('case30');<br>&gt;&gt; mpc.bus(2, 
PD) = 30;<br>&gt;&gt; runopf(mpc);<br>&nbsp; <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>&gt;&gt; define_constants;<br>&gt;&gt; mpc = 
loadcase('case14');<br>&gt;&gt; mpc.gen (7, PG) = 
10;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 //add 10MW to bus 7<br>&gt;&gt;mpc.bus (7, BUS_TYPE) = 2;&nbsp;&nbsp;&nbsp; // 
changes the type of bus 7 to PV<br>&gt;&gt; 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 ==&gt; ext2int at 
230<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gs = 
( mpc.gen(:, GEN_STATUS) &gt; 0 &amp; ... %% gen status<br><br>Error in ==&gt; 
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><p 
class=MsoNormal><o:p>&nbsp;</o:p></p></div></div></body></html>
--

Reply via email to