Dear ,
That's because the mpc.gen only has 5 columns.
You can modify like this:
>> define_constants;
>> mpc = loadcase('case30');
>> mpc.bus(7, PD) = -10;            // add 10 MW to bus 7
>> mpc.bus (7, BUS_TYPE) = 2;    // changes the type of bus 7 to PV
>> runpf(mpc);
          That's OK.

ATPOWER Version 4.0, 07-Feb-2011 -- AC Power Flow (Newton)
Newton's method power flow converged in 3 iterations.
Converged in 0.67 seconds
================================================================================
|     System Summary                                                           |
================================================================================
How many?                How much?              P (MW)            Q (MVAr)
---------------------    -------------------  -------------  -----------------
Buses             30     Total Gen Capacity     335.0         -95.0 to 405.9
Generators         6     On-line Capacity       335.0         -95.0 to 405.9
Committed Gens     6     Generation (actual)    158.3              98.4
Loads             20     Load                   156.4             107.2
  Fixed           20       Fixed                156.4             107.2
  Dispatchable     0       Dispatchable          -0.0 of -0.0      -0.0
Shunts             2     Shunt (inj)             -0.0               0.2
Branches          41     Losses (I^2 * Z)         1.87              7.08
Transformers       0     Branch Charging (inj)     -               15.6
Inter-ties         7     Total Inter-tie Flow    35.0              24.0
Areas              3
                          Minimum                      Maximum
                 -------------------------  --------------------------------
Voltage Magnitude   0.964 p.u. @ bus 8          1.000 p.u. @ bus 1   
Voltage Angle      -2.33 deg   @ bus 19         3.01 deg   @ bus 13  
P Losses (I^2*R)             -                  0.17 MW    @ line 27-30
Q Losses (I^2*X)             -                  2.08 MVAr  @ line 12-13
================================================================================
|     Bus Data                                                                 |
================================================================================
 Bus      Voltage          Generation             Load        
  #   Mag(pu) Ang(deg)   P (MW)   Q (MVAr)   P (MW)   Q (MVAr)
----- ------- --------  --------  --------  --------  --------
    1  1.000    0.000     -7.40      7.98       -         -   
    2  1.000    0.475     60.97     24.19     21.70     12.70 
    3  0.986   -0.371       -         -        2.40      1.20 
    4  0.983   -0.397       -         -        7.60      1.60 
    5  0.988    0.224       -         -         -         -   
    6  0.977   -0.524       -         -         -         -   
    7  0.978    0.178       -         -      -10.00     10.90 
    8  0.964   -0.979       -         -       30.00     30.00 
    9  0.982   -1.307       -         -         -         -   
   10  0.985   -1.714       -         -        5.80      2.00 
   11  0.982   -1.307       -         -         -         -   
   12  0.986   -0.005       -         -       11.20      7.50 
   13  1.000    3.006     37.00     10.95       -         -   
   14  0.977   -0.757       -         -        6.20      1.60 
   15  0.981   -0.739       -         -        8.20      2.50 
   16  0.978   -1.057       -         -        3.50      1.80 
   17  0.978   -1.752       -         -        9.00      5.80 
   18  0.969   -1.874       -         -        3.20      0.90 
   19  0.966   -2.335       -         -        9.50      3.40 
   20  0.970   -2.238       -         -        2.20      0.70 
   21  0.994   -1.812       -         -       17.50     11.20 
   22  1.000   -1.712     21.59     37.95       -         -   
   23  1.000    0.031     19.20      7.72      3.20      1.60 
   24  0.989   -0.966       -         -        8.70      6.70 
   25  0.990    0.005       -         -         -         -   
   26  0.972   -0.444       -         -        3.50      2.30 
   27  1.000    0.885     26.91      9.63       -         -   
   28  0.978   -0.519       -         -         -         -   
   29  0.980   -0.415       -         -        2.40      0.90 
   30  0.968   -1.328       -         -       10.60      1.90 
                        --------  --------  --------  --------
               Total:    158.27     98.43    156.40    107.20
================================================================================
|     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      2    -12.41      2.70     12.45     -5.59     0.034      0.10
   2      1      3      5.01      5.29     -4.98     -7.14     0.032      0.12
   3      2      4     11.00      5.25    -10.91     -6.94     0.096      0.27
   4      3      4      2.58      5.94     -2.58     -5.92     0.004      0.02
   5      2      5      3.44      4.09     -3.42     -5.99     0.019      0.08
   6      2      6     12.38      7.75    -12.24     -9.29     0.138      0.41
   7      4      6      8.43     12.44     -8.41    -12.35     0.023      0.09
   8      5      7      3.42      6.18     -3.39     -7.08     0.029      0.07
   9      6      7    -13.33      3.03     13.39     -3.82     0.060      0.16
  10      6      8     24.84     24.58    -24.71    -24.07     0.128      0.51
  11      6      9      6.24     -2.48     -6.24      2.58     0.000      0.10
  12      6     10      3.57     -1.42     -3.57      1.50     0.000      0.09
  13      9     11      0.00      0.00      0.00      0.00    -0.000      0.00
  14      9     10      6.24     -2.58     -6.24      2.63     0.000      0.05
  15      4     12     -2.55     -1.18      2.55      1.20     0.000      0.02
  16     12     13    -37.00     -8.86     37.00     10.95     0.000      2.08
  17     12     14      5.30      0.96     -5.27     -0.88     0.036      0.08
  18     12     15      9.10     -0.79     -9.04      0.90     0.060      0.11
  19     12     16      8.85     -0.01     -8.77      0.17     0.072      0.16
  20     14     15     -0.93     -0.72      0.94      0.72     0.003      0.00
  21     16     17      5.27     -1.97     -5.25      2.04     0.027      0.06
  22     15     18      8.94      0.78     -8.85     -0.60     0.092      0.18
  23     18     19      5.65     -0.30     -5.63      0.35     0.020      0.04
  24     19     20     -3.87     -3.75      3.88      3.77     0.009      0.02
  25     10     20      6.13      4.60     -6.08     -4.47     0.054      0.13
  26     10     17      3.78      7.90     -3.75     -7.84     0.024      0.06
  27     10     21     -2.18    -10.71      2.22     10.80     0.037      0.09
  28     10     22     -3.71     -7.92      3.77      8.03     0.055      0.12
  29     21     22    -19.72    -22.00     19.81     22.18     0.088      0.18
  30     15     23     -9.04     -4.90      9.15      5.12     0.110      0.22
  31     22     24     -1.99      7.74      2.06     -7.62     0.077      0.11
  32     23     24      6.85      1.00     -6.79     -0.87     0.062      0.13
  33     24     25     -3.97      1.83      4.01     -1.77     0.037      0.06
  34     25     26      3.55      2.37     -3.50     -2.30     0.046      0.07
  35     25     27     -7.56     -0.60      7.62      0.73     0.064      0.12
  36     28     27     -5.99     -5.28      5.99      5.55     0.000      0.27
  37     27     29      6.17      1.68     -6.08     -1.51     0.090      0.17
  38     27     30      7.12      1.67     -6.95     -1.35     0.171      0.32
  39     29     30      3.68      0.61     -3.65     -0.55     0.035      0.07
  40      8     28     -5.29     -5.93      5.32      4.16     0.034      0.11
  41      6     28     -0.67     -2.08      0.67      1.12     0.001      0.00
                                                             --------  --------
                                                    Total:     1.870      7.08

2011-12-13 



lihucheng68 



发件人: jrmoreta29 
发送时间: 2011-12-13  01:06:29 
收件人: MATPOWER discussion forum 
抄送: 
主题: Re: I want to add a 10MW generator to bus 7 
 
            
Enviado desde mi dispositivo BlackBerry® de Claro Dominicana
-----Original Message-----
From: iman <[email protected]>
Sender: [email protected]
Date: Wed, 16 Nov 2011 19:16:48 
To: <[email protected]>
Reply-To: "MATPOWER discussion forum" <[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
--part2265-boundary-861242848-228417209
Content-Transfer-Encoding: base64
Content-Type: text/html;
charset="utf-8"
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta 
content="text/html; charset=utf-8" http-equiv="Content-Type"></head><body>      
      <div>Enviado desde mi dispositivo BlackBerry® de Claro 
Dominicana</div><hr/><div><b>From: </b> iman &lt;[email protected]&gt;
</div><div><b>Sender: </b> [email protected]
</div><div><b>Date: </b>Wed, 16 Nov 2011 19:16:48 +0000</div><div><b>To: 
</b>&lt;[email protected]&gt;</div><div><b>ReplyTo: </b> "MATPOWER 
discussion forum" &lt;[email protected]&gt;
</div><div><b>Subject: </b>I want to add a 10MW generator to bus 
7</div><div><br/></div>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>&gt;&gt; define_constants;<br>&gt;&gt; mpc = 
loadcase(&#39;case30&#39;);<br>&gt;&gt; mpc.bus(2, PD) = 30;<br>&gt;&gt; 
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>&gt;&gt; define_constants;<br>
&gt;&gt; mpc = loadcase(&#39;case14&#39;);<br>
&gt;&gt; mpc.gen (7, PG) = 10;              //add 10MW to bus 
7<br>&gt;&gt;mpc.bus (7, BUS_TYPE) = 2;    // 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>            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
</body></html>
--part?ݶ떨?wZ?/:׮6??6ێ5ﭽ
?�S??콪ĝʝ?xjǺધ?魏*^?쭾f?Ț?ǭ런??=
QeA??ѵ??AU 1%
?????\͌??Q?!Q50?иQɅ?ͥѥ??????8????ѵ???????????ф????ѕ?д?ѕᐽ?ѵ?쁍??ɍ?еՑ??ȁ?ё5?ŕ?ش?
??ѕ?еQ偔?????????????一??????????????ع?٥??????͑???????́?ͥѥټ? ???? ?ɉ犸????
??ɼ??????????????ظ??ȼ????ظ???ɽ?耰???????????Э???????????ၝ??????????Ь4(????ظ???ظ???M????Ȩ????????չ???̠Ȝ؄ܴ䘔Ĉु??͐???ɹ??????Դ(????ظ???ظ????є耰???]????Ę?9?؀ȀĄ?Ĥ脘萠??

Reply via email to