Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ PowerModels.jl Change Log
- Clean up package imports (#961)
- Refactor `test/runtests.jl` (#962) (#965)
- Remove empty docstrings (#963) (#966)
- Add PrecompileTools (#967)

### v0.21.3
- Fix no-buses bug in `calc_connected_components` (#933)
Expand Down
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Memento = "f28f55f0-a522-5efc-85c2-fe41dfb9b2d9"
NLsolve = "2774e3e8-f4cf-5e23-947b-6d7e65073b56"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"

[compat]
Expand All @@ -22,6 +23,7 @@ JuMP = "1.15"
Juniper = "~0.9"
Memento = "~1.0, ~1.1, ~1.2, ~1.3, ~1.4"
NLsolve = "4.0"
PrecompileTools = "1"
SCS = "~0.9, ~1.0, ~2.0"
julia = "1.6"

Expand Down
17 changes: 17 additions & 0 deletions src/PowerModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import JuMP
import LinearAlgebra
import Memento
import NLsolve
import PrecompileTools
import SparseArrays

# Create our module level logger (this will get precompiled)
Expand Down Expand Up @@ -84,6 +85,22 @@ include("util/flow_limit_cuts.jl")
# this must come last to support automated export
include("core/export.jl")

PrecompileTools.@setup_workload begin

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@odow you should turn off the logger in this so that it doesn't print the logs when precompiling. It throws users off

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Hmm okay. Will do. I just assumed people ignored the stuff that happens during precompilation.

case3 = joinpath(dirname(@__DIR__), "test/data/matpower/case3.m")
case9 = joinpath(dirname(@__DIR__), "test/data/matpower/case9.m")
PrecompileTools.@compile_workload begin
for case in [case3, case9]
data = parse_file(case)
_ = instantiate_model(data, ACPPowerModel, build_opf)
_ = instantiate_model(data, ACPPowerModel, build_pf)
_ = instantiate_model(data, DCPPowerModel, build_opf)
_ = instantiate_model(data, DCPPowerModel, build_pf)
end
_ = compute_ac_pf(case9)
_ = compute_dc_pf(case9)
end
end

# Deprecations to be removed in the next breaking release

@deprecate resolve_swithces! resolve_switches!
Expand Down