Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
b069812
Scratch code to implement uc file
SanjayJohnson02 Apr 15, 2025
dad7bc2
began to build parser, up to dc_branch
SanjayJohnson02 Apr 24, 2025
2071d41
updated parser
SanjayJohnson02 Apr 29, 2025
20296bd
Finished static parser, incorporating time
SanjayJohnson02 May 1, 2025
1d95395
Updated parser, added time sets
SanjayJohnson02 May 8, 2025
408cf38
Added subsets of T
SanjayJohnson02 May 13, 2025
71d370c
Finished static parser with all extra sets
SanjayJohnson02 May 14, 2025
1b4c823
Integrated parser into scopf.jl, fixed parser to work w CuArray, ac_b…
SanjayJohnson02 May 14, 2025
5e58440
New sets, CUDA compatibility, separation of unneeded linked sets
SanjayJohnson02 May 27, 2025
45e99b1
Built out variables, added constraints to scopf
SanjayJohnson02 May 28, 2025
fe6a4cd
Added constraints, updated w sets in sc_parser
SanjayJohnson02 May 29, 2025
3b77f3b
Added constraints
SanjayJohnson02 May 30, 2025
e5d7f36
Added non objective constraints
SanjayJohnson02 Jun 2, 2025
6e69393
Finished implementation (not working) of scopf
SanjayJohnson02 Jun 3, 2025
80cb92a
Corrected objective bug, gpu version working no contingency
SanjayJohnson02 Jun 4, 2025
938fc5d
Built contingency constraints (not working)
SanjayJohnson02 Jun 6, 2025
ee79386
Fixed bugs in contingencies, working scopf on gpu
SanjayJohnson02 Jun 6, 2025
7976e0b
Merge remote-tracking branch 'origin/main' into security_constrained,…
SanjayJohnson02 Jun 9, 2025
5fed5f5
Condensed code across coordinates for most functions
SanjayJohnson02 Jun 11, 2025
50cfbed
Efficient code for mpopf
SanjayJohnson02 Jun 12, 2025
7756672
updated ci for goc3benchmark
SanjayJohnson02 Jun 12, 2025
ca1472b
updated ci
SanjayJohnson02 Jun 12, 2025
7675f2a
removed force generate sc solution data
SanjayJohnson02 Jun 12, 2025
430b84d
ci update
SanjayJohnson02 Jun 12, 2025
4ebebc2
Added solution formatter
SanjayJohnson02 Jun 17, 2025
b83e7e8
Added initializer, ctg optional
SanjayJohnson02 Jun 18, 2025
5ec8a67
updated start values
SanjayJohnson02 Jun 20, 2025
7c913b3
updated parser
SanjayJohnson02 Jul 1, 2025
4fef255
removed unneeded variables
SanjayJohnson02 Jul 7, 2025
7935407
modified IC to avoid numerical error
Jul 8, 2025
a4bc24c
Streamlining scopf code
SanjayJohnson02 Jul 10, 2025
aa65015
Cleaned up parser
SanjayJohnson02 Jul 11, 2025
b13f71e
Efficiency updates for mpopf with storage
SanjayJohnson02 Jul 30, 2025
c192778
.
SanjayJohnson02 Jul 30, 2025
a19c3bd
.
SanjayJohnson02 Jul 30, 2025
0410c8a
Merge remote-tracking branch 'origin/main' into security_constrained
SanjayJohnson02 Jul 30, 2025
62d9147
updated project
SanjayJohnson02 Jul 30, 2025
deb24b3
ci update
SanjayJohnson02 Jul 30, 2025
c5f81c9
ci update
SanjayJohnson02 Jul 30, 2025
c3cfacc
ci update
SanjayJohnson02 Jul 30, 2025
a071ca5
updated tests for new example function
SanjayJohnson02 Jul 30, 2025
e050ff9
updated per comments
SanjayJohnson02 Aug 5, 2025
40683f9
Readme update
SanjayJohnson02 Aug 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ jobs:
key: compiled-${{ runner.os }}-${{ hashFiles('**/Project.toml') }}-${{ hashFiles('**/Manifest.toml') }}
restore-keys: compiled-${{ runner.os }}-


- name: Install package dependencies
run: |
julia --project=. -e 'using Pkg; Pkg.instantiate(); Pkg.precompile()'
julia --project=. -e 'using Pkg; Pkg.add(PackageSpec(url="https://github.com/lanl-ansi/GOC3Benchmark.jl")); Pkg.instantiate(); Pkg.precompile()'
Copy link
Member

Choose a reason for hiding this comment

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


- name: Check for CUDA availability
id: check-cuda
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
version: '1'
- name: Install dependencies
run: julia --project=docs/ -e 'using Pkg; Pkg.Registry.update(); Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
run: julia --project=docs/ -e 'using Pkg; Pkg.add(PackageSpec(url="https://github.com/lanl-ansi/GOC3Benchmark.jl")); Pkg.Registry.update(); Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate(); Pkg.precompile()'
- name: Build and deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # If authenticating with GitHub Actions token
Expand Down
3 changes: 3 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ PGLib = "07a8691f-3d11-4330-951b-3c50f98338be"
PowerModels = "c36e90e8-916a-50a6-bd94-075b64ef4655"
ExaModels = "1037b233-b668-4ce9-9b63-f9f681f55dd2"
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
GOC3Benchmark = "3a45b339-860d-44d0-a64b-5f943cdd120b"
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"

[compat]
ExaModels = "~0.8"
Expand Down
32 changes: 27 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ ExaModelsPower.jl is an optimal power flow models using ExaModels.jl
## Usage
### Static optimal power flow
```julia
using ExaModelsPower, MadNLP, MadNLPGPU, CUDA
using ExaModelsPower, MadNLP, MadNLPGPU, CUDA, ExaModels, GOC3Benchmark, JSON


model, vars, cons = opf_model(
"pglib_opf_case118_ieee.m";
Expand All @@ -21,11 +22,32 @@ result = madnlp(model; tol=1e-6)

### Security-constrained optimal power flow
```julia
model, vars, cons = scopf_model(
"pglib_opf_case118_ieee.m"; contingencies = [1,2],
#This model is based on the GOC3 formulation of the SCOPF problem
#https://www.pnnl.gov/publications/grid-optimization-competition-challenge-3-problem-formulation

#The current implementation requires a UC solution to be provided, which is then parsed with
#the other input data to generate a structure of named tuples which can then interface with
#ExaModels to generate the full model. We do not make any relaxations or decompositions for this problem

model, sc_data, vars, lengths = scopf_model(
"data/C3E4N00073D1_scenario_303.json", "data/C3E4N00073D1_scenario_303_solution.json";
backend = CUDABackend()
)
result = madnlp(model; tol=1e-6) # currently failing
result = madnlp(model; tol=1e-4)

#Solution from GPU can be used to warm start a CPU solution or vice versa
model_cpu, sc_data, vars, lengths = scopf_model(
"data/C3E4N00073D1_scenario_303.json", "data/C3E4N00073D1_scenario_303_solution.json";
result_set = [result, vars]
)
result_cpu = ipopt(model_cpu; tol=1e-8)

#Additionally, the SC problem can be evaluated without contingencies
model, sc_data, vars, lengths = scopf_model(
"data/C3E4N00073D1_scenario_303.json", "data/C3E4N00073D1_scenario_303_solution.json";
backend = CUDABackend(), include_ctg = false
)
result = madnlp(model; tol=1e-4)
```

### Multi-period optimal power flow
Expand Down Expand Up @@ -59,7 +81,7 @@ result = madnlp(model; tol=1e-6)

#Alternatively, provide a smooth function for the charge/discharge efficiency to remove complementarity constraint
function example_func(d, srating)
return d + .2/srating*d^2
return -((s_rating/2)^d)+1
end

model, vars, cons = mpopf_model(
Expand Down
5 changes: 4 additions & 1 deletion src/ExaModelsPower.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
module ExaModelsPower

import JLD2
import Downloads
import ExaModels: ExaCore, variable, constraint, ExaModel, objective, constraint!, convert_array, solution
import PGLib
import ExaModels: ExaCore, variable, constraint, ExaModel, objective, constraint!, convert_array
import PowerModels


include("parser.jl")
include("opf.jl")
include("scopf.jl")
include("mpopf.jl")
include("constraint.jl")
include("sc_parser.jl")

const NAMES = filter(names(@__MODULE__; all = true)) do x
str = string(x)
Expand Down
Loading
Loading