Hi Arash,
It appears to me you may have omiited the generator data in your 4-bus case.

i tried your case with some simple definition of gen. data and it run for
both power flow and optimal power flow. generator data is as follows below


%% 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 2 0 100 -100 1.02 100 1 318 0 0 0 0 0 0 0 0 0 0 0 0;
];

Please find attached the case modeling and the results,

best regards


On 16 December 2013 10:48, Arash Alimardani <[email protected]>wrote:

> Hello all,
>
> I have the simplest OPF problem, but I can't get matpower to do it for me.
> I would appreciate if someone could help me.
>
> I have attached a figure of the system. Here is the description of the
> system:
>
> 4 buses including 1 generator and 3 load buses:
>
> mpc.bus = [
>     1    3    0    0    0    0    1    1.06    0    0    1    1.06    0.94;
>     2    1    0    0    0    0    1    1.045    -4.98    0    1    1.06
> 0.94;
>     3    1    0    0    0    0    1    1.01    -12.72    0    1    1.06
> 0.94;
>     4    1    .25    0    0    0    1    1.019    -10.33    0    1
> 1.06    0.94;
> ];
>
> as you can see the load of bus 4 is P=0.25, Q=0. All other loads are zero.
>
> As for branches:
>
> mpc.branch = [
>     1    2    1/3    0    0    9900    0    0    0    0    1    -360
> 360;
>     2    3    1/3    0    0    9900    0    0    0    0    1    -360
> 360;
>     3    4    1/3    0    0    9900    0    0    0    0    1    -360
> 360;
> ];
>
> As you can see, only a resistance with the value of 0.333 is the impedance
> of each line.
>
> The data is in per unit and:
> mpc.baseMVA = 1;
>
> And the cost of production:
> mpc.gencost = [
>     2    0    0    3    0.0430293    20    0;
> ];
>
>
> The solution which I have by solving it manually is:
> x0=[0;0;0;0;1;.833333;.666666;.5;.5;0];
>
> However, matpower doesn't converge to it even when I give it as the
> initial value (x0).
>
> Please, help me figure out the problem with my work.
>
> Regards,
> Arash Alimardani
>



-- 

*Fred Kanjelesa.*NCC-Trading/ZESCO
Zambia/Lusaka.

Mobile: +260967/955-880912
Extension: 5124

"I can do all things through Christ who strengthens me." *Philippians 4:13*
CASE MODEL


function mpc = case4gsARASH
%CASE4GS  Power flow data for 4 bus, 2 gen case from Grainger & Stevenson.
%   Please see CASEFORMAT for details on the case file format.
%
%   This is the 4 bus example from pp. 337-338 of "Power System Analysis",
%   by John Grainger, Jr., William Stevenson, McGraw-Hill, 1994.

%   MATPOWER
%   $Id: case4gs.m,v 1.4 2010/03/10 18:08:14 ray Exp $

%% MATPOWER Case Format : Version 2
mpc.version = '2';

%%-----  Power Flow Data  -----%%
%% system MVA base
mpc.baseMVA = 100;

%% 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.06    0    0    1    1.06    0.94;
    2    1    0    0    0    0    1    1.045    -4.98    0    1    1.06    0.94;
    3    1    0    0    0    0    1    1.01    -12.72    0    1    1.06    0.94;
    4    1    0.25    0    0    0    1    1.019    -10.33    0    1    1.06    
0.94;
];

%% 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       2       0       100     -100    1.02    100     1       318     
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  angmin  angmax
mpc.branch = [
        1    2    1/3    0    0    9900    0    0    0    0    1    -360    360;
    2    3    1/3    0    0    9900    0    0    0    0    1    -360    360;
    3    4    1/3    0    0    9900    0    0    0    0    1    -360    360;
];

%%-----  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.0430293    20    0;
];

PF RESULTS


>> runpf(case4gsARASH);

MATPOWER Version 4.1, 14-Dec-2011 -- AC Power Flow (Newton)

Newton's method power flow converged in 4 iterations.

Converged in 0.02 seconds
================================================================================
|     System Summary                                                           |
================================================================================

How many?                How much?              P (MW)            Q (MVAr)
---------------------    -------------------  -------------  -----------------
Buses              4     Total Gen Capacity     318.0        -100.0 to 100.0
Generators         1     On-line Capacity       318.0        -100.0 to 100.0
Committed Gens     1     Generation (actual)      0.3               0.0
Loads              1     Load                     0.3               0.0
  Fixed            1       Fixed                  0.3               0.0
  Dispatchable     0       Dispatchable          -0.0 of -0.0      -0.0
Shunts             0     Shunt (inj)             -0.0               0.0
Branches           3     Losses (I^2 * Z)         0.00              0.00
Transformers       0     Branch Charging (inj)     -                0.0
Inter-ties         0     Total Inter-tie Flow     0.0               0.0
Areas              1

                          Minimum                      Maximum
                 -------------------------  --------------------------------
Voltage Magnitude   1.018 p.u. @ bus 4          1.020 p.u. @ bus 1   
Voltage Angle       0.00 deg   @ bus 1          0.00 deg   @ bus 3   
P Losses (I^2*R)             -                  0.00 MW    @ line 3-4
Q Losses (I^2*X)             -                  0.00 MVAr  @ line 1-2

================================================================================
|     Bus Data                                                                 |
================================================================================
 Bus      Voltage          Generation             Load        
  #   Mag(pu) Ang(deg)   P (MW)   Q (MVAr)   P (MW)   Q (MVAr)
----- ------- --------  --------  --------  --------  --------
    1  1.020    0.000*     0.25      0.00       -         -   
    2  1.019    0.000       -         -         -         -   
    3  1.018    0.000       -         -         -         -   
    4  1.018    0.000       -         -        0.25      0.00 
                        --------  --------  --------  --------
               Total:      0.25      0.00      0.25      0.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      2      0.25      0.00     -0.25     -0.00     0.000      0.00
   2      2      3      0.25      0.00     -0.25     -0.00     0.000      0.00
   3      3      4      0.25     -0.00     -0.25      0.00     0.000      0.00
                                                             --------  --------
                                                    Total:     0.001      0.00







OPF RESULTS



>> runopf(case4gsARASH);

MATPOWER Version 4.1, 14-Dec-2011 -- AC Optimal Power Flow
MATLAB Interior Point Solver -- MIPS, Version 1.0, 07-Feb-2011
Converged!

Converged in 0.25 seconds
Objective Function Value = 5.02 $/hr
================================================================================
|     System Summary                                                           |
================================================================================

How many?                How much?              P (MW)            Q (MVAr)
---------------------    -------------------  -------------  -----------------
Buses              4     Total Gen Capacity     318.0        -100.0 to 100.0
Generators         1     On-line Capacity       318.0        -100.0 to 100.0
Committed Gens     1     Generation (actual)      0.3               0.0
Loads              1     Load                     0.3               0.0
  Fixed            1       Fixed                  0.3               0.0
  Dispatchable     0       Dispatchable          -0.0 of -0.0      -0.0
Shunts             0     Shunt (inj)             -0.0               0.0
Branches           3     Losses (I^2 * Z)         0.00              0.00
Transformers       0     Branch Charging (inj)     -                0.0
Inter-ties         0     Total Inter-tie Flow     0.0               0.0
Areas              1

                          Minimum                      Maximum
                 -------------------------  --------------------------------
Voltage Magnitude   1.000 p.u. @ bus 4          1.002 p.u. @ bus 1   
Voltage Angle       0.00 deg   @ bus 1          0.00 deg   @ bus 1   
P Losses (I^2*R)             -                  0.00 MW    @ line 1-2
Q Losses (I^2*X)             -                  0.00 MVAr  @ line 1-2
Lambda P           20.02 $/MWh @ bus 1         20.12 $/MWh @ bus 4   
Lambda Q            0.00 $/MWh @ bus 1          0.00 $/MWh @ bus 1   

================================================================================
|     Bus Data                                                                 |
================================================================================
 Bus      Voltage          Generation             Load          Lambda($/MVA-hr)
  #   Mag(pu) Ang(deg)   P (MW)   Q (MVAr)   P (MW)   Q (MVAr)     P        Q   
----- ------- --------  --------  --------  --------  --------  -------  -------
    1  1.002    0.000*     0.25      0.00       -         -      20.018     -
    2  1.001    0.000       -         -         -         -      20.051     -
    3  1.001    0.000       -         -         -         -      20.085     -
    4  1.000    0.000       -         -        0.25      0.00    20.118     -
                        --------  --------  --------  --------
               Total:      0.25      0.00      0.25      0.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      2      0.25      0.00     -0.25      0.00     0.000      0.00
   2      2      3      0.25      0.00     -0.25      0.00     0.000      0.00
   3      3      4      0.25      0.00     -0.25      0.00     0.000      0.00
                                                             --------  --------
                                                    Total:     0.001      0.00

================================================================================
|     Generation Constraints                                                   |
================================================================================
 Gen   Bus                Active Power Limits
  #     #    Pmin mu    Pmin       Pg       Pmax    Pmax mu
----  -----  -------  --------  --------  --------  -------
   1     1    0.004      0.00      0.25    318.00      -  
>> 
  • OPF Arash Alimardani
    • Re: OPF Fred Kanjelesa
    • OPF OOzy Pal
    • opf Mounika Vanjarapu
    • opf shruti seemala

Reply via email to