Hi Veniamin,

The legacy cost function only supports costs of a particular form, which I 
don’t believe yours can be made to fit. So the only option is to add a 
non-linear cost. Unfortunately, I never got around to implementing the direct 
specification of non-linear costs (like we have for non-linear constraints), so 
you’ll have to do it via a callback function and the use of add_nln_cost().

If you look in opf_setup.m, you can see examples of two functions that are used 
with add_nln_cost(), namely, opf_gen_cost_fcn() for handling higher order 
polynomial generator costs, and opf_legacy_user_cost_fcn() for the general 
legacy user cost. In both cases, a function handle that only takes x as an 
input is created before passing it to add_nln_cost().

You’ll want to have a look at some of the toggle_*.m functions, like 
toggle_reserves.m to see how to create the callback functions (see Sections 
7.3-7.6 in the manual).

I hope this helps, but don’t hesitate to ask if you have more specific 
questions in the process. I am working to make these sorts of customizations 
simpler in the future.

    Ray


On Jan 27, 2021, at 4:31 AM, Вениамин Сукровицин 
<[email protected]<mailto:[email protected]>> wrote:

Dear Dr Zimmerman and Matpower Community,

Despite the ways to add user defined variables, cost and constraints have been 
already discussed, I haven't found a solution for my case.
I'm working on multi-objective reactive optimal power flow (ROPF) and want to 
expand a Matpower cost function which minimizes a cost of reactive power 
generation with a standard cost function for ROPF (attached picture).
As you can see, the additional cost function depends on voltages and branch 
angles.
The question is what is the best way to implement this cost function ?
I tried to use add_nln_cost but failed because i wasnt able to determine an 
appropriate handle function.
I also tried this approach 
(https://www.mail-archive.com/[email protected]/msg05517.html), which 
describes (as i understand) a legacy cost specification for Vm.

But I want to implement multi-variable cost as I described above.

I will be very grateful for your advice and examples.

Big thanks in advance!

--

Veniamin S.
<F.JPG>


Reply via email to