Detailed API

HarmonicPowerFlow — Module

A simple and fast module to solve the harmonic power flow problem for given distribution grids.

source
HarmonicPowerFlow.THD — Method
THD(u)

Calculate the Total Harmonic Distortion at all nodes.

THD is a measure for the amount of voltage distortion present at a node. This function calculates two alternative definitions

  • THD_F: relative to fundamental, more commonly used and
  • THD_R: RMS, relative to all frequencies
  • THD_40: relative to fundamental, only until h = 40 (or 39) as used by standard EN 61000.
source
HarmonicPowerFlow.admittance_matrices — Method
admittance_matrices(nodes, lines, harmonics)

Build the nodal admittance matrices (admittance laplacian) for all harmonics.

Admittance scales with frequency: Xh = Xf * h. Return a dictionary of DataFrames.

source
HarmonicPowerFlow.build_harmonic_jacobian — Method
build_harmonic_jacobian(net, settings, u, LY, NE)

Construct harmonic Jacobian J containing all derivatives of power and current mismatches wrt voltages from harmonic state vector.

source
HarmonicPowerFlow.create_nodes_manually — Method

createnodesmanually()

Manually create a nodes DataFrame.

Note that linear nodes are added first, then nonlinear ones. Within the linear ones, first add PV, then PQ nodes. First node contains the slack.

source
HarmonicPowerFlow.current_injections — Method
current_injections(nodes, nodeID, u, NE, harmonics)

Calculate the harmonic current injections at one node.

Uses coupled or uncoupled method based on dimensions of NE.

source
HarmonicPowerFlow.init_power_grid — Method
init_power_grid(nodes, lines, settings)

Create a PowerGrid struct from nodes and lines DataFrames and converts all quantities to the p.u. system.

Indexing (c, m, n) could be done better by being based on number of nodes of certain type. It could make sense to also add LY to PowerGrid struct.

source
HarmonicPowerFlow.init_settings — Method
init_settings(coupled, harmonics; ...)

Initialize settings struct.

Default values:

  • base_frequency=50
  • base_voltage=230
  • base_power=1000
  • thresh_f = 1e-6
  • maxiterf = 30
  • thresh_h=1e-4
  • maxiterh=50
  • v_f=1
  • ϕ_f = 0
  • v_h=0.1
  • ϕ_h=0
source
HarmonicPowerFlow.pf — Function
pf(net, settings, LY, plt_convergence = false)

Perform fundamental power flow, iterate until mismatch is smaller than threshold.

source