Impedance and Admittance Methods

CommonOPF exports edge impedance and admittance methods to support building optimal power flow models (see Edge Impedance and Admittance). Internally, the exported methods are supported by methods that dispatch on the edge types:

subtypes(CommonOPF.AbstractEdge)
3-element Vector{Any}:
 CommonOPF.Conductor
 CommonOPF.Transformer
 CommonOPF.VoltageRegulator

The internal methods began with those for Conductor:

CommonOPF.resistance_per_lengthMethod
resistance_per_length(c::Conductor, phase_type::Type{T}) where {T <: Phases}

if ismissing(c.phases)  # single phase
    return c.r1
end
return c.rmatrix
source

Note that conductor resistance and reactance values are expected in per unit length values (since per unit length values are what one finds in engineering data sources).

Admittance values are derived using the inverse of the impedances:

CommonOPF.conductance_per_lengthMethod
conductance_per_length(c::Conductor, phase_type::Type{T}) where {T <: Phases}

If phase_type is SinglePhase then return scalar conductance per unit length, else return 3x3 matrix of conductance per unit length.

if phase_type == SinglePhase
    return c.r1 / (c.length^2 * (c.r1^2 + c.x1^2))
end
return real(inverse_matrix_with_zeros(c.rmatrix + im * c.xmatrix)) / c.length^2
source