Hi Sam,
I guess your assignment is a typical OPF problem: you may be asked to optimize 
the location and capacity of caps considering investment cost, under the 
constrains of power flow equations, voltage intervals, etc.
Thus, I suggest you read the chapter about OPF in MATPOWER manual, which must 
be helpful.
Two connected key points:
1,How do you model your optimization problem: object and constrain?
2, How do you model your var device: its control object and constrain?

Shiyang Li

在 2012-4-22,3:11,Sam Hazim <samnz2...@yahoo.co.nz> 写道:

> i tried to use the cap cost function with gengcost and put capbank in bs 
> column,but if fails to work,any idea please
>  
> thanks
> sam
> 
> From: "jrmoret...@yahoo.com" <jrmoret...@yahoo.com>
> To: MATPOWER discussion forum <matpower-l@list.cornell.edu> 
> Sent: Saturday, 21 April 2012 9:57 AM
> Subject: Re: Power flow results question
> 
> Bar
> Enviado desde mi dispositivo BlackBerry® de Claro Dominicana
> From: Sam Hazim <samnz2...@yahoo.co.nz>
> Sender: bounce-49184047-9651...@list.cornell.edu
> Date: Fri, 20 Apr 2012 13:07:04 -0700 (PDT)
> To: MATPOWER discussion forum<matpower-l@list.cornell.edu>
> ReplyTo: "MATPOWER discussion forum" <matpower-l@list.cornell.edu>
> Subject: Re: Power flow results question
> 
> Thank you so much for your reply,
>  
> If i put them under BS column. What about the cap banks cost function, i 
> can't put them under the gencost,, where can i put cap cost function?
>  
>  
> Thank you,
>  
>  
> From: Ray Zimmerman <r...@cornell.edu>
> To: MATPOWER Discussion List <matpowe...@cornell.edu> 
> Sent: Saturday, 21 April 2012 6:26 AM
> Subject: Re: Power flow results question
> 
> Capacitors are constant impedance elements that should be added to the BS 
> column of the bus matrix, not to the gen matrix.
> 
>     Ray
> 
> 
> On Apr 20, 2012, at 1:33 AM, Sam Hazim wrote:
> 
>> 
>> 
>> 
>> 
>> Hi everyone,
>> I am new to Matpower, i have some few questions about power flow .
>>  
>> I have been given in my assignment some possible locations for capacitor 
>> banks  to be placed on the system.
>>  
>> 1: I want to make sure, to include  any cap bank on any bus, is it correct 
>> be placed within generator data matrix and set Pg,Qg,Qmin =0, vg=1,  Qgmax= 
>> 300 (value given in my assignment).
>> 2:  from my knowledge, we use cap banks order to minimize losses or support 
>> voltage.i tried to connect them to the high voltage bus or to the main 
>> transform, or other locations and then runpf. the answer doesn't change at 
>> all ( Why is that). i have got min voltage at one bus is about 0.831 and it 
>> should be between a recommend range 0.95 to 1.05.
>>  
>> I have included the case file for two modified cases.and runpf , the results 
>> are the same for both of them.
>>  
>> Please, any suggestions will be very helpful for me to tackle this problem.
>>  
>> Raad
>>  
>> function mpc = case18
>> %%----- Power Flow Data -----%%
>> %% system MVA base
>> mpc.baseMVA = 500;
>> %% bus data
>> % bus_i type Pd Qd Gs Bs area Vm Va baseKV zone Vmax Vmin
>> mpc.bus = [
>> 1 3 0 0 0 0 1 1 0 220 1 1.05 0.95;
>> 2 1 0 0 0 0 1 1 0 220 1 1.05 0.95;
>> 3 2 0 0 0 0 1 1 0 220 1 1.05 0.95;
>> 4 1 0 0 0 0 1 1 0 220 1 1.05 0.95;
>> 5 2 0 0 0 0 1 1 0 220 1 1.05 0.95;
>> 6 1 200 50 0 0 1 1 0 220 1 1.05 0.95;
>> 7 1 450 115 0 0 1 1 0 220 1 1.05 0.95;
>> 8 2 0 0 0 0 1 1 0 220 1 1.05 0.95;
>> 9 1 0 0 0 0 1 1 0 220 1 1.05 0.95;
>> 10 1 0 0 0 0 1 1 0 220 1 1.05 0.95;
>> 11 1 0 0 0 0 1 1 0 220 1 1.05 0.95;
>> 12 1 200 50 0 0 1 1 0 110 1 1.05 0.95;
>> 13 1 150 40 0 0 2 1 0 110 1 1.05 0.95;
>> 14 1 250 65 0 0 2 1 0 110 1 1.05 0.95;
>> 15 1 750 190 0 0 2 1 0 110 1 1.05 0.95;
>> 16 2 0 0 0 0 2 1 0 33 1 1.05 0.95;
>> 17 1 0 0 0 0 2 1 0 220 1 1.05 0.95;
>> 18 2 0 0 0 0 2 1 0 110 1 1.05 0.95;
>> ];
>> %% generator data
>> % bus Pg Qg Qmax Qmin Vg mBase status Pmax Pmin Pc1 Pc2 Qc1min Qc1max Qc2min 
>> Qc2max ramp_agc ramp_10 ramp_30 ramp_q apf
>> mpc.gen = [
>> 1 500 0 750 -200 1.05 500 1 1250 0 0 0 0 0 0 0 0 0 0 0 0;
>> 3 450 0 50 -150 1.05 500 1 500 0 0 0 0 0 0 0 0 0 0 0 0;
>> 5 550 0 200 -150 1.028 500 1 600 0 0 0 0 0 0 0 0 0 0 0 0;
>> 8 50 0 65 -200 0.95 500 1 120 0 0 0 0 0 0 0 0 0 0 0 0;
>> 16 400 0 300 -40 1.022 500 1 500 0 0 0 0 0 0 0 0 0 0 0 0;
>> 18 250 0 220 -100 0.99 500 1 350 0 0 0 0 0 0 0 0 0 0 0 0;
>> 9 0 0 300 0 1 500 1 0 0 0 0 0 0 0 0 0 0 0 0 0;
>> 12 0 0 300 0 1 500 1 0 0 0 0 0 0 0 0 0 0 0 0 0;
>> 13 0 0 300 0 1 500 1 0 0 0 0 0 0 0 0 0 0 0 0 0;
>> 14 0 0 300 0 1 500 1 0 0 0 0 0 0 0 0 0 0 0 0 0;
>> 15 0 0 300 0 1 500 1 0 0 0 0 0 0 0 0 0 0 0 0 0;
>> ];
>> %% branch data
>> % fbus tbus r x b rateA rateB rateC ratio angle status
>> mpc.branch = [
>> 1 3 0.0712 0.3595 0.0982 524 0 0 0 0 1;
>> 4 5 0.0978 0.5855 0.0773 455 0 0 0 0 1;
>> 4 6 0.023 0.1615 0.01 671 0 0 0 0 1;
>> 4 7 0.0201 0.1548 0.0395 766 0 0 0 0 1;
>> 4 2 0.0112 0.1136 0.0071 766 0 0 0 0 1;
>> 7 2 0.0112 0.1136 0.0071 766 0 0 0 0 1;
>> 7 9 0.01 0.0954 0.0058 915 0 0 0 0 1;
>> 1 6 0.042 0.2715 0.017 493 0 0 0 0 1;
>> 1 7 0.088 0.5675 0.0356 323 0 0 0 0 1;
>> 1 17 0.0444 0.2104 0.0247 323 0 0 0 0 1;
>> 7 17 0.0444 0.2104 0.0247 323 0 0 0 0 1;
>> 7 18 0.0000 0.08 0.00 2000 0 0 1 0 1;
>> 7 8 0.002 0.0175 0.0011 915 0 0 0 0 1;
>> 7 15 0.0000 0.05 0.00 2000 0 0 1 0 1;
>> 8 9 0.009 0.0775 0.0047 915 0 0 0 0 1;
>> 9 10 0.0095 0.078 0.005 827 0 0 0 0 1;
>> 9 11 0.079 0.4815 0.0191 408 0 0 0 0 1;
>> 9 14 0.00 0.15 0.00 2000 0 0 1 0 1;
>> 10 11 0.044 0.3585 0.0233 456 0 0 0 0 1;
>> 10 12 0.0000 0.15 0.00 2000 0 0 1 0 1;
>> 11 13 0.00000 0.30 0.00 2000 0 0 1 0 1;
>> 4 16 0.00 0.131 0.00 2000 0 0 1 0 1;
>> 3 5 0.036 0.2396 0.0667 870 0 0 0 0 1;
>> ];
>> %%----- OPF Data -----%%
>> %% generator cost data
>> % 1 startup shutdown n x1 y1 ... xn yn
>> % 2 startup shutdown n c(n-1) ... c0
>> mpc.gencost = [
>> 2 0 0 3 0.039 20 0;
>> 2 0 0 3 0.029 20 0;
>> 2 0 0 3 0.031 20 0;
>> 2 0 0 3 0.12 20 0;
>> 2 0 0 3 0.25 20 0;
>> 2 0 0 3 0.1 20 0;
>> 2 0.01 0 3 0.01 40 0;
>> 2 0.01 0 3 0.01 40 0;
>> 2 0.01 0 3 0.01 40 0;
>> 2 0.01 0 3 0.01 40 0;
>> 2 0.01 0 3 0.01 40 0;
>> ];
>>  
>> This is the  modifed case
>>  
>> function mpc = case18
>> %%----- Power Flow Data -----%%
>> %% system MVA base
>> mpc.baseMVA = 500;
>> %% bus data
>> % bus_i type Pd Qd Gs Bs area Vm Va baseKV zone Vmax Vmin
>> mpc.bus = [
>> 1 3 0 0 0 0 1 1 0 220 1 1.05 0.95;
>> 2 1 0 0 0 0 1 1 0 220 1 1.05 0.95;
>> 3 2 0 0 0 0 1 1 0 220 1 1.05 0.95;
>> 4 1 0 0 0 0 1 1 0 220 1 1.05 0.95;
>> 5 2 0 0 0 0 1 1 0 220 1 1.05 0.95;
>> 6 1 200 50 0 0 1 1 0 220 1 1.05 0.95;
>> 7 1 450 115 0 0 1 1 0 220 1 1.05 0.95;
>> 8 2 0 0 0 0 1 1 0 220 1 1.05 0.95;
>> 9 1 0 0 0 0 1 1 0 220 1 1.05 0.95;
>> 10 1 0 0 0 0 1 1 0 220 1 1.05 0.95;
>> 11 1 0 0 0 0 1 1 0 220 1 1.05 0.95;
>> 12 1 200 50 0 0 1 1 0 110 1 1.05 0.95;
>> 13 1 150 40 0 0 2 1 0 110 1 1.05 0.95;
>> 14 1 250 65 0 0 2 1 0 110 1 1.05 0.95;
>> 15 1 750 190 0 0 2 1 0 110 1 1.05 0.95;
>> 16 2 0 0 0 0 2 1 0 33 1 1.05 0.95;
>> 17 1 0 0 0 0 2 1 0 220 1 1.05 0.95;
>> 18 2 0 0 0 0 2 1 0 110 1 1.05 0.95;
>> ];
>> %% generator data
>> % bus Pg Qg Qmax Qmin Vg mBase status Pmax Pmin Pc1 Pc2 Qc1min Qc1max Qc2min 
>> Qc2max ramp_agc ramp_10 ramp_30 ramp_q apf
>> mpc.gen = [
>> 1 500 0 750 -200 1.05 500 1 1250 0 0 0 0 0 0 0 0 0 0 0 0;
>> 3 450 0 50 -150 1.05 500 1 500 0 0 0 0 0 0 0 0 0 0 0 0;
>> 5 550 0 200 -150 1.028 500 1 600 0 0 0 0 0 0 0 0 0 0 0 0;
>> 8 50 0 65 -200 0.95 500 1 120 0 0 0 0 0 0 0 0 0 0 0 0;
>> 16 400 0 600 -40 1.022 500 1 500 0 0 0 0 0 0 0 0 0 0 0 0;
>> 18 250 0 520 -100 0.99 500 1 350 0 0 0 0 0 0 0 0 0 0 0 0;
>> 12 0 0 300 0 1 500 1 0 0 0 0 0 0 0 0 0 0 0 0 0;
>> 13 0 0 300 0 1 500 1 0 0 0 0 0 0 0 0 0 0 0 0 0;
>> 14 0 0 300 0 1 500 1 0 0 0 0 0 0 0 0 0 0 0 0 0;
>> 15 0 0 300 0 1 500 1 0 0 0 0 0 0 0 0 0 0 0 0 0;
>> ];
>> %% branch data
>> % fbus tbus r x b rateA rateB rateC ratio angle status
>> mpc.branch = [
>> 1 3 0.0712 0.3595 0.0982 524 0 0 0 0 1;
>> 4 5 0.0978 0.5855 0.0773 455 0 0 0 0 1;
>> 4 6 0.023 0.1615 0.01 671 0 0 0 0 1;
>> 4 7 0.0201 0.1548 0.0395 766 0 0 0 0 1;
>> 4 2 0.0112 0.1136 0.0071 766 0 0 0 0 1;
>> 7 2 0.0112 0.1136 0.0071 766 0 0 0 0 1;
>> 7 9 0.01 0.0954 0.0058 915 0 0 0 0 1;
>> 1 6 0.042 0.2715 0.017 493 0 0 0 0 1;
>> 1 7 0.088 0.5675 0.0356 323 0 0 0 0 1;
>> 1 17 0.0444 0.2104 0.0247 323 0 0 0 0 1;
>> 7 17 0.0444 0.2104 0.0247 323 0 0 0 0 1;
>> 7 18 0.0000 0.08 0.00 2000 0 0 1 0 1;
>> 7 8 0.002 0.0175 0.0011 915 0 0 0 0 1;
>> 7 15 0.0000 0.05 0.00 2000 0 0 1 0 1;
>> 8 9 0.009 0.0775 0.0047 915 0 0 0 0 1;
>> 9 10 0.0095 0.078 0.005 827 0 0 0 0 1;
>> 9 11 0.079 0.4815 0.0191 408 0 0 0 0 1;
>> 9 14 0.00 0.15 0.00 2000 0 0 1 0 1;
>> 10 11 0.044 0.3585 0.0233 456 0 0 0 0 1;
>> 10 12 0.0000 0.15 0.00 2000 0 0 1 0 1;
>> 11 13 0.00000 0.30 0.00 2000 0 0 1 0 1;
>> 4 16 0.00 0.131 0.00 2000 0 0 1 0 1;
>> 3 5 0.036 0.2396 0.0667 870 0 0 0 0 1;
>> ];
>> %%----- OPF Data -----%%
>> %% generator cost data
>> % 1 startup shutdown n x1 y1 ... xn yn
>> % 2 startup shutdown n c(n-1) ... c0
>> mpc.gencost = [
>> 2 0 0 3 0.039 20 0;
>> 2 0 0 3 0.029 20 0;
>> 2 0 0 3 0.031 20 0;
>> 2 0 0 3 0.12 20 0;
>> 2 0 0 3 0.25 20 0;
>> 2 0 0 3 0.1 20 0;
>> 2 0.01 0 3 0.01 40 0;
>> 2 0.01 0 3 0.01 40 0;
>> 2 0.01 0 3 0.01 40 0;
>> 2 0.01 0 3 0.01 40 0;
>> ];
>>  
>>  
>> Converged in 0.01 seconds
>> ================================================================================
>> |     System Summary                                                         
>>   |
>> ================================================================================
>> How many?                How much?              P (MW)            Q (MVAr)
>> ---------------------    -------------------  -------------  
>> -----------------
>> Buses             18     Total Gen Capacity    3320.0        -840.0 to 3085.0
>> Generators        11     On-line Capacity      3320.0        -840.0 to 3085.0
>> Committed Gens    11     Generation (actual)   2156.4             1435.9
>> Loads              6     Load                  2000.0             510.0
>>   Fixed            6       Fixed               2000.0             510.0
>>   Dispatchable     0       Dispatchable          -0.0 of -0.0      -0.0
>> Shunts             0     Shunt  (inj)             -0.0               0.0
>> Branches          23     Losses (I^2 * Z)       156.39           1158.17
>> Transformers       6     Branch Charging (inj)     -              232.3
>> Inter-ties         7     Total Inter-tie Flow  2571.5             945.4
>> Areas              2
>>                           Minimum                      Maximum
>>                  -------------------------  --------------------------------
>> Voltage Magnitude   0.831 p.u. @ bus 13         1.050 p.u. @ bus 1   
>> Voltage Angle     -35.25 deg   @ bus 13        23.07 deg   @ bus 5   
>> P Losses (I^2*R)             -                 41.38 MW    @ line 4-5
>> Q Losses (I^2*X)             -                247.71 MVAr  @ line 4-5
>> ================================================================================
>> |     Bus Data                                                               
>>   |
>> ================================================================================
>>  Bus      Voltage          Generation             Load        
>>   #   Mag(pu) Ang(deg)   P (MW)   Q (MVAr)   P (MW)   Q (MVAr)
>> ----- ------- --------  --------  --------  --------  --------
>>     1  1.050    0.000*   456.39    467.50       -         -   
>>     2  0.951  -13.498       -         -         -         -   
>>     3  1.050   20.596    450.00      9.55       -         -   
>>     4  0.966   -8.517       -         -         -         -   
>>     5  1.028   23.071    550.00      6.34       -         -   
>>     6  0.979   -7.475       -         -      200.00     50.00 
>>     7  0.942  -18.601       -         -      450.00    115.00 
>>     8  0.950  -19.251     50.00    412.70       -         -   
>>     9  0.918  -22.228      0.00     -0.00       -         -   
>>    10  0.895  -24.961       -         -         -         -   
>>    11  0.866  -28.061       -         -         -         -   
>>    12  0.875  -29.353      0.00      0.00    200.00     50.00 
>>    13  0.831  -35.246      0.00       0.00    150.00     40.00 
>>    14  0.892  -27.487      0.00     -0.00    250.00     65.00 
>>    15  0.918  -23.576      0.00     -0.00    750.00    190.00 
>>    16  1.022   -2.425    400.00    238.60       -         -   
>>    17  0.986   -8.824       -         -         -         -   
>>    18  0.990  -16.144    250.00     301.23       -         -   
>>                         --------  --------  --------  --------
>>                Total:   2156.39   1435.91   2000.00    510.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      3   -500.37    170.04    537.73    -35.56    37.356    
>> 188.62
>>    2      4      5   -420.13    126.90    461.51     82.35    41.377    
>> 247.71
>>    3      4      6    -57.23    -30.30     57.43     26.97     0.200      
>> 1.40
>>    4      4      7    521.76     43.70   -509.92     29.51    11.841     
>> 91.20
>>    5      4      2    355.61     43.89   -352.52    -15.87     3.083     
>> 31.27
>>    6      7      2   -349.44     12.25    352.52     15.87     3.086     
>> 31.30
>>    7      7      9    297.02     98.30   -294.81    -79.72     2.211     
>> 21.09
>>    8      1      6    263.72    108.81   -257.43    -76.97     6.280     
>> 40.60
>>    9      1      7    293.50     89.95   -278.16     -8.73    15.341     
>> 98.93
>>   10      1     17    399.54     98.69   -385.78    -46.32    13.754     
>> 65.18
>>   11      7     17   -371.93      7.85    385.78     46.32    13.855     
>> 65.66
>>   12      7     18   -250.00   -276.21    250.00    301.23    -0.000     
>> 25.02
>>   13      7      8    262.43   -239.01   -261.86    243.48     0.567      
>> 4.96
>>   14      7     15    750.00    261.04   -750.00   -190.00    -0.000     
>> 71.04
>>   15      8      9    311.86    169.22   -309.34   -149.58     2.518     
>> 21.68
>>   16      9     10    263.98    104.83   -262.15    -91.90     1.826     
>> 14.99
>>   17      9     11     90.17     34.30    -88.37    -30.92     1.802     
>> 10.98
>>   18      9     14    250.00     90.17   -250.00    -65.00    -0.000     
>> 25.17
>>   19     10     11     62.15     25.26    -61.63    -30.04     0.523      
>> 4.26
>>   20     10     12    200.00     66.64   -200.00    -50.00    -0.000     
>> 16.64
>>   21     11     13    150.00     60.96   -150.00    -40.00    -0.000     
>> 20.96
>>   22      4     16   -400.00   -184.18    400.00    238.60    -0.000     
>> 54.41
>>   23      3      5    -87.73     45.10     88.49    -76.01     0.766      
>> 5.10
>>                                                              --------  
>> --------
>>                                                     Total:   156.386   
>> 1158.17
>> >>
>> 
>> 
> 
> 
> 
> 
> 

Reply via email to