I am not sure why you are only seeing 2 generators. I was not able to duplicate
your result. I copied and pasted the data from your e-mail into a new case file
and get the result below (different solutions for the cases with and without
reactive costs) …
Ray
>> mpopt = mpoption('opf.ac.solver', 'MIPS', 'out.suppress_detail', 1);
>> mpc = loadcase('case5Stagg')
mpc =
version: '2'
baseMVA: 100
bus: [5x13 double]
gen: [3x21 double]
branch: [7x13 double]
gencost: [6x7 double]
>> r = runopf(mpc, mpopt)
MATPOWER Version 5.1, 20-Mar-2015 -- AC Optimal Power Flow
MATLAB Interior Point Solver -- MIPS, Version 1.2, 20-Mar-2015
(using built-in linear solver)
Converged!
Converged in 0.41 seconds
Objective Function Value = 2021.47 $/hr
================================================================================
| System Summary |
================================================================================
How many? How much? P (MW) Q (MVAr)
--------------------- ------------------- ------------- -----------------
Buses 5 Total Gen Capacity 250.0 -200.0 to 250.0
Generators 3 On-line Capacity 250.0 -200.0 to 250.0
Committed Gens 3 Generation (actual) 168.7 76.2
Loads 4 Load 165.0 79.7
Fixed 4 Fixed 165.0 79.7
Dispatchable 0 Dispatchable -0.0 of -0.0 -0.0
Shunts 0 Shunt (inj) -0.0 0.0
Branches 7 Losses (I^2 * Z) 3.74 11.23
Transformers 0 Branch Charging (inj) - 14.7
Inter-ties 0 Total Inter-tie Flow 0.0 0.0
Areas 1
Minimum Maximum
------------------------- --------------------------------
Voltage Magnitude 0.991 p.u. @ bus 5 1.050 p.u. @ bus 1
Voltage Angle -4.74 deg @ bus 5 0.00 deg @ bus 1
P Losses (I^2*R) - 1.34 MW @ line 2-5
Q Losses (I^2*X) - 4.01 MVAr @ line 2-5
Lambda P 14.45 $/MWh @ bus 1 15.42 $/MWh @ bus 5
Lambda Q 0.05 $/MWh @ bus 1 0.40 $/MWh @ bus 5
r =
version: '2'
baseMVA: 100
bus: [5x17 double]
gen: [3x25 double]
branch: [7x21 double]
gencost: [6x7 double]
order: [1x1 struct]
om: [1x1 opf_model]
x: [16x1 double]
mu: [1x1 struct]
f: 2.0215e+03
var: [1x1 struct]
nln: [1x1 struct]
et: 0.4122
success: 1
raw: [1x1 struct]
>> mpc1 = mpc;
>> mpc1.gencost = mpc1.gencost(1:3, :);
>> r = runopf(mpc1, mpopt)
MATPOWER Version 5.1, 20-Mar-2015 -- AC Optimal Power Flow
MATLAB Interior Point Solver -- MIPS, Version 1.2, 20-Mar-2015
(using built-in linear solver)
Converged!
Converged in 0.08 seconds
Objective Function Value = 2012.97 $/hr
================================================================================
| System Summary |
================================================================================
How many? How much? P (MW) Q (MVAr)
--------------------- ------------------- ------------- -----------------
Buses 5 Total Gen Capacity 250.0 -200.0 to 250.0
Generators 3 On-line Capacity 250.0 -200.0 to 250.0
Committed Gens 3 Generation (actual) 168.7 75.8
Loads 4 Load 165.0 79.7
Fixed 4 Fixed 165.0 79.7
Dispatchable 0 Dispatchable -0.0 of -0.0 -0.0
Shunts 0 Shunt (inj) -0.0 0.0
Branches 7 Losses (I^2 * Z) 3.69 11.07
Transformers 0 Branch Charging (inj) - 14.9
Inter-ties 0 Total Inter-tie Flow 0.0 0.0
Areas 1
Minimum Maximum
------------------------- --------------------------------
Voltage Magnitude 1.001 p.u. @ bus 5 1.050 p.u. @ bus 1
Voltage Angle -4.84 deg @ bus 5 0.00 deg @ bus 1
P Losses (I^2*R) - 1.32 MW @ line 2-5
Q Losses (I^2*X) - 3.95 MVAr @ line 2-5
Lambda P 14.45 $/MWh @ bus 1 15.38 $/MWh @ bus 5
Lambda Q -0.00 $/MWh @ bus 1 0.25 $/MWh @ bus 5
r =
version: '2'
baseMVA: 100
bus: [5x17 double]
gen: [3x25 double]
branch: [7x21 double]
gencost: [3x7 double]
order: [1x1 struct]
om: [1x1 opf_model]
x: [16x1 double]
mu: [1x1 struct]
f: 2.0130e+03
var: [1x1 struct]
nln: [1x1 struct]
et: 0.0820
success: 1
raw: [1x1 struct]
> On May 31, 2016, at 2:52 AM, Saranya A <[email protected]> wrote:
>
> Hi,
> I am using MATPOWER 5.1.
>
> I am trying to run opf for a 5 bus system mentioned in a book by "Stagg and
> El-Abiad".
>
> Following is my input system data:
>
> function mpc = case5Stagg
> %CASE5Stagg This represents the 5 bus system in Stagg El-Abiad book
>
> %% 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.05 0 230 1 1.05 0.95;
> 2 2 20 9.7 0 0 1 1 0 230 1 1.05 0.95;
> 3 1 45 22 0 0 1 1 0 230 1 1.05 0.95;
> 4 2 40 19 0 0 1 1 0 230 1 1.05 0.95;
> 5 1 60 29 0 0 1 1 0 230 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 100 20 100 -100 1 100 1 125 20
> 0 0 0 0 0 0 0 0 0 0
> 0;
> 2 80 20 100 -100 1 100 1 125 20
> 0 0 0 0 0 0 0 0 0 0
> 0;
> 4 0 50 50 0 1 100 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 angmin angmax
> mpc.branch = [
> 1 2 0.02 0.06 0.03 180 180 180 0
> 0 1 -360 360;
> 1 3 0.08 0.24 0.025 180 180 180 0 0 1 -360 360;
> 2 3 0.06 0.18 0.02 180 180 180 0 0 1 -360 360;
> 2 4 0.06 0.18 0.02 180 180 180 0 0 1 -360 360;
> 2 5 0.04 0.12 0.01 180 180 180 0 0 1 -360 360;
> 3 4 0.01 0.03 0.01 180 180 180 0 0 1 -360 360;
> 4 5 0.08 0.24 0.025 180 180 180 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.0420 7.50 75;
> 2 0 0 3 0.0420 7.50 75;
> 2 0 0 3 0 0 0;
> 2 0 0 3 0.0043 -0.0383 0.2992;
> 2 0 0 3 0.0043 -0.0383 0.2992;
> 2 0 0 3 0 0.1324 0;
> ];
>
> This system has 2 generators at bus 1 and 2 and a capacitor at bus 4.
>
> I am also including cost of generation of reactive power from the generators
> as well as the capacitors(refer mpc.gencost).
>
> But after I 'runopf' , the opf results are the same with/without reactive
> power generation cost.
>
> results=
>
> version: '2'
> baseMVA: 100
> bus: [5x17 double]
> gen: [2x25 double]
> branch: [7x21 double]
> gencost: [2x7 double]
> order: [1x1 struct]
> om: [1x1 opf_model]
> x: [14x1 double]
> mu: [1x1 struct]
> f: 2.0196e+03
> var: [1x1 struct]
> nln: [1x1 struct]
> et: 0.0930
> success: 1
> raw: [1x1 struct]
>
> You can see that the gencost is only a 2x7 double. Why is the program not
> taking the other rows into account?
>
> Please help me out.
> Thank you.
>