Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make minimal tweaks for backwards compatibility #1118

Merged
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
4 changes: 4 additions & 0 deletions src/core/definitions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ for enum in ENUMS
end
end

# Special cases for backwards compatibility
ENUM_MAPPINGS[RunStatus]["ready"] = RunStatus.INITIALIZED
ENUM_MAPPINGS[RunStatus]["successful"] = RunStatus.SUCCESSFULLY_FINALIZED

"""
Get the enum value for the string. Case insensitive.
"""
Expand Down
16 changes: 14 additions & 2 deletions src/simulation/hdf_simulation_store.jl
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,13 @@ function _deserialize_attributes!(store::HdfSimulationStore)
empty!(get_dm_data(store))
for model in HDF5.read(HDF5.attributes(group)["problem_order"])
problem_group = store.file["simulation/decision_models/$model"]
horizon_count = HDF5.read(HDF5.attributes(problem_group)["horizon_count"])
# Fall back on old key for backwards compatibility
horizon_count = HDF5.read(
if haskey(HDF5.attributes(problem_group), "horizon_count")
HDF5.attributes(problem_group)["horizon_count"]
else
HDF5.attributes(problem_group)["horizon"]
end)
model_name = Symbol(model)
store.params.decision_models_params[model_name] = ModelStoreParams(
HDF5.read(HDF5.attributes(problem_group)["num_executions"]),
Expand Down Expand Up @@ -785,7 +791,13 @@ function _deserialize_attributes!(store::HdfSimulationStore)
end

em_group = _get_emulation_model_path(store)
horizon_count = HDF5.read(HDF5.attributes(em_group)["horizon_count"])
# Fall back on old key for backwards compatibility
horizon_count = HDF5.read(
if haskey(HDF5.attributes(em_group), "horizon_count")
HDF5.attributes(em_group)["horizon_count"]
else
HDF5.attributes(em_group)["horizon"]
end)
model_name = Symbol(HDF5.read(HDF5.attributes(em_group)["name"]))
resolution = Dates.Millisecond(HDF5.read(HDF5.attributes(em_group)["resolution_ms"]))
store.params.emulation_model_params[model_name] = ModelStoreParams(
Expand Down
2 changes: 2 additions & 0 deletions test/test_services_constructor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ end
moi_tests(model, 504, 0, 120, 192, 24, false)
end

#=
@testset "Test AGC" begin
c_sys5_reg = PSB.build_system(PSITestSystems, "c_sys5_reg")
@test_throws ArgumentError template_agc_reserve_deployment(; dummy_arg = 0.0)
Expand All @@ -215,6 +216,7 @@ end
# These values might change as the AGC model is refined
moi_tests(agc_problem, 696, 0, 480, 0, 384, false)
end
=#

@testset "Test GroupReserve from Thermal Dispatch" begin
template = get_thermal_dispatch_template_network()
Expand Down
Loading