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

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 in meters
       ...
   }
   resistance: {
        'A': per-length resistance of conductor A in ohms/meters
        ...
   }
   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 Cable:
   resistance: {
       'A': per-length resistance of conductor A in ohm/meters
       ...
   }
   geometric_mean_radius: {
       'A': geometric mean radius of conductor A in meters
       ...
   }
   wire_positions: {
        'A': (x, y) cross-sectional position of conductor A in meters
        ...
   }
   phases: {'A', 'NA', ... }
   neutral_strand_gmr: {
       'NA': neutral strand gmr of phase A in meters
       ...
   }
   neutral_strand_resistance: {
       'NA': neutral strand resistance of phase A in ohm/meters
       ...
   }
   neutral_strand_diameter: {
       'NA': neutral strand diameter of phase A in meters
       ...
   }
   diameter_over_neutral: {
       'NA': diameter over neutral of phase A in meters
       ...
   }
   neutral_strand_count: {
       'NA': neutral strand count of phase A
       ...
   }

cable_impedance = calculate_impedance(ConcentricNeutralCarsonsEquations(Cable()))

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

Multi-Conductor Cable

carsons also supports modelling of phased duplex, triplex, quadruplex cables and triplex secondary. It only requires a few more parameters to describe cable's geometry.

from carsons import (MultiConductorCarsonsEquations,
                     calculate_impedance)

class Cable:
    resistance: {
        'A': per-length resistance of conductor A in ohm/meters
        ...
    }
    geometric_mean_radius: {
        'A': geometric mean radius of conductor A in meters
        ...
    }
    wire_positions: {
        'A': (x, y) cross-sectional position of conductor A in meters
        ...
    }
    outside_radius: {
        'A': outside radius of conductor A, including insulation and jacket thickness
        ...
    }
    insulation_thickness: {
        'A': insulation thickness of conductor A
        ...
    }
    phases: {'A', ... }

cable_impedance = calculate_impedance(MultiConductorCarsonsEquations(Cable()))

To model a triplex secondary cable, the inputs should be keyed on secondary conductors S1 and S2. The impedance result is a 2 x 2 matrix.

class Cable:
    resistance: {
        'S1': per-length resistance of conductor S1 in ohm/meters
        ...
    }
    geometric_mean_radius: {
        'S1': geometric mean radius of conductor S1 in meters
        ...
    }
    wire_positions: {
        'S1': (x, y) cross-sectional position of conductor S1 in meters
        ...
    }
    outside_radius: {
        'S1': outside radius of conductor S1, including insulation and jacket thickness
        ...
    }
    insulation_thickness: {
        'S1': insulation thickness of conductor S1
        ...
    }
    phases: {'S1', ... }

For examples of how to use the model, see the multi-conductor cable tests.

Tape Shield Cable

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

from carsons import (TapeShieldedCableCarsonsEquations,
                     calculate_impedance)

class Cable:
   resistance: {
       'A': per-length resistance of conductor A in ohm/meters
       ...
   }
   geometric_mean_radius: {
       'A': geometric mean radius of conductor A in meters
       ...
   }
   wire_positions: {
        'A': (x, y) cross-sectional position of conductor A in meters
        ...
   }
   phases: {'A', ... }
   tape_shield_thickness: {
       'A': thickness of tape shield conductor on phase A cable in meters
       ...
   }
   tape_shield_outer_diameter: {
       'A': outer diameter of tape shield conductor on phase A cable in meters
       ...
   }
   

cable_impedance = calculate_impedance(TapeShieldedCableCarsonsEquations(Cable()))

For examples of how to use the model, see the tape shielded 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-1.0.2.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

carsons-1.0.2-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: carsons-1.0.2.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for carsons-1.0.2.tar.gz
Algorithm Hash digest
SHA256 a1080f4d6a8e58aa8c97aab17a59aec90095b93fa8af13fa8861d5c621f7316a
MD5 df16644a7ab55678f027ff0f9ab2b846
BLAKE2b-256 123fd4c07283c6d1e04f285e268c86e44cd466c4f38743618a52d4052f08c755

See more details on using hashes here.

File details

Details for the file carsons-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: carsons-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for carsons-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 99fdf6912ba08bd795a30c13555cc297732d3129ece8a927582d55454c89fc1f
MD5 7df1b1037e5769b70ca1648a46d723c1
BLAKE2b-256 b37ef63ba271dd834f3740e87296644284ae3315f24bab172abb145384c5a89a

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