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

Configure multistage settings #703

Merged
merged 11 commits into from
Jun 28, 2024
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 @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add workflow that ensures that CHANGELOG.md and the version number are updated (#711)
- Print GenX version at startup and export it to disk (#712)
- Added the option to output results with time series reconstructed for the entire year (#700)
- Added default settings in multitage optimization (#703)

## [0.4.0] - 2024-03-18

Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "GenX"
uuid = "5d317b1e-30ec-4ed6-a8ce-8d2d88d7cfac"
authors = ["Bonaldo, Luca", "Chakrabarti, Sambuddha", "Cheng, Fangwei", "Ding, Yifu", "Jenkins, Jesse D.", "Luo, Qian", "Macdonald, Ruaridh", "Mallapragada, Dharik", "Manocha, Aneesha", "Mantegna, Gabe ", "Morris, Jack", "Patankar, Neha", "Pecci, Filippo", "Schwartz, Aaron", "Schwartz, Jacob", "Schivley, Greg", "Sepulveda, Nestor", "Xu, Qingyu", "Zhou, Justin"]
version = "0.4.0-dev.7"
version = "0.4.0-dev.8"

[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Expand Down
1 change: 1 addition & 0 deletions docs/src/Public_API/public_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ GenX.mga
## Multi-stage specific functions

```@docs
GenX.configure_settings_multistage
GenX.configure_multi_stage_inputs
GenX.run_ddp
GenX.write_multi_stage_outputs
Expand Down
4 changes: 2 additions & 2 deletions src/case_runners/case_runner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ end
function run_genx_case_multistage!(case::AbstractString, mysetup::Dict, optimizer::Any)
settings_path = get_settings_path(case)
multistage_settings = get_settings_path(case, "multi_stage_settings.yml") # Multi stage settings YAML file path
mysetup["MultiStageSettingsDict"] = YAML.load(open(multistage_settings))

# merge default settings with those specified in the YAML file
mysetup["MultiStageSettingsDict"] = configure_settings_multistage(multistage_settings)
### Cluster time series inputs if necessary and if specified by the user
if mysetup["TimeDomainReduction"] == 1
tdr_settings = get_settings_path(case, "time_domain_reduction_settings.yml") # Multi stage settings YAML file path
Expand Down
31 changes: 31 additions & 0 deletions src/configure_settings/configure_settings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,34 @@ function configure_writeoutput(output_settings_path::String, settings::Dict)
end
return writeoutput
end

function default_settings_multistage()
Dict{Any, Any}("NumStages" => 3,
"StageLengths" => [10, 10, 10],
"WACC" => 0.045,
"ConvergenceTolerance" => 0.01,
"Myopic" => 1)
end

@doc raw"""
configure_settings_multistage(settings_path::String)

Reads in the settings from the `multi_stage_settings.yml` YAML file and
merges them with the default multistage settings. It then returns the
settings dictionary.

# Arguments
- `settings_path::String`: The path to the multistage settings YAML file.

# Returns
- `settings::Dict`: The multistage settings dictionary.
"""
function configure_settings_multistage(settings_path::String)
println("Configuring Multistage Settings")
model_settings = isfile(settings_path) ? YAML.load(open(settings_path)) : Dict{Any, Any}()
lbonaldo marked this conversation as resolved.
Show resolved Hide resolved

settings = default_settings_multistage()
merge!(settings, model_settings)

return settings
end
2 changes: 1 addition & 1 deletion src/time_domain_reduction/precluster.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function run_timedomainreduction_multistage!(case::AbstractString)
mysetup = configure_settings(genx_settings)
multistage_settings = get_settings_path(case, "multi_stage_settings.yml")

mysetup["MultiStageSettingsDict"] = YAML.load(open(multistage_settings))
mysetup["MultiStageSettingsDict"] = configure_settings_multistage(multistage_settings)

tdr_settings = get_settings_path(case, "time_domain_reduction_settings.yml")
TDRSettingsDict = YAML.load(open(tdr_settings))
Expand Down
Loading