Skip to content

Commit

Permalink
feat: Add ReEDS parser to the public version and some Plexos exporter…
Browse files Browse the repository at this point in the history
… fixes (#43)
  • Loading branch information
pesap authored Sep 18, 2024
1 parent e963011 commit d1a61f0
Show file tree
Hide file tree
Showing 77 changed files with 485,947 additions and 195 deletions.
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dependencies = [
"loguru~=0.7.2",
"pandas~=2.2",
"infrasys>=0.1.0",
"plexosdb>=0.0.3",
"plexosdb>=0.0.4",
"polars~=1.1.0",
"pyyaml~=6.0.1",
"rich~=13.7.1",
Expand Down Expand Up @@ -140,6 +140,10 @@ docstring-code-line-length = "dynamic"
pythonpath = [
"src"
]
markers = [
"exporters: Tests related to exporters",
"plexos: Tests related to plexos",
]

[tool.coverage.run]
omit = [
Expand Down
28 changes: 10 additions & 18 deletions src/r2x/cli_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,17 @@ def get_additional_arguments(
plugin_list: List of plugins.
folder: Folder that contains the plugin.
"""
plugin_files = [plugin for plugin in files(folder).rglob("*.py") if "__" not in plugin.name] # type: ignore
for plugin in plugin_files:
plugin_module = importlib.import_module(f".{plugin.stem}", folder)
if hasattr(plugin_module, "cli_arguments"):
plugin_cli_group = parser.add_argument_group(f"Plugin {plugin.stem}")
plugin_module.cli_arguments(plugin_cli_group)
folders = ["r2x.plugins", "r2x.parser", "r2x.exporter"]

for folder in folders:
folder_files = [folder for folder in files(folder).rglob("*.py") if "__" not in folder.name] # type: ignore
package_name = folder.split(".")[1]
for package in folder_files:
package_script = importlib.import_module(f".{package.stem}", folder)
if hasattr(package_script, "cli_arguments"):
script_cli_group = parser.add_argument_group(f"{package_name.upper()}: {package.stem}")
package_script.cli_arguments(script_cli_group)

parser_files = [parser for parser in files("r2x.parser").rglob("*.py")] # type: ignore
for parser_file in parser_files:
parser_module = importlib.import_module(f".{parser_file.stem}", "r2x.parser")
if hasattr(parser_module, "cli_arguments"):
parser_cli_group = parser.add_argument_group(f"Parser {parser_file.stem}")
parser_module.cli_arguments(parser_cli_group)
return parser


Expand Down Expand Up @@ -114,12 +112,6 @@ def base_cli() -> argparse.ArgumentParser:
dest="solve_year",
help="Year to translate",
)
group_cli.add_argument(
"--weather-year",
type=int,
dest="weather_year",
help="Year to translate",
)
group_cli.add_argument(
"--scenario",
dest="scenario_name",
Expand Down
42 changes: 21 additions & 21 deletions src/r2x/defaults/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -227,39 +227,39 @@
"interface_max_ramp_up_multiplier": 0.1,
"load_participation_factor": 1,
"load_reserves": {
"Flexibility": 0.0,
"Regulation": 0.01,
"Spinning": 0.03
"FLEXIBILITY": 0.0,
"REGULATION": 0.01,
"SPINNING": 0.03
},
"load_scalar": 1,
"max_volume_divisor": 1000.0,
"min_soc": 0.1,
"reserve_duration": {
"Flexibility": 3600,
"Regulation": 3600,
"Spinning": 3600
"FLEXIBILITY": 3600,
"REGULATION": 3600,
"SPINNING": 3600
},
"reserve_is_enabled": -1,
"reserve_load_risk": {
"Flexibility": 0,
"Regulation": 1,
"Spinning": 3
"FLEXIBILITY": 0,
"REGULATION": 1,
"SPINNING": 3
},
"reserve_mutually_exclusive": 1,
"reserve_time_frame": {
"Flexibility": 600,
"Regulation": 1200,
"Spinning": 300
"FLEXIBILITY": 600,
"REGULATION": 1200,
"SPINNING": 300
},
"reserve_vors": {
"Flexibility": 390000,
"Regulation": 410000,
"Spinning": 400000
"FLEXIBILITY": 390000,
"REGULATION": 410000,
"SPINNING": 400000
},
"solar_reserves": {
"Flexibility": 0.04,
"Regulation": 0.003,
"Spinning": 0
"FLEXIBLILITY": 0.04,
"REGULATION": 0.003,
"SPINNING": 0
},
"storage_mean_time_to_repair": 24,
"tech_map": {},
Expand Down Expand Up @@ -287,8 +287,8 @@
"wheeling_charge": 0.001,
"wheeling_charge_back": 0.001,
"wind_reserves": {
"Flexibility": 0.1,
"Regulation": 0.05,
"Spinning": 0
"FLEXIBILITY": 0.1,
"REGULATION": 0.05,
"SPINNING": 0
}
}
Loading

0 comments on commit d1a61f0

Please sign in to comment.