It sounds like you want set your generator costs to zero and put a user-defined 
quadratic cost on the deviations of the voltage magnitudes from 1. Something 
like the following should do it for case30 …

define_constants;
mpopt = mpoption('verbose', 2, 'opf.ac.solver', 'MIPS');
mpc = loadcase('case30');
nb = size(mpc.bus, 1);
ng = size(mpc.gen, 1);
mpc.N = sparse(1:nb, nb+(1:nb), 1, nb, 2*nb+2*ng);  %% select Vm
rhat = 1;       %% offset 1 p.u.
k = 0;
d = 2
m = 1;
mpc.fparm = ones(nb, 1) * [d rhat k m];
mpc.Cw = 10000 * ones(nb, 1);
mpc.gencost(:, COST:end) = 0;
r = runopf(mpc, mpopt);

Hope this helps,

    Ray




> On Jun 29, 2015, at 2:22 PM, Thai Tran <[email protected]> wrote:
> 
> Hi All,
> 
> I want to run an opf where the objective is to minimize voltage variability 
> (i.e keep the voltage across the feeder as close to 1 p.u as possible) how 
> should I structure the cost matrix?
> 
> Thanks
> Thai

Reply via email to