This is the kind of thing that you should be able to derive very easily by 
looking up the definition of power factor and how it relates to the ratio of Q 
and P. I think it's just a sign change.

-- 
Ray Zimmerman
Senior Research Associate
419A Warren Hall, Cornell University, Ithaca, NY 14853
phone: (607) 255-9645




On Feb 16, 2012, at 6:33 AM, Dailan Xu wrote:

> Dear Dr. Zimmerman,
> 
> According to following code, I want to do OPF considering constant PF= 0.95 
> leading and lagging. How can I differentiate leading and lagging PF? What 
> changes should be applied in the following code?
> 
> mpc = loadcase('t_auction_case');
> nb = size(mpc.bus, 1);
> ng = size(mpc.gen, 1);
> pf = 0.95;
> QPratio = sqrt(1/pf^2 -1);
> %% add constraint that QPratio * Pg(i) - Qg(i) = 0, for i = 2 .. ng
> mpc.A = sparse([1:ng 1:ng]', [2*nb+(1:ng) 2*nb+ng+(1:ng)]', 
> [QPratio*ones(ng,1); -ones(ng,1)], ng, 2*nb+2*ng);
> mpc.A = mpc.A(2:end, :);
> mpc.l = zeros(ng-1, 1);
> mpc.u = mpc.l; 
> results=runopf(mpc)
> 
> Best Regards
> 
> Dailan
> 
> 
> 

Reply via email to