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]> 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

Reply via email to