On 02/01/2018 02:55 PM, Baljinnyam Sereeter wrote:

On 01/25/2018 05:09 PM, Baljinnyam Sereeter wrote:Hi Baljinnyam,Thanks for your offer to contribute. This would be a nice addition to MATPOWER.I suggest starting by adding two new MATPOWER options, each with default values of 0 …opf.current_balance = 0 (complex power balance) or 1 (complex current balance)opf.v_cartesian = 0 (polar) or 1 (Cartesian)Then find all the places in the existing OPF code where the current (default) formulation is assumed and add conditionals to implement the other variations. You might find it useful to use the MATLAB Profiler with a simple runopf() call to map out the functions that are called. I think much of the work will be in opf_setup(), where we’ll need to use different variables and constraints.Another thing to do early in the process is to duplicate the t/t_opf_mips.m file for each of the 3 new variations. The initial goal will be to get all of those tests to pass for each of the versions.Of course, you will want to begin all of this on your own fresh fork of the current MATPOWER development branch using the guidelines in the Contributor’s Guide <https://github.com/MATPOWER/matpower/blob/master/CONTRIBUTING.md#submitting-additions-or-modifications-to-the-code>.Don’t hesitate to ask if you have questions or need any help along the way.Thanks again, RayDear Ray,I use Matpower 6.0 version that I understand in code level and know where I can make changes. However, I have some problems with Matpower repository that I cloned. It seems that this is a new version that is still not released yet. I see that functions where I would make my changes are changed as[g, dg] and [h, dh] are computed using *om.eval_nln_constraint(x, 1);*d2G and d2H are computed using *om.eval_nln_constraint_hess(x, lambda.ineqnonlin, 0);*In the new verion, a lot is changed including structure and code. Therefore, this is hard for me to understand and make changes in the code. So what should I do? I can do it easily in Matpower 6.0 version.Regards, Baljinnyam

Dear Ray,Please refer to the attachment for additional derivatives of equality and inequality constraints w.r.t Polar and Cartesian coordinates. I computed derivatives using Complex Matrix Notation in case you want to include them in the TN2,

Regards, Baljinnyam

**
Derivatives.pdf**

*Description:* Adobe PDF document