Skip to main content

A python library computing carson's equations.

Project description

carsons

latest release on pypi versons of python supported by carsons GitHub license build passing or failing test coverage Maintainability

This is an implementation of Carson's Equations, a mathematical model for deriving the equivalent impedance of an AC transmission or distribution line.

Implementation

carsons is developed using python 3.6 support for unicode characters like π, ƒ, ρ, μ, ω etc. This feature allows us to avoid translating the problem into a more typical programming syntax, so the code is dense and can easily be compared to published formulations of the problem.

For example, we implement the kron reduction, a matrix decomposition step, using unicode notation to indicate the slightly different meaning of impedance values before and after a kron reduction:

def perform_kron_reduction(z_primitive):
     Ẑpp, Ẑpn = z_primitive[0:3, 0:3], z_primitive[0:3, 3:]
     Ẑnp, Ẑnn = z_primitive[3:,  0:3], z_primitive[3:,  3:]
     Z_abc = Ẑpp - Ẑpn @ inv(Ẑnn) @ Ẑnp
     return Z_abc

Take a look at the source code to see more cool unicode tricks!

Installation

~/$ pip install carsons

Usage

Carsons model requires a line model object that maps each phase to properties of the conductor for that phase.

from carsons import CarsonsEquations, calculate_impedance

class Line:
   geometric_mean_radius: {
       'A': geometric_mean_radius_A
       ...
   }
   resistance: {
        'A': per-length resistance of conductor A in ohms
        ...
   }
   wire_positions: {
        'A': (x, y) cross-sectional position of the conductor in meters
        ...
   }
   phases: {'A', ... }
     # map of phases 'A', 'B', 'C' and 'N<>' which are described in the
     # gmr, r and phase_positions attributes

line_impedance = calculate_impedance(CarsonsEquations(Line()))

The model supports any combination of ABC phasings (for example BC, BCN etc...) including systems with multiple neutral cables; any phases that are not present in the model will have zeros in the columns and rows corresponding to that phase.

Multiple neutrals are supported, as long as they have unique labels starting with N (e.g. Neutral1, Neutral2).

Intermediate results such as primitive impedance matrix are also available.

z_primitive = CarsonsEquations(Line()).build_z_primitive()

For examples of how to use the model, see the overhead wire tests.

carsons is tested against several cable configurations from the IEEE test feeders, as well as examples from EPRI's OpenDSS documentation.

Concentric Neutral Cable

carsons also supports modelling of concentric neutral cables of any phasings. Its usage is very similar to the example above, only requiring a few more parameters about the neutral conductors in the line model object.

from carsons import (ConcentricNeutralCarsonsEquations,
                     calculate_impedance)

class Line:
   resistance: {
       'A': per-length resistance of conductor A in ohms
       ...
   }
   geometric_mean_radius: {
       'A': geometric_mean_radius_A
       ...
   }
   wire_positions: {
        'A': (x, y) cross-sectional position of the conductor in meters
        ...
   }
   phases: {'A', 'NA', ... }
   neutral_strand_gmr: {
       'NA': neutral_strand_gmr_A
       ...
   }
   neutral_strand_resistance: {
       'NA': neutral_strand_resistance_A
       ...
   }
   neutral_strand_diameter: {
       'NA': neutral_strand_diameter_A
       ...
   }
   diameter_over_neutral: {
       'NA': diameter_over_neutral_A
       ...
   }
   neutral_strand_count: {
       'NA': neutral_strand_count_A
       ...
   }

line_impedance = calculate_impedance(ConcentricNeutralCarsonsEquations(Line()))

For examples of how to use the model, see the concentric cable tests.

Problem Description

Carsons equations model an AC transmission or distribution line into an equivalent set of phase-phase impedances, which can be used to model the line in a power flow analysis.

For example, say we have a 4-wire system on a utility pole, with A, B, C phase conductors as well as a neutral cable N. We know that when conductors carry electrical current, they exhibit a magnetic field --- so its pretty easy to imagine that, e.g., the magnetic field produced by A would interact with the B, C, and N conductors.

                        B
                          O
                          |
                          |
              A        N  |       C
                O        O|         O
                ----------|-----------
                          |
                          |
                          |
                          |
                          |
                          |
                          |
                          |
                          |
                          |
                          |
                          |
                          |
    ==============[Ground]============================
    /     /     /     /     /     /     /     /     /
         /     /     /     /     /     /     /
              /     /     /     /     /
 
 
 
 
 
 
 
 
 
 
                 A*       N*          C*
                   0        0           0
 
                           B*
                             0

Figure: Cross-section of a 4-wire distribution line, with
        ground return.

However, each conductor also has a ground return path (or 'image') --- shown as A*, B*, C*, and N* in the figure above --- which is a magnetically induced current path in the ground. When A produces a magnetic field, that field also interacts with B*, C*, N*, and A*. Carsons equations model all these interactions and reduce them to an equivalent impedance matrix that makes it much easier to model this system.

In addition carsons implements the kron reduction, a conversion that approximates the impedances caused by neutral cables by incorporating them into the impedances for phase A, B, and C. Since most AC and DC powerflow formulations don't model the neutral cable, this is a valuable simplification.

References

The following works were used to produce this formulation:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

carsons-0.3.1.tar.gz (7.8 kB view details)

Uploaded Source

File details

Details for the file carsons-0.3.1.tar.gz.

File metadata

  • Download URL: carsons-0.3.1.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.7

File hashes

Hashes for carsons-0.3.1.tar.gz
Algorithm Hash digest
SHA256 87bd9569f15720ba692273e2fc7ee99d4737b190637ec8f40a94582a35d8c904
MD5 8f56a909954cd09b807aeb2ed5110a46
BLAKE2b-256 568d276fb373ba223a196009cc1180f5a96cd930b4163683f5a2d1201422c9d3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page