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 understand 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 rest I think is OK, because you have to modify the node type.
Best regards.
Álvaro