Skip to content

Commit

Permalink
Update /src/PowerModelsMCDC.jl
Browse files Browse the repository at this point in the history
- Remove unnecessary `__precompile__` statement. Julia packages are precompilable by default since 2018: <JuliaLang/julia#26991>.
- Update `import` statements. The `import ... as` syntax has been introduced in Julia 1.6.
- Update comments.
  • Loading branch information
matteorossini committed Jun 6, 2023
1 parent 5d3c90b commit 9aa8aa3
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 21 deletions.
30 changes: 14 additions & 16 deletions src/PowerModelsMCDC.jl
Original file line number Diff line number Diff line change
@@ -1,35 +1,32 @@
isdefined(Base, :__precompile__) && __precompile__()

module PowerModelsMCDC

# import Compat
import JuMP

## Imports

import Memento
import PowerModels
# import PowerModelsACDC
const _PM = PowerModels
# const _PMACDC = PowerModelsACDC
import InfrastructureModels
# import InfrastructureModels: ids, ref, var, con, sol, nw_ids, nws, optimize_model!, @im_fields
const _IM = InfrastructureModels
import JuMP
import InfrastructureModels as _IM
import PowerModels as _PM


## Memento settings

# Create our module level logger (this will get precompiled)
const _LOGGER = Memento.getlogger(@__MODULE__)

# Register the module level logger at runtime so that folks can access the logger via `getlogger(PowerModels)`
# NOTE: If this line is not included then the precompiled `_PM._LOGGER` won't be registered at runtime.
# Register the module level logger at runtime so that folks can access the logger via `getlogger(PowerModelsMCDC)`
# NOTE: If this line is not included then the precompiled `PowerModelsMCDC._LOGGER` won't be registered at runtime.
__init__() = Memento.register(_LOGGER)

# include("prob/mcdcopf.jl")

## Includes

include("core/solution.jl")
include("core/data.jl")
include("core/base.jl")
include("core/constraint.jl")
include("core/objective.jl")
include("core/relaxation_scheme.jl")
# include("core/multi_conductor_functions.jl")
include("core/new_multi_conductor_functions.jl")
include("core/constraint_template.jl")
include("core/variable_mcdcgrid.jl")
Expand All @@ -41,11 +38,12 @@ include("formconv/dcp.jl")
include("formdcgrid/acp.jl")
include("formconv/acp.jl")

# include("prob/acdcopf.jl")
include("prob/mcdcopf.jl")
include("prob/mcdcpf.jl")


## Exports

# The following items are exported for user-friendlyness when calling
# `using PowerModelsMCDC`, so that users do not need to import JuMP to use a solver with
# PowerModelsMCDC.
Expand Down
2 changes: 1 addition & 1 deletion src/core/multi_conductor_functions.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# "Transforms single-conductor network data into multi-conductor data"
# function make_multiconductor!(data::Dict{String,<:Any}, conductors::Int)
# if InfrastructureModels.ismultinetwork(data)
# if _IM.ismultinetwork(data)
# for (i,nw_data) in data["nw"]
# _make_multiconductor!(nw_data, conductors)
# end
Expand Down
2 changes: 1 addition & 1 deletion src/core/new_multi_conductor_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

"Transforms single-conductor network data into multi-conductor data"
function make_multiconductor_new!(data::Dict{String,<:Any})
if InfrastructureModels.ismultinetwork(data)
if _IM.ismultinetwork(data)
for (i,nw_data) in data["nw"]
_make_multiconductor!(nw_data)
end
Expand Down
4 changes: 2 additions & 2 deletions src/formconv/wr.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
function constraint_voltage_product_converter(pm::_PM.AbstractWRModel, wr, wi, w_fr, w_to)
InfrastructureModels.relaxation_complex_product(pm.model, w_fr, w_to, wr, wi)
_IM.relaxation_complex_product(pm.model, w_fr, w_to, wr, wi)
end

function constraint_voltage_product_converter(pm::_PM.AbstractWRConicModel, wr, wi, w_fr, w_to)
InfrastructureModels.relaxation_complex_product_conic(pm.model, w_fr, w_to, wr, wi)
_IM.relaxation_complex_product_conic(pm.model, w_fr, w_to, wr, wi)
end
"""
Links converter power & current
Expand Down
2 changes: 1 addition & 1 deletion src/io/multinetwork.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function multinetwork_data(sn_data::Dict{String,Any}, extradata::Dict{String,Any}, global_keys::Set{String})
count = extradata["dim"]
if InfrastructureModels.ismultinetwork(sn_data)
if _IM.ismultinetwork(sn_data)
error("replicate can only be used on single networks")
end

Expand Down

0 comments on commit 9aa8aa3

Please sign in to comment.