Sorry, I don’t have time at the moment for a more detailed answer, but there 
are essentially two options:

1. Legacy framework - Study the examples in Chapter 7 of the MATPOWER User’s 
Manual<https://matpower.org/docs/MATPOWER-manual-8.0.pdf> to learn how to add 
custom costs via callback functions.
2. Flexible framework - See Chapter 9 on Customizing 
MATPOWER<https://matpower.org/doc/dev-manual/customizing.html#>, in the 
MATPOWER Developer’s Manual<https://matpower.org/doc/dev-manual/>. In this 
case, you’ll probably want to create an extension that overrides one of the 
subclasses of mme_branch_opf_ac to add your costs to the math model layer.

In either case, you will need code that implements the polynomial and it’s 1st 
and 2nd derivatives.

Best,

    Ray


On Feb 6, 2025, at 7:05 PM, Min Zhou <[email protected]> wrote:

Dear Community,

I am trying to add a penalty term (a 4-order polynomial function) of
the branch flow of a given line on the objective when solving AC-OPF.
I was wondering if there a convenient way to do it?

Many thanks if you can give me some advice.

Best regards.

--
Min ZHOU
School of Data Science
City University of Hong Kong



Reply via email to