| Dirk's suggestion is fine for a simple power flow. But if you want to run an OPF, where the generator dispatch is to be determined by the optimization, but subject to a constant power factor constraint, then you will need to supply an additional user-defined linear constraint. For example, if you want to run case9 with a constant power factor constraint of 0.95 on the first generator, you could do it like this ... define_constants; mpc = loadcase('case9'); nb = size(mpc.bus, 1); ng = size(mpc.gen, 1); pf = 0.95; QPratio = sqrt(1/pf^2 -1); %% add constraint that QPratio * Pg(1) - Qg(1) = 0 mpc.A = sparse([1; 1], [2*nb+1; 2*nb+ng+1], [QPratio; -1], 1, 2*nb+2*ng); mpc.l = 0; mpc.u = 0; r = runopf(mpc); resulting_pf = r.gen(1, PG) / sqrt(r.gen(1, PG)^2 + r.gen(1, QG)^2) The important part here is defining the A matrix properly, where the columns correspond to voltage angles, voltage magnitudes, generator real injections, and generator reactive injections (2*nb + 2*ng columns in all). So the coefficients for our constraint co in the columns corresponding to Pg(1) and Qg(1). -- Ray Zimmerman Senior Research Associate 211 Warren Hall, Cornell University, Ithaca, NY 14853 phone: (607) 255-9645 |
pf_constraint_eg.m
Description: Binary data
On Mar 11, 2011, at 9:50 AM, Dirk Van Hertem wrote:
|
