parent
678e6aa2f5
commit
6e30645084
Binary file not shown.
@ -0,0 +1,38 @@
|
||||
# UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
|
||||
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||
# Released under the modified BSD license. See COPYING.md for more details.
|
||||
|
||||
using DataStructures
|
||||
using JSON
|
||||
|
||||
function _migrate(json)
|
||||
version = json["Parameters"]["Version"]
|
||||
if version === nothing
|
||||
error(
|
||||
"The provided input file cannot be loaded because it does not " *
|
||||
"specify what version of UnitCommitment.jl it was written for. " *
|
||||
"Please modify the \"Parameters\" section of the file and include " *
|
||||
"a \"Version\" entry. For example: {\"Parameters\":{\"Version\":\"0.3\"}}",
|
||||
)
|
||||
end
|
||||
version = VersionNumber(version)
|
||||
version >= v"0.3" || _migrate_to_v03(json)
|
||||
return
|
||||
end
|
||||
|
||||
function _migrate_to_v03(json)
|
||||
# Migrate reserves
|
||||
if json["Reserves"] !== nothing &&
|
||||
json["Reserves"]["Spinning (MW)"] !== nothing
|
||||
amount = json["Reserves"]["Spinning (MW)"]
|
||||
json["Reserves"] = DefaultOrderedDict(nothing)
|
||||
json["Reserves"]["r1"] = DefaultOrderedDict(nothing)
|
||||
json["Reserves"]["r1"]["Type"] = "spinning"
|
||||
json["Reserves"]["r1"]["Amount (MW)"] = amount
|
||||
for (gen_name, gen) in json["Generators"]
|
||||
if gen["Provides spinning reserves?"] == true
|
||||
gen["Reserve eligibility"] = ["r1"]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,18 @@
|
||||
# UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
|
||||
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||
# Released under the modified BSD license. See COPYING.md for more details.
|
||||
|
||||
using UnitCommitment, LinearAlgebra, Cbc, JuMP, JSON, GZip
|
||||
|
||||
@testset "read v0.2" begin
|
||||
instance = UnitCommitment.read("$FIXTURES/ucjl-0.2.json.gz")
|
||||
@test length(instance.reserves_by_name["r1"].amount) == 4
|
||||
@test instance.units_by_name["g2"].reserves[1].name == "r1"
|
||||
end
|
||||
|
||||
@testset "read v0.3" begin
|
||||
instance = UnitCommitment.read("$FIXTURES/ucjl-0.3.json.gz")
|
||||
@test length(instance.units) == 6
|
||||
@test length(instance.buses) == 14
|
||||
@test length(instance.lines) == 20
|
||||
end
|
Loading…
Reference in new issue