Skip to content

Commit

Permalink
UPD: PowerModelsDistribution v0.15
Browse files Browse the repository at this point in the history
  • Loading branch information
pseudocubic committed Oct 11, 2023
1 parent d2a9272 commit 4435da6
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## staged

- Added support for PowerModelsDistribution v0.15
- Fixed non-deterministic behavior of load block id assignment by introducing SHA1 hash based on the buses in the block

## v3.4.0
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ JuMP = "0.22, 0.23, 1"
Juniper = "0.8, 0.9"
LoggingExtras = "0.4.7, 0.4.9"
PolyhedralRelaxations = "0.3.3, 0.3.4, 0.3.5"
PowerModelsDistribution = "0.14.4, 0.14.9"
PowerModelsDistribution = "0.14.4, 0.14.9, 0.15"
PowerModelsProtection = "0.5.2"
PowerModelsStability = "0.3.2"
Requires = "1.1.3, 1.3"
Expand Down
1 change: 1 addition & 0 deletions src/PowerModelsONM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module PowerModelsONM
# STDLIB
import Dates
import LinearAlgebra
import Pkg
import SHA
import Statistics
import UUIDs
Expand Down
3 changes: 3 additions & 0 deletions src/core/base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ function convert(value::Any, path::Tuple{Vararg{String}}=tuple())
end


if Pkg.dependencies()[UUIDs.UUID("d7431456-977f-11e9-2de3-97ff7677985e")].version < v"0.15.0"
"""
Base.parse(::Type{T}, status::String)::T where T <: PMD.Status
Expand All @@ -223,6 +224,8 @@ function Base.parse(::Type{T}, status::String)::T where T <: PMD.Status
@warn "enabled code '$status' not recognized, defaulting to ENABLED"
return PMD.ENABLED
end
end


"Parses different options for Status enums in the events schema"
Base.parse(::Type{PMD.Status}, status::PMD.Status)::PMD.Status = status
Expand Down
27 changes: 27 additions & 0 deletions src/io/network.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,33 @@ function _dss2eng_protection_locations!(eng::Dict{String,<:Any}, dss::Dict{Strin
end


if Pkg.dependencies()[UUIDs.UUID("d7431456-977f-11e9-2de3-97ff7677985e")].version >= v"0.15.0"
"""
_dss2eng_protection!(
eng::Dict{String,<:Any},
dss::Dict{String,<:Any}
)
Extension function for converting opendss protection into protection objects for protection optimization.
"""
function _dss2eng_protection_locations!(eng::Dict{String,<:Any}, dss::PMD.OpenDssDataModel)
for type in ["relay", "recloser", "fuse"]
if !isempty(get(dss, type, Dict())) && !haskey(eng, type)
eng[type] = Dict{String,Any}()
end

for (id, dss_obj) in get(dss, type, Dict())
if !haskey(eng[type], id)
eng[type][id] = Dict{String,Any}()
end
eng[type][id]["location"] = dss_obj["monitoredobj"]
eng[type][id]["monitor_type"] = string(split(dss_obj["monitoredobj"], ".")[1])
end
end
end
end


const _pnm2eng_objects = Dict{String,Vector{String}}(
"bus" => ["bus"],
"line" => ["line", "switch"],
Expand Down
2 changes: 1 addition & 1 deletion src/stats/microgrid.jl
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ function get_timestep_load_served(dispatch_solution::Dict{String,<:Any}, network
end

for (k,v) in loads_served
loads_served[k] = PMD._replace_nan.(v)
loads_served[k] = map(x -> isnan(x) ? zero(x) : x, v)
end

return loads_served
Expand Down

0 comments on commit 4435da6

Please sign in to comment.