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

Update case folder structure and examples #640

Merged
merged 24 commits into from
Mar 2, 2024

Conversation

lbonaldo
Copy link
Collaborator

Description

This PR updates the folder structure of a GenX case, and selects the examples for v0.4.
The proposed version is the following:

example_case
│ 
├── settings
│   ├── genx_settings.yml
│   ├── [other solver settings]
│   └── highs_settings.yml
│ 
├── system
│   ├── Demand_data.csv
│   ├── Fuel_data.csv
│   ├── Generators_variability.csv
│   ├── Operational_reserves.csv
│   └── Network.csv
│ 
├── policies
│   ├── CO2_cap.csv
│   ├── Minimum_capacity_requirement.csv
│   └── Energy_share_requirement.csv
│ 
├── resources
│   ├── Thermal.csv
│   ├── Storage.csv
│   ├── Vre.csv
│   ├── Hydro.csv
│   └── policy_assignments
|       ├── Resource_minimum_capacity_requirement.csv
│       └── Resource_energy_share_requirement.csv
│ 
├── TDR_results
├── results
├── README.md
└── Run.jl

Tests and examples have been updated to match the new folder structure, and the naming convention for folders is snake_case, to match the rest the of the source code.

All the current examples can be moved to a separate repository together with the new tutorials: https://github.com/GenXProject/GenX-Tutorials

Please feel free to add any comments or suggestions you may have on this PR.

What type of PR is this? (check all applicable)

  • Feature

Checklist

  • Code changes are sufficiently documented; i.e. new functions contain docstrings and .md files under /docs/src have been updated if necessary.
  • The latest changes on the target branch have been incorporated, so that any conflicts are taken care of before merging. This can be accomplished either by merging in the target branch (e.g. 'git merge develop') or by rebasing on top of the target branch (e.g. 'git rebase develop'). Please do not hesitate to reach out to the GenX development team if you need help with this.
  • Code has been tested to ensure all functionality works as intended.
  • CHANGELOG.md has been updated (if this is a 'notable' change).
  • I consent to the release of this PR's code under the GNU General Public license.

How this can be tested

I ran all the example cases and the tests that are available.

Post-approval checklist for GenX core developers

After the PR is approved

  • Check that the latest changes on the target branch are incorporated, either via merge or rebase
  • Remember to squash and merge if incorporating into develop

Comment on lines 33 to 47
function _get_policyfile_info()
policyfile_info = (
esr = (filename="Resource_energy_share_requirement.csv"),
cap_res = (filename="Resource_capacity_reserve_margin.csv"),
min_cap = (filename="Resource_minimum_capacity_requirement.csv"),
max_cap = (filename="Resource_maximum_capacity_requirement.csv"),
esr = (filename="Resource_energy_share_requirement.csv", setup_param="EnergyShareRequirement"),
cap_res = (filename="Resource_capacity_reserve_margin.csv", setup_param="CapacityReserveMargin"),
min_cap = (filename="Resource_minimum_capacity_requirement.csv", setup_param="MinCapReq"),
max_cap = (filename="Resource_maximum_capacity_requirement.csv", setup_param="MaxCapReq"),
)
return policyfile_info
end
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes me a bit nervous that policy files are being joined one-to-one with policy settings. While right now this is the case, it doesn't seem like a fundamental thing. What if some new policy requires two files?

Comment on lines 10 to 15
if setup["TimeDomainReduction"] == 1 && time_domain_reduced_files_exist(data_directory)
my_dir = data_directory
else
my_dir = path
# If TDR is not used, then use the "system" directory specified in the setup
my_dir = joinpath(path, setup["SystemFolder"])
end
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider making these five lines to construct my_dir be a function (of setup, data_directory, and path I suppose) since they're repeated in load_demand_data, load_fuels_data, load_generators_availability, load_vre_stor_availability.

function validate_policy_files(resource_policies_path::AbstractString, setup::Dict)
policyfile_info = _get_policyfile_info()
for (filename, setup_param) in values(policyfile_info)
if setup[setup_param] == 1 && !isfile(joinpath(resource_policies_path, filename))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.... I hope that we can change policies from 0/1 to false/true in the future. Or for policies with three or more options (looking at U, UCommit) have them be descriptive strings which translate internally into named constants or enums or something.

Comment on lines 1142 to 1148
if isfile(joinpath(case_path, "Generators_data.csv"))
msg = "The `Generators_data.csv` file was deprecated in release v0.4. " *
"Please use the new interface for generators creation, and see the documentation for additional details."
Base.depwarn(msg, :load_resources_data!, force=true)
error("Exiting GenX...")
else
# create vector of resources from dataframes
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you throw an error in the if clause, could the contents of else be moved out of the else and up one indent level? After all, they're on the Happy Path.

@lbonaldo lbonaldo merged commit ab5b0b2 into GenXProject:develop Mar 2, 2024
5 checks passed
@lbonaldo lbonaldo deleted the feature-restr_examples branch June 25, 2024 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants