Good questions …

1) It’s the same as the order in the mpc.bus matrix.

2) You cannot change the names of the existing variable sets, but in the 
functions where you calculate the constraints, gradients and hessians, you can 
pull out a subset of the full vector for your calculations. For this you will 
have to pass in the information about the necessary indexing. For example, if 
you specify the varsets as {'Pg', 'Vm'}, then in your functions you could do 
something like …

[Pg, Vm] = deal(x{:});
PVg = Pg(ipvg);
Pvm(ipv);

… if you pass in indexing vectors ipvg and ipv for the PV gens and PV buses, 
respectively.

And yes, internally Pg, Qg and Vm are all p.u. and Va is in radians. And, yes, 
it is mpc.baseMVA that is used as the p.u. base for power.

Hope this helps,

    Ray



On Apr 1, 2023, at 2:14 AM, seuyxw <seuw...@163.com> wrote:

Moreover, I am wondering what is the unit of Pg (as well as other variables) 
when calling g_fcn and hess_fcn? I tested the example in t_opf_mips.m and I 
found that Pg seems to be in per unit instead of MW. If so, does the baseMVA 
the same as that of the original mpc structure?

Thank you in advance.





At 2023-04-01 15:03:40, "seuyxw" <seuw...@163.com> wrote:

Dear all,

I am trying to add nonlinear constraints w.r.t. the voltage magnitudes and 
active generations of PV buses. To proceed, I need to calculate the gradients 
and hessian w.r.t. the variable sets specified through varsets. I found that 
there are only four valid names, i.e., ''Va","Vm","Pg","Qg", so in my case, I 
need to specify the varsets field as {'Pg', 'Vm'}.

I am wondering:
1) What's the order of variables in each variable set? For example, does the 
order in 'Vm' set the same as that of the mpc.bus or the same as the bus number?

2) Can I rename variable set names to make the calculation of gradient and 
hessian more compact? For example, in my case, I only need the variables of PV 
buses (i.e., Pg and Vm of PV buses). Can I create and rename some variable 
subsets as 'PVg' and 'PVm' which contain the variables associated with PV 
buses? If not, how can I extract the Pg and Vm of PV buses in my nonlinear 
constraint function?

Best regards,
Yuanxi Wu


Reply via email to