Skip to content

Commit

Permalink
FEATURE: Admittance solver (#41)
Browse files Browse the repository at this point in the history
* init push of admittance

* center tap and 3w

* gfli and gfmi models added

* generators added and lag 2 transformer

* gfli test added

* Fixes for 123 bus mod

* test cases updated

* fixes from merge

* inverter test models added and phases added to components

* quick fix in inverter model

* fix to d-d transformers

* update to gfli model

* Update CHANGELOG.md

* FIX: broken unit test

incorrect capitalization

* FIX: capitalization issue in filename

* FIX: Project.toml

* FIX: PMD v15 dss issues

* REF: julia formater

* Bump version

* FIX: documentation workflow

---------

Co-authored-by: Jose Enrique Tabarez <[email protected]>
Co-authored-by: jtabarez <[email protected]>
  • Loading branch information
3 people authored Sep 23, 2024
1 parent 2012971 commit 0070331
Show file tree
Hide file tree
Showing 64 changed files with 975,681 additions and 936 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/deploydocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["gh-pages"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: 'gh-pages'
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: '.'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
4 changes: 2 additions & 2 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Documenter
name: Documentation
on:
push:
branches: [master]
Expand All @@ -11,7 +11,7 @@ jobs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-docdeploy@latest
env:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

- none

## v0.6.0

- Fixed solver and removed the z-matrix to handle larger problems
- The solver was updated to be more stable with larger problems
- Started to add fault controls to inverters for positive and zero sequence currents

## v0.5.3

- Add compatibility for PowerModelsDistribution v0.15
Expand Down
5 changes: 4 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
name = "PowerModelsProtection"
uuid = "719c1aef-945b-435a-a240-4c2992e5e0df"
authors = ["Art Barnes", "Jose Tabarez"]
version = "0.5.3"
version = "0.6.0"

[deps]
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
InfrastructureModels = "2030c09a-7f63-5d83-885d-db604e0e9cc0"
Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
PowerModels = "c36e90e8-916a-50a6-bd94-075b64ef4655"
PowerModelsDistribution = "d7431456-977f-11e9-2de3-97ff7677985e"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"

[compat]
Expand Down
8 changes: 8 additions & 0 deletions src/PowerModelsProtection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ module PowerModelsProtection
import PowerModelsDistribution: ENABLED, DISABLED

import Graphs
import SparseArrays
const _SP = SparseArrays
import JSON

include("core/types.jl")
include("core/admittance_matrix.jl")
include("core/variable.jl")
include("core/constraint_template.jl")
include("core/constraint.jl")
Expand All @@ -29,19 +34,22 @@ module PowerModelsProtection

include("data_model/units.jl")
include("data_model/components.jl")
include("data_model/eng2math_pmd.jl")
include("data_model/eng2math.jl")
include("data_model/math2eng.jl")
include("data_model/helper_functions.jl")
include("data_model/operation.jl")
include("data_model/cts.jl")
include("data_model/fuses.jl")
include("data_model/relays.jl")
include("data_model/utils.jl")

include("io/common.jl")
include("io/dss/dss2eng.jl")
include("io/matpower.jl")
include("io/opendss.jl")

include("prob/common.jl")
include("prob/fs.jl")
include("prob/fs_mc.jl")
include("prob/pf_mc.jl")
Expand Down
805 changes: 805 additions & 0 deletions src/core/admittance_matrix.jl

Large diffs are not rendered by default.

60 changes: 60 additions & 0 deletions src/core/data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -463,3 +463,63 @@ function zero_gen_setpoints!(data::Dict{String,<:Any})
end
end
end


"""
function to calculate line parameters based of carson's equation 1st term only
"""
function calc_line_paramters!(line::Dict{String,<:Any}, data_dss::Dict{String,<:Any})
if length(line["rs"]) != length(line["f_connections"])^2
nothing
end
end


function add_pre_fault!(pre_v, model::AdmittanceModel)
add_pre_fault_bus_voltage!(pre_v, model)
add_pre_fault_gfli_current!(pre_v, model)
end


function add_pre_fault_bus_voltage!(pre_v, model::AdmittanceModel)
for (_, bus) in model.data["bus"]
_v = zeros(Complex{Float64}, 1, length(bus["terminals"]))
for (i, j) in enumerate(bus["terminals"])
if haskey(model.data["admittance_map"], (bus["bus_i"], j))
_v[1, i] = pre_v[model.data["admittance_map"][(bus["bus_i"], j)], 1]
end
end
bus["pre_fault"] = _v
end
end

function add_pre_fault_gfli_current!(pre_v, model::AdmittanceModel)
for (_, gen) in model.data["gen"]
if gen["element"] == SolarElement
transformer = model.data["transformer"][gen["transformer_id"]]
if gen["phases"] == 3
f_bus = transformer["f_bus"]
t_bus = transformer["t_bus"]
y = transformer["p_matrix"]
n = size(y)[1]
_v = zeros(Complex{Float64}, n, 1)
for (i, j) in enumerate(transformer["f_connections"])
if haskey(model.data["admittance_map"], (f_bus, j))
_v[i, 1] = pre_v[model.data["admittance_map"][(f_bus, j)], 1]
else
_v[i, 1] = 0.0 + 0.0im
end
end
for (i, j) in enumerate(transformer["t_connections"])
if haskey(model.data["admittance_map"], (t_bus, j))
_v[i+length(transformer["t_connections"]), 1] = pre_v[model.data["admittance_map"][(t_bus, j)], 1]
else
_v[i+length(transformer["t_connections"]), 1] = 0.0 + 0.0im
end
end
_i = y * _v
gen["pre_fault"] = _i
end
end
end
end
Loading

2 comments on commit 0070331

@pseudocubic
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/115770

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.0 -m "<description of version>" 00703312884981cb9e585ce37fab5deb87c2ac6f
git push origin v0.6.0

Please sign in to comment.