-
Notifications
You must be signed in to change notification settings - Fork 4
Andromede V1 model validation #89
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need a time and scenario-dependent efficiency for the electrolyzer ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not for the moment, I changed this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe rename the file to test_andromede_v1_models
to refer to the library name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As all results file are in the results
directory, you may remove _results
from the file name for conciseness
# | ||
# This file is part of the Antares project. | ||
|
||
# Study Cluster Validation 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain what you try to validate (that is different from validation_2 and validation_3) ?
@pytest.mark.parametrize( | ||
"system_file, optim_result_file, timespan, batch, relative_accuracy, results_dir, systems_dir, series_dir", | ||
[ | ||
( | ||
"dsr_validation.yml", | ||
"dsr_case_results.csv", | ||
168, | ||
20, | ||
1e-6, | ||
"tests/e2e/models/results/", | ||
"tests/e2e/models/systems/", | ||
"tests/e2e/models/series/", | ||
), | ||
( | ||
"base_validation.yml", | ||
"base_case_results.csv", | ||
168, | ||
20, | ||
1e-6, | ||
"tests/e2e/models/results/", | ||
"tests/e2e/models/systems/", | ||
"tests/e2e/models/series/", | ||
), | ||
( | ||
"electrolyser_validation.yml", | ||
"electrolyser_case_results.csv", | ||
168, | ||
20, | ||
1e-6, | ||
"tests/e2e/models/results/", | ||
"tests/e2e/models/systems/", | ||
"tests/e2e/models/series/", | ||
), | ||
( | ||
"storage_validation.yml", | ||
"storage_case_results.csv", | ||
168, | ||
20, | ||
1e-6, | ||
"tests/e2e/models/results/", | ||
"tests/e2e/models/systems/", | ||
"tests/e2e/models/series/", | ||
), | ||
( | ||
"bde_system.yml", | ||
"bde_case_results.csv", | ||
168, | ||
20, | ||
1e-6, | ||
"tests/e2e/models/results/", | ||
"tests/e2e/models/systems/", | ||
"tests/e2e/models/series/", | ||
), | ||
( | ||
"cluster_validation_1.yml", | ||
"cluster_testing1_results.csv", | ||
168, | ||
20, | ||
1e-6, | ||
"tests/e2e/models/results/", | ||
"tests/e2e/models/systems/", | ||
"tests/e2e/models/series/", | ||
), | ||
( | ||
"cluster_validation_2.yml", | ||
"cluster_testing2_results.csv", | ||
168, | ||
20, | ||
1e-4, # Default Fico XPRESS Tolerance | ||
"tests/e2e/models/results/", | ||
"tests/e2e/models/systems/", | ||
"tests/e2e/models/series/", | ||
), | ||
], | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pytest.mark.parametrize( | |
"system_file, optim_result_file, timespan, batch, relative_accuracy, results_dir, systems_dir, series_dir", | |
[ | |
( | |
"dsr_validation.yml", | |
"dsr_case_results.csv", | |
168, | |
20, | |
1e-6, | |
"tests/e2e/models/results/", | |
"tests/e2e/models/systems/", | |
"tests/e2e/models/series/", | |
), | |
( | |
"base_validation.yml", | |
"base_case_results.csv", | |
168, | |
20, | |
1e-6, | |
"tests/e2e/models/results/", | |
"tests/e2e/models/systems/", | |
"tests/e2e/models/series/", | |
), | |
( | |
"electrolyser_validation.yml", | |
"electrolyser_case_results.csv", | |
168, | |
20, | |
1e-6, | |
"tests/e2e/models/results/", | |
"tests/e2e/models/systems/", | |
"tests/e2e/models/series/", | |
), | |
( | |
"storage_validation.yml", | |
"storage_case_results.csv", | |
168, | |
20, | |
1e-6, | |
"tests/e2e/models/results/", | |
"tests/e2e/models/systems/", | |
"tests/e2e/models/series/", | |
), | |
( | |
"bde_system.yml", | |
"bde_case_results.csv", | |
168, | |
20, | |
1e-6, | |
"tests/e2e/models/results/", | |
"tests/e2e/models/systems/", | |
"tests/e2e/models/series/", | |
), | |
( | |
"cluster_validation_1.yml", | |
"cluster_testing1_results.csv", | |
168, | |
20, | |
1e-6, | |
"tests/e2e/models/results/", | |
"tests/e2e/models/systems/", | |
"tests/e2e/models/series/", | |
), | |
( | |
"cluster_validation_2.yml", | |
"cluster_testing2_results.csv", | |
168, | |
20, | |
1e-4, # Default Fico XPRESS Tolerance | |
"tests/e2e/models/results/", | |
"tests/e2e/models/systems/", | |
"tests/e2e/models/series/", | |
), | |
], | |
) | |
@pytest.fixture | |
def data_dir() -> Path: | |
return Path(__file__).parent | |
@pytest.fixture | |
def results_dir(data_dir: Path) -> Path: | |
return data_dir / "results" | |
@pytest.fixture | |
def systems_dir(data_dir: Path) -> Path: | |
return data_dir / "systems" | |
@pytest.fixture | |
def series_dir(data_dir: Path) -> Path: | |
return data_dir / "series" | |
@pytest.mark.parametrize( | |
"system_file, optim_result_file, timespan, batch, relative_accuracy", | |
[ | |
( | |
"dsr_validation.yml", | |
"dsr_case_results.csv", | |
168, | |
20, | |
1e-6, | |
), | |
( | |
"base_validation.yml", | |
"base_case_results.csv", | |
168, | |
20, | |
1e-6, | |
), | |
( | |
"electrolyser_validation.yml", | |
"electrolyser_case_results.csv", | |
168, | |
20, | |
1e-6, | |
), | |
( | |
"storage_validation.yml", | |
"storage_case_results.csv", | |
168, | |
20, | |
1e-6, | |
), | |
( | |
"bde_system.yml", | |
"bde_case_results.csv", | |
168, | |
20, | |
1e-6, | |
), | |
( | |
"cluster_validation_1.yml", | |
"cluster_testing1_results.csv", | |
168, | |
20, | |
1e-6, | |
), | |
( | |
"cluster_validation_2.yml", | |
"cluster_testing2_results.csv", | |
168, | |
20, | |
1e-4, # Default Fico XPRESS Tolerance | |
), | |
], | |
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thank you for the suggestion
) -> None: | ||
scenarios = 1 | ||
|
||
with open(systems_dir + system_file) as compo_file: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with open(systems_dir + system_file) as compo_file: | |
with open(systems_dir / system_file) as compo_file: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
network = build_network(components_input) | ||
|
||
reference_values = pd.read_csv( | ||
results_dir + optim_result_file, header=None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
results_dir + optim_result_file, header=None | |
results_dir / optim_result_file, header=None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
with open( | ||
"src/andromede/libs/antares_historic/antares_historic.yml" | ||
) as lib_file1: | ||
with open( | ||
"src/andromede/libs/reference_models/andromede_v1_models.yml" | ||
) as lib_file2: | ||
input_libraries = [ | ||
parse_yaml_library(lib_file1), | ||
parse_yaml_library(lib_file2), | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with open( | |
"src/andromede/libs/antares_historic/antares_historic.yml" | |
) as lib_file1: | |
with open( | |
"src/andromede/libs/reference_models/andromede_v1_models.yml" | |
) as lib_file2: | |
input_libraries = [ | |
parse_yaml_library(lib_file1), | |
parse_yaml_library(lib_file2), | |
] | |
with open( | |
"src/andromede/libs/antares_historic/antares_historic.yml" | |
) as lib_file1: | |
lib_historic = parse_yaml_library(lib_file1) | |
with open( | |
"src/andromede/libs/reference_models/andromede_v1_models.yml" | |
) as lib_file2: | |
lib_v1 = parse_yaml_library(lib_file2) | |
input_libraries = [ | |
parse_yaml_library(lib_file1), | |
parse_yaml_library(lib_file2), | |
] |
You should put under the with
only the code that needs to have the files open, as when we exit the with
part the file is closed. In the current state, the two files stay open for the run
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
) -> None: | ||
scenarios = 1 | ||
|
||
with open(systems_dir / system_file) as compo_file: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only put input_component = parse_yaml_components(compo_file)
under this with
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
with open( | ||
"src/andromede/libs/antares_historic/antares_historic.yml" | ||
) as lib_file1: | ||
lib_historic = parse_yaml_library(lib_file1) | ||
with open( | ||
"src/andromede/libs/reference_models/andromede_v1_models.yml" | ||
) as lib_file2: | ||
lib_v1 = parse_yaml_library(lib_file2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the libs are the same in all tests, I would make fixtures of them
@pytest.fixture
def lib_historic() -> InputLibrary:
with open(
"src/andromede/libs/antares_historic/antares_historic.yml"
) as lib_file1:
lib_historic = parse_yaml_library(lib_file1)
return lib_historic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
No description provided.