Hello to everyone I am new to MATPOWER and I am trying to operate an OPF analysis in a MV grid constisted of two feeders. The first feeder has 10 inductive loads and the second feeder has 10 photovoltaic units and their are connected to the grid by the slack bus. What I want to achieve is loss minimization by allocating the reactive power among the photovoltaic units in a optimal way. The nominal active power of the PV units is 10.6 MW and the load is 6 MW so the extra active power is being absorbed by the HV/MV Grid. Also I want the slack bus to operate at constant 1.05 pu voltage so in the mpc.bus slack bus has voltage limits Vmax=Vmin=1.05. Also I want the PV units to operate in nominal power so in mpc.gen their active power limits are Pmax=Pmin=Pnom.
Finally the mpc.gencost matrix constists of 11 rows and every row has these elements 1 0 0 2 2 4; because I read in the archive that in order to achieve loss minimization you need the same linear costs in the gencost matrix. When I run runopf(mycase) I take the following errors Index exceeds matrix dimensions. Error in opf_setup (line 84) x1 = mpc.gencost(pwl1, COST+2); Error in opf (line 198) om = opf_setup(mpc, mpopt); Error in runopf (line 75) [r, success] = opf(casedata, mpopt); Also, I would like to ask whether my problem can be formulated in MATPOWER. Thank you in advance Alexandros Gesios