Modify power flow equation in PowerModels.jl

I want to implement a different form of power flow equation, which is based on one trigonometric term instead of two, in PowerModels. In this connection, I have defined new envelopes for trig functions, and could easily implement those in PowerModels by forcing “do nothing” for old variables that had defined for trigonometric functions in wr.jl file. But changing power flow equations seems to be a little trickier since those equations are shared between different Abstract types in “shared.jl” file. Can you please let me know how I can implement new power flow equations for my defined Abstract type without having any effect on other Abstract types? Note that I have defined a new abstract type which is under the QCWRFORM (i.e., “abstract type QCWRTriShiftForm <: QCWRForm end”). Thanks in advance! any help would be appreciated.

If your interest is to do rapid exploration of different power flow equations, I would recommend using the from scratch JuMP models in PowerModelsAnnex - Models. These functions show you the model that PowerModels builds, for a few popular cases.

If your interest is to contribute a new formulation to PowerModels then we can discuss that in more detail.

Seeing that you mention one trigonometric term, I’ll note that PowerModels includes a non-convex tangent base formulation ACTPowerModel, which may provide a helpful example. Concerning one possible convex relaxation of that formulation, one can look to Section 4.2 of this paper.

Thanks for the response! I think it is better to implement the new formulation in PowerModlsAnnex first, to see if it can improve the current approach then I can generalize it by contributing to PowerModels.