{"id":34086994,"url":"https://github.com/opusonesolutions/carsons","last_synced_at":"2026-04-06T06:32:19.861Z","repository":{"id":48781061,"uuid":"152787517","full_name":"opusonesolutions/carsons","owner":"opusonesolutions","description":"Python Implementation Of Carson's Equations","archived":false,"fork":false,"pushed_at":"2025-04-15T21:06:47.000Z","size":135,"stargazers_count":19,"open_issues_count":7,"forks_count":7,"subscribers_count":6,"default_branch":"main","last_synced_at":"2026-01-02T15:47:33.917Z","etag":null,"topics":["cables","hacktoberfest","impedance"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/opusonesolutions.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-10-12T17:44:38.000Z","updated_at":"2025-06-16T16:55:29.000Z","dependencies_parsed_at":"2025-04-09T17:36:08.577Z","dependency_job_id":null,"html_url":"https://github.com/opusonesolutions/carsons","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/opusonesolutions/carsons","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opusonesolutions%2Fcarsons","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opusonesolutions%2Fcarsons/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opusonesolutions%2Fcarsons/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opusonesolutions%2Fcarsons/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opusonesolutions","download_url":"https://codeload.github.com/opusonesolutions/carsons/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opusonesolutions%2Fcarsons/sbom","scorecard":{"id":711342,"data":{"date":"2025-08-11","repo":{"name":"github.com/opusonesolutions/carsons","commit":"d44bfa08702ef07623249d168a57cafd8ceec98a"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":8,"reason":"Found 8/9 approved changesets -- score normalized to 8","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-package.yaml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/opusonesolutions/carsons/python-package.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-package.yaml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/opusonesolutions/carsons/python-package.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-package.yaml:61: update your workflow using https://app.stepsecurity.io/secureworkflow/opusonesolutions/carsons/python-package.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-package.yaml:63: update your workflow using https://app.stepsecurity.io/secureworkflow/opusonesolutions/carsons/python-package.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-package.yaml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/opusonesolutions/carsons/python-package.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-package.yaml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/opusonesolutions/carsons/python-package.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-publish.yaml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/opusonesolutions/carsons/python-publish.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-publish.yaml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/opusonesolutions/carsons/python-publish.yaml/main?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/python-package.yaml:25","Warn: pipCommand not pinned by hash: .github/workflows/python-package.yaml:40","Warn: pipCommand not pinned by hash: .github/workflows/python-package.yaml:73","Warn: pipCommand not pinned by hash: .github/workflows/python-package.yaml:74","Warn: pipCommand not pinned by hash: .github/workflows/python-publish.yaml:31","Warn: pipCommand not pinned by hash: .github/workflows/python-publish.yaml:32","Info:   0 out of   8 GitHub-owned GitHubAction dependencies pinned","Info:   1 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   6 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/python-package.yaml:1","Warn: no topLevel permission defined: .github/workflows/python-publish.yaml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/python-publish.yaml:16"],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-22T08:17:10.906Z","repository_id":48781061,"created_at":"2025-08-22T08:17:10.906Z","updated_at":"2025-08-22T08:17:10.906Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31463014,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T21:22:52.476Z","status":"online","status_checked_at":"2026-04-06T02:00:07.287Z","response_time":112,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cables","hacktoberfest","impedance"],"created_at":"2025-12-14T13:35:36.632Z","updated_at":"2026-04-06T06:32:19.846Z","avatar_url":"https://github.com/opusonesolutions.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"carsons\n=======\n\n[![latest release on pypi](https://badge.fury.io/py/carsons.svg)](https://badge.fury.io/py/carsons)\n[![versons of python supported by carsons](https://img.shields.io/pypi/pyversions/carsons.svg)](https://pypi.python.org/pypi/carsons)\n[![GitHub license](https://img.shields.io/github/license/opusonesolutions/carsons.svg)](https://github.com/opusonesolutions/carsons/blob/main/LICENSE.txt)\n\nThis is an implementation of Carson's Equations, a mathematical model\nfor deriving the equivalent impedance of an AC transmission or\ndistribution line.\n\nImplementation\n--------------\n\n`carsons` is developed using python 3.6 support for unicode characters\nlike π, ƒ, ρ, μ, ω etc. This feature allows us to avoid translating the\nproblem into a more typical programming syntax, so the code is dense and\ncan easily be compared to published formulations of the problem.\n\nFor example, we implement the kron reduction, a matrix decomposition\nstep, using unicode notation to indicate the slightly different meaning\nof impedance values before and after a kron reduction:\n\n```python\ndef perform_kron_reduction(z_primitive):\n     Ẑpp, Ẑpn = z_primitive[0:3, 0:3], z_primitive[0:3, 3:]\n     Ẑnp, Ẑnn = z_primitive[3:,  0:3], z_primitive[3:,  3:]\n     Z_abc = Ẑpp - Ẑpn @ inv(Ẑnn) @ Ẑnp\n     return Z_abc\n```\n\nTake a look at the [source\ncode](https://github.com/opusonesolutions/carsons/blob/add-documentation/carsons/carsons.py)\nto see more cool unicode tricks!\n\nInstallation\n------------\n\n```bash\n~/$ pip install carsons\n```\n\nUsage\n-----\n\nCarsons model requires a line model object that maps each phase to\nproperties of the conductor for that phase.\n\n```python\nfrom carsons import CarsonsEquations, calculate_impedance\n\nclass Line:\n   geometric_mean_radius: {\n       'A': geometric_mean_radius_A in meters\n       ...\n   }\n   resistance: {\n        'A': per-length resistance of conductor A in ohms/meters\n        ...\n   }\n   wire_positions: {\n        'A': (x, y) cross-sectional position of the conductor in meters\n        ...\n   }\n   phases: {'A', ... }\n     # map of phases 'A', 'B', 'C' and 'N\u003c\u003e' which are described in the\n     # gmr, r and phase_positions attributes\n\nline_impedance = calculate_impedance(CarsonsEquations(Line()))\n```\n\nThe model supports any combination of ABC phasings (for example BC, BCN\netc...) including systems with multiple neutral cables; any phases that\nare not present in the model will have zeros in the columns and rows\ncorresponding to that phase.\n\nMultiple neutrals are supported, as long as they have unique labels\nstarting with `N` (e.g. `Neutral1`, `Neutral2`).\n\nIntermediate results such as primitive impedance matrix are also\navailable.\n\n```python\nz_primitive = CarsonsEquations(Line()).build_z_primitive()\n```\n\nFor examples of how to use the model, see the [overhead wire\ntests](https://github.com/opusonesolutions/carsons/blob/main/tests/test_overhead_line.py).\n\n`carsons` is tested against several cable configurations from the [IEEE\ntest feeders](http://sites.ieee.org/pes-testfeeders/resources/), as well as\nexamples from  EPRI's [OpenDSS documentation](http://svn.code.sf.net/p/electricdss/code/trunk/Distrib/Doc/TechNote%20CableModelling.pdf).\n\n### Concentric Neutral Cable\n\n`carsons` also supports modelling of concentric neutral cables of any\nphasings. Its usage is very similar to the example above, only requiring\na few more parameters about the neutral conductors in the line model\nobject.\n\n```python\nfrom carsons import (ConcentricNeutralCarsonsEquations,\n                     calculate_impedance)\n\nclass Cable:\n   resistance: {\n       'A': per-length resistance of conductor A in ohm/meters\n       ...\n   }\n   geometric_mean_radius: {\n       'A': geometric mean radius of conductor A in meters\n       ...\n   }\n   wire_positions: {\n        'A': (x, y) cross-sectional position of conductor A in meters\n        ...\n   }\n   phases: {'A', 'NA', ... }\n   neutral_strand_gmr: {\n       'NA': neutral strand gmr of phase A in meters\n       ...\n   }\n   neutral_strand_resistance: {\n       'NA': neutral strand resistance of phase A in ohm/meters\n       ...\n   }\n   neutral_strand_diameter: {\n       'NA': neutral strand diameter of phase A in meters\n       ...\n   }\n   diameter_over_neutral: {\n       'NA': diameter over neutral of phase A in meters\n       ...\n   }\n   neutral_strand_count: {\n       'NA': neutral strand count of phase A\n       ...\n   }\n\ncable_impedance = calculate_impedance(ConcentricNeutralCarsonsEquations(Cable()))\n```\n\nFor examples of how to use the model, see the [concentric cable\ntests](https://github.com/opusonesolutions/carsons/blob/main/tests/test_concentric_neutral_cable.py).\n\n### Multi-Conductor Cable\n\n`carsons` also supports modelling of phased duplex, triplex, quadruplex cables and triplex secondary.\nIt only requires a few more parameters to describe cable's geometry.\n\n```python\nfrom carsons import (MultiConductorCarsonsEquations,\n                     calculate_impedance)\n\nclass Cable:\n    resistance: {\n        'A': per-length resistance of conductor A in ohm/meters\n        ...\n    }\n    geometric_mean_radius: {\n        'A': geometric mean radius of conductor A in meters\n        ...\n    }\n    wire_positions: {\n        'A': (x, y) cross-sectional position of conductor A in meters\n        ...\n    }\n    outside_radius: {\n        'A': outside radius of conductor A, including insulation and jacket thickness\n        ...\n    }\n    insulation_thickness: {\n        'A': insulation thickness of conductor A\n        ...\n    }\n    phases: {'A', ... }\n\ncable_impedance = calculate_impedance(MultiConductorCarsonsEquations(Cable()))\n```\n\nTo model a triplex secondary cable, the inputs should be keyed on secondary conductors `S1` and `S2`. The impedance result\nis a 2 x 2 matrix.\n\n```python\nclass Cable:\n    resistance: {\n        'S1': per-length resistance of conductor S1 in ohm/meters\n        ...\n    }\n    geometric_mean_radius: {\n        'S1': geometric mean radius of conductor S1 in meters\n        ...\n    }\n    wire_positions: {\n        'S1': (x, y) cross-sectional position of conductor S1 in meters\n        ...\n    }\n    outside_radius: {\n        'S1': outside radius of conductor S1, including insulation and jacket thickness\n        ...\n    }\n    insulation_thickness: {\n        'S1': insulation thickness of conductor S1\n        ...\n    }\n    phases: {'S1', ... }\n```\n\nFor examples of how to use the model, see the [multi-conductor cable\ntests](https://github.com/opusonesolutions/carsons/blob/main/tests/test_multi_conductor.py).\n\n\n### Tape Shield Cable\n\n`carsons` also supports modelling of tape shield cables of any\nphasings. Its usage is very similar to the example above, only requiring\na few more parameters about the tape shield conductors in the line model\nobject.\n\n```python\nfrom carsons import (TapeShieldedCableCarsonsEquations,\n                     calculate_impedance)\n\nclass Cable:\n   resistance: {\n       'A': per-length resistance of conductor A in ohm/meters\n       ...\n   }\n   geometric_mean_radius: {\n       'A': geometric mean radius of conductor A in meters\n       ...\n   }\n   wire_positions: {\n        'A': (x, y) cross-sectional position of conductor A in meters\n        ...\n   }\n   phases: {'A', ... }\n   tape_shield_thickness: {\n       'A': thickness of tape shield conductor on phase A cable in meters\n       ...\n   }\n   tape_shield_outer_diameter: {\n       'A': outer diameter of tape shield conductor on phase A cable in meters\n       ...\n   }\n\n\ncable_impedance = calculate_impedance(TapeShieldedCableCarsonsEquations(Cable()))\n```\n\nFor examples of how to use the model, see the [tape shielded cable\ntests](https://github.com/opusonesolutions/carsons/blob/main/tests/test_tape_shielded_cables.py).\n\n\n\n## Problem Description\n-------------------\n\nCarsons equations model an AC transmission or distribution line into an\nequivalent set of phase-phase impedances, which can be used to model the\nline in a power flow analysis.\n\nFor example, say we have a 4-wire system on a utility pole, with `A`,\n`B`, `C` phase conductors as well as a neutral cable N. We know that\nwhen conductors carry electrical current, they exhibit a magnetic field\n--- so its pretty easy to imagine that, e.g., the magnetic field\nproduced by `A` would interact with the `B`, `C`, and `N` conductors.\n\n                            B\n                              O\n                              |\n                              |\n                  A        N  |       C\n                    O        O|         O\n                    ----------|-----------\n                              |\n                              |\n                              |\n                              |\n                              |\n                              |\n                              |\n                              |\n                              |\n                              |\n                              |\n                              |\n                              |\n        ==============[Ground]============================\n        /     /     /     /     /     /     /     /     /\n             /     /     /     /     /     /     /\n                  /     /     /     /     /\n     \n     \n     \n     \n     \n     \n     \n     \n     \n     \n                     A*       N*          C*\n                       0        0           0\n     \n                               B*\n                                 0\n\n    Figure: Cross-section of a 4-wire distribution line, with\n            ground return.\n\nHowever, each conductor also has a ground return path (or 'image') ---\nshown as `A*`, `B*`, `C*`, and `N*` in the figure above --- which is a\nmagnetically induced current path in the ground. When A produces a\nmagnetic field, that field *also* interacts with `B*`, `C*`, `N*`, *and*\n`A*`. Carsons equations model all these interactions and reduce them to\nan equivalent impedance matrix that makes it much easier to model this\nsystem.\n\nIn addition `carsons` implements the kron reduction, a conversion that\napproximates the impedances caused by neutral cables by incorporating\nthem into the impedances for phase `A`, `B`, and `C`. Since most AC and\nDC powerflow formulations don't model the neutral cable, this is a\nvaluable simplification.\n\nReferences\n----------\n\nThe following works were used to produce this formulation:\n\n-   [Leonard L. Grigsby -- Electrical Power Generation, Transmission and\n    Distribution](https://books.google.ca/books?id=XMl8OU4wIEQC\u0026lpg=SA21-PA4\u0026dq=kron%20reduction%20carson%27s%20equation\u0026pg=SA21-PA4#v=onepage\u0026q=kron%20reduction%20carson's%20equation\u0026f=true)\n-   [William H. Kersting -- Distribution System Modelling and Analysis\n    2e](https://books.google.ca/books?id=1R2OsUGSw_8C\u0026lpg=PA84\u0026dq=carson%27s%20equations\u0026pg=PA85#v=onepage\u0026q=carson's%20equations\u0026f=false)\n-   [William H. Kersting, Distribution System Analysis Subcommittee --\n    Radial Distribution Test\n    Feeders](http://sites.ieee.org/pes-testfeeders/files/2017/08/testfeeders.pdf)\n-   [Timothy Vismore -- The Vismor\n    Milieu](https://vismor.com/documents/power_systems/transmission_lines/S2.SS1.php)\n-   [Daniel Van Dommelen, Albert Van Ranst, Robert Poncelet -- GIC\n    Influence on Power Systems calculated by Carson's\n    method](https://core.ac.uk/download/pdf/34634673.pdf)\n-   [Andrea Ballanti, Roger Dugan -- Cable Modelling in OpenDSS](http://svn.code.sf.net/p/electricdss/code/trunk/Distrib/Doc/TechNote%20CableModelling.pdf)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopusonesolutions%2Fcarsons","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopusonesolutions%2Fcarsons","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopusonesolutions%2Fcarsons/lists"}