r2x-plexos 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. r2x_plexos-0.1.0/PKG-INFO +91 -0
  2. r2x_plexos-0.1.0/README.md +55 -0
  3. r2x_plexos-0.1.0/pyproject.toml +136 -0
  4. r2x_plexos-0.1.0/src/r2x_plexos/__init__.py +49 -0
  5. r2x_plexos-0.1.0/src/r2x_plexos/config/defaults.json +18 -0
  6. r2x_plexos-0.1.0/src/r2x_plexos/config/file_mapping.json +7 -0
  7. r2x_plexos-0.1.0/src/r2x_plexos/config/master_9.2R6_btu.xml +186158 -0
  8. r2x_plexos-0.1.0/src/r2x_plexos/config.py +34 -0
  9. r2x_plexos-0.1.0/src/r2x_plexos/datafile_handler.py +867 -0
  10. r2x_plexos-0.1.0/src/r2x_plexos/exporter.py +415 -0
  11. r2x_plexos-0.1.0/src/r2x_plexos/models/__init__.py +90 -0
  12. r2x_plexos-0.1.0/src/r2x_plexos/models/base.py +52 -0
  13. r2x_plexos-0.1.0/src/r2x_plexos/models/battery.py +1416 -0
  14. r2x_plexos-0.1.0/src/r2x_plexos/models/collection_property.py +20 -0
  15. r2x_plexos-0.1.0/src/r2x_plexos/models/component.py +92 -0
  16. r2x_plexos-0.1.0/src/r2x_plexos/models/context.py +155 -0
  17. r2x_plexos-0.1.0/src/r2x_plexos/models/datafile.py +26 -0
  18. r2x_plexos-0.1.0/src/r2x_plexos/models/fuel.py +417 -0
  19. r2x_plexos-0.1.0/src/r2x_plexos/models/generator.py +2517 -0
  20. r2x_plexos-0.1.0/src/r2x_plexos/models/interface.py +292 -0
  21. r2x_plexos-0.1.0/src/r2x_plexos/models/line.py +805 -0
  22. r2x_plexos-0.1.0/src/r2x_plexos/models/membership.py +19 -0
  23. r2x_plexos-0.1.0/src/r2x_plexos/models/model.py +198 -0
  24. r2x_plexos-0.1.0/src/r2x_plexos/models/node.py +295 -0
  25. r2x_plexos-0.1.0/src/r2x_plexos/models/property.py +870 -0
  26. r2x_plexos-0.1.0/src/r2x_plexos/models/property_specification.py +311 -0
  27. r2x_plexos-0.1.0/src/r2x_plexos/models/py.typed +0 -0
  28. r2x_plexos-0.1.0/src/r2x_plexos/models/region.py +1054 -0
  29. r2x_plexos-0.1.0/src/r2x_plexos/models/registry.py +115 -0
  30. r2x_plexos-0.1.0/src/r2x_plexos/models/reserve.py +249 -0
  31. r2x_plexos-0.1.0/src/r2x_plexos/models/scenario.py +31 -0
  32. r2x_plexos-0.1.0/src/r2x_plexos/models/simulation_config.py +339 -0
  33. r2x_plexos-0.1.0/src/r2x_plexos/models/storage.py +875 -0
  34. r2x_plexos-0.1.0/src/r2x_plexos/models/timeslice.py +26 -0
  35. r2x_plexos-0.1.0/src/r2x_plexos/models/transformers.py +288 -0
  36. r2x_plexos-0.1.0/src/r2x_plexos/models/utils.py +12 -0
  37. r2x_plexos-0.1.0/src/r2x_plexos/models/variable.py +371 -0
  38. r2x_plexos-0.1.0/src/r2x_plexos/models/zone.py +595 -0
  39. r2x_plexos-0.1.0/src/r2x_plexos/parser.py +1656 -0
  40. r2x_plexos-0.1.0/src/r2x_plexos/plugins.py +31 -0
  41. r2x_plexos-0.1.0/src/r2x_plexos/py.typed +0 -0
  42. r2x_plexos-0.1.0/src/r2x_plexos/sql/scenario_read_order.sql +27 -0
  43. r2x_plexos-0.1.0/src/r2x_plexos/utils_exporter.py +80 -0
  44. r2x_plexos-0.1.0/src/r2x_plexos/utils_mappings.py +41 -0
  45. r2x_plexos-0.1.0/src/r2x_plexos/utils_parser.py +147 -0
  46. r2x_plexos-0.1.0/src/r2x_plexos/utils_plexosdb.py +197 -0
  47. r2x_plexos-0.1.0/src/r2x_plexos/utils_simulation.py +854 -0
@@ -0,0 +1,91 @@
1
+ Metadata-Version: 2.3
2
+ Name: r2x-plexos
3
+ Version: 0.1.0
4
+ Summary: Plexos Models, Parser and Exporter
5
+ Keywords: PLEXOS
6
+ Classifier: Development Status :: 4 - Beta
7
+ Classifier: Intended Audience :: Developers
8
+ Classifier: Intended Audience :: Science/Research
9
+ Classifier: License :: OSI Approved :: BSD License
10
+ Classifier: Topic :: Software Development :: Build Tools
11
+ Classifier: Programming Language :: Python
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: License :: OSI Approved :: BSD License
18
+ Classifier: Natural Language :: English
19
+ Classifier: Operating System :: OS Independent
20
+ Classifier: Topic :: File Formats :: JSON
21
+ Classifier: Topic :: Scientific/Engineering
22
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
23
+ Classifier: Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator
24
+ Classifier: Topic :: Software Development :: Build Tools
25
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
26
+ Classifier: Typing :: Typed
27
+ Requires-Dist: plexosdb>=1.1.3
28
+ Requires-Dist: r2x-core>=0.1.1,<1.0.0
29
+ Requires-Python: >=3.11, <3.14
30
+ Project-URL: Changelog, https://nrel.github.io/r2x-plexos/CHANGELOG.html
31
+ Project-URL: Documentation, https://nrel.github.io/r2x-plexos/
32
+ Project-URL: Homepage, https://github.com/NREL/r2x-plexos
33
+ Project-URL: Issues, https://github.com/NREL/r2x-plexos/issues
34
+ Project-URL: Repository, https://github.com/NREL/r2x-plexos
35
+ Description-Content-Type: text/markdown
36
+
37
+ # r2x-plexos
38
+
39
+ > R2X plug-in for translating to and from PLEXOS XML databases.
40
+ >
41
+ > [![image](https://img.shields.io/pypi/v/r2x.svg)](https://pypi.python.org/pypi/r2x-plexos)
42
+ > [![image](https://img.shields.io/pypi/l/r2x.svg)](https://pypi.python.org/pypi/r2x-plexos)
43
+ > [![image](https://img.shields.io/pypi/pyversions/r2x.svg)](https://pypi.python.org/pypi/r2x-plexos)
44
+ > [![CI](https://github.com/NREL/r2x/actions/workflows/CI.yaml/badge.svg)](https://github.com/NREL/r2x/actions/workflows/ci.yaml)
45
+ > [![codecov](https://codecov.io/gh/NREL/r2x-plexos/branch/main/graph/badge.svg)](https://codecov.io/gh/NREL/r2x-plexos)
46
+ > [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
47
+ > [![Documentation](https://github.com/NREL/r2x-plexos/actions/workflows/docs.yaml/badge.svg?branch=main)](https://nrel.github.io/r2x-plexos/)
48
+ > [![Docstring Coverage](https://nrel.github.io/r2x-plexos/_static/docstr_coverage_badge.svg)](https://nrel.github.io/r2x-plexos/)
49
+
50
+
51
+ R2X PLEXOS plugin for parsing and exporting PLEXOS power system models.
52
+
53
+ ## Quick Start
54
+
55
+ ### Installation
56
+
57
+ ```bash
58
+ uv add r2x-plexos
59
+ ```
60
+
61
+ ### Parsing PLEXOS XML
62
+
63
+ ```python
64
+ from pathlib import Path
65
+ from r2x_core import DataFile, DataStore
66
+ from r2x_plexos import PLEXOSParser, PLEXOSConfig
67
+
68
+ # Parse PLEXOS XML
69
+ config = PLEXOSConfig(model_name="Base", reference_year=2024)
70
+ store = DataStore(path=Path("data"))
71
+ store.add_data(DataFile(name="xml_file", glob="*.xml"))
72
+
73
+ parser = PLEXOSParser(config, store)
74
+ system = parser.build_system()
75
+ ```
76
+
77
+ ## Documentation Sections
78
+
79
+ - [Tutorials](https://nrel.github.io/r2x-plexos/tutorials/) - Step-by-step learning guides
80
+ - [How-To Guides](https://nrel.github.io/r2x-plexos/how-tos/) - Task-focused recipes
81
+ - [Explanations](https://nrel.github.io/r2x-plexos/explanations/) - Architecture and design
82
+ - [References](https://nrel.github.io/r2x-plexos/explanations/references/) - API and configuration reference
83
+
84
+ ## Roadmap
85
+
86
+ If you're curious about what we're working on, check out the roadmap:
87
+
88
+ - [Active issues](https://github.com/NREL/r2x-core/issues?q=is%3Aopen+is%3Aissue+label%3A%22Working+on+it+%F0%9F%92%AA%22+sort%3Aupdated-asc): Issues that we are actively working on.
89
+ - [Prioritized backlog](https://github.com/NREL/r2x-core/issues?q=is%3Aopen+is%3Aissue+label%3ABacklog): Issues we'll be working on next.
90
+ - [Nice-to-have](https://github.com/NREL/r2x-core/labels/Optional): Nice to have features or Issues to fix. Anyone can start working on (please let us know before you do).
91
+ - [Ideas](https://github.com/NREL/r2x-core/issues?q=is%3Aopen+is%3Aissue+label%3AIdea): Future work or ideas for R2X Core.
@@ -0,0 +1,55 @@
1
+ # r2x-plexos
2
+
3
+ > R2X plug-in for translating to and from PLEXOS XML databases.
4
+ >
5
+ > [![image](https://img.shields.io/pypi/v/r2x.svg)](https://pypi.python.org/pypi/r2x-plexos)
6
+ > [![image](https://img.shields.io/pypi/l/r2x.svg)](https://pypi.python.org/pypi/r2x-plexos)
7
+ > [![image](https://img.shields.io/pypi/pyversions/r2x.svg)](https://pypi.python.org/pypi/r2x-plexos)
8
+ > [![CI](https://github.com/NREL/r2x/actions/workflows/CI.yaml/badge.svg)](https://github.com/NREL/r2x/actions/workflows/ci.yaml)
9
+ > [![codecov](https://codecov.io/gh/NREL/r2x-plexos/branch/main/graph/badge.svg)](https://codecov.io/gh/NREL/r2x-plexos)
10
+ > [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
11
+ > [![Documentation](https://github.com/NREL/r2x-plexos/actions/workflows/docs.yaml/badge.svg?branch=main)](https://nrel.github.io/r2x-plexos/)
12
+ > [![Docstring Coverage](https://nrel.github.io/r2x-plexos/_static/docstr_coverage_badge.svg)](https://nrel.github.io/r2x-plexos/)
13
+
14
+
15
+ R2X PLEXOS plugin for parsing and exporting PLEXOS power system models.
16
+
17
+ ## Quick Start
18
+
19
+ ### Installation
20
+
21
+ ```bash
22
+ uv add r2x-plexos
23
+ ```
24
+
25
+ ### Parsing PLEXOS XML
26
+
27
+ ```python
28
+ from pathlib import Path
29
+ from r2x_core import DataFile, DataStore
30
+ from r2x_plexos import PLEXOSParser, PLEXOSConfig
31
+
32
+ # Parse PLEXOS XML
33
+ config = PLEXOSConfig(model_name="Base", reference_year=2024)
34
+ store = DataStore(path=Path("data"))
35
+ store.add_data(DataFile(name="xml_file", glob="*.xml"))
36
+
37
+ parser = PLEXOSParser(config, store)
38
+ system = parser.build_system()
39
+ ```
40
+
41
+ ## Documentation Sections
42
+
43
+ - [Tutorials](https://nrel.github.io/r2x-plexos/tutorials/) - Step-by-step learning guides
44
+ - [How-To Guides](https://nrel.github.io/r2x-plexos/how-tos/) - Task-focused recipes
45
+ - [Explanations](https://nrel.github.io/r2x-plexos/explanations/) - Architecture and design
46
+ - [References](https://nrel.github.io/r2x-plexos/explanations/references/) - API and configuration reference
47
+
48
+ ## Roadmap
49
+
50
+ If you're curious about what we're working on, check out the roadmap:
51
+
52
+ - [Active issues](https://github.com/NREL/r2x-core/issues?q=is%3Aopen+is%3Aissue+label%3A%22Working+on+it+%F0%9F%92%AA%22+sort%3Aupdated-asc): Issues that we are actively working on.
53
+ - [Prioritized backlog](https://github.com/NREL/r2x-core/issues?q=is%3Aopen+is%3Aissue+label%3ABacklog): Issues we'll be working on next.
54
+ - [Nice-to-have](https://github.com/NREL/r2x-core/labels/Optional): Nice to have features or Issues to fix. Anyone can start working on (please let us know before you do).
55
+ - [Ideas](https://github.com/NREL/r2x-core/issues?q=is%3Aopen+is%3Aissue+label%3AIdea): Future work or ideas for R2X Core.
@@ -0,0 +1,136 @@
1
+ [project]
2
+ name = "r2x-plexos"
3
+ version = "0.1.0"
4
+ description = "Plexos Models, Parser and Exporter"
5
+ readme = "README.md"
6
+ requires-python = ">=3.11, <3.14"
7
+ dependencies = [
8
+ "plexosdb>=1.1.3",
9
+ "r2x-core>=0.1.1,<1.0.0",
10
+ ]
11
+ keywords=["PLEXOS"]
12
+ classifiers = [
13
+ "Development Status :: 4 - Beta",
14
+ "Intended Audience :: Developers",
15
+ "Intended Audience :: Science/Research",
16
+ "License :: OSI Approved :: BSD License",
17
+ "Topic :: Software Development :: Build Tools",
18
+ "Programming Language :: Python",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3 :: Only",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Programming Language :: Python :: 3.13",
24
+ "License :: OSI Approved :: BSD License",
25
+ "Natural Language :: English",
26
+ "Operating System :: OS Independent",
27
+ "Topic :: File Formats :: JSON",
28
+ "Topic :: Scientific/Engineering",
29
+ "Topic :: Scientific/Engineering :: Information Analysis",
30
+ "Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator",
31
+ "Topic :: Software Development :: Build Tools",
32
+ "Topic :: Software Development :: Libraries :: Python Modules",
33
+ "Typing :: Typed",
34
+ ]
35
+
36
+ [dependency-groups]
37
+ dev = [
38
+ "ipython>=9.2.0",
39
+ "mypy>=1.15.0",
40
+ "pre-commit>=4.2.0",
41
+ "pytest>=8.3.5",
42
+ "pytest-coverage>=0.0",
43
+ "pytest-mock>=3.15.1",
44
+ "ruff>=0.11.5",
45
+ ]
46
+ docs = [
47
+ "autodoc-pydantic",
48
+ "docstr-coverage>=2.3.2",
49
+ "furo>=2025.9.25",
50
+ "ghp-import",
51
+ "myst-parser",
52
+ "sphinx>=8.0.0",
53
+ "sphinx-copybutton",
54
+ "sphinx-reports",
55
+ "sphinx-tabs",
56
+ ]
57
+
58
+ [project.entry-points.r2x_plugin]
59
+ plexos = "r2x_plexos.plugins:manifest"
60
+
61
+ [project.urls]
62
+ Homepage = "https://github.com/NREL/r2x-plexos"
63
+ Documentation = "https://nrel.github.io/r2x-plexos/"
64
+ Repository = "https://github.com/NREL/r2x-plexos"
65
+ Issues = "https://github.com/NREL/r2x-plexos/issues"
66
+ Changelog = "https://nrel.github.io/r2x-plexos/CHANGELOG.html"
67
+
68
+ [build-system]
69
+ requires = ["uv_build>=0.8.22,<0.9.0"]
70
+ build-backend = "uv_build"
71
+
72
+ [tool.pytest.ini_options]
73
+ pythonpath = [
74
+ "src"
75
+ ]
76
+ testpaths = ["tests"]
77
+ markers = [
78
+ "slow: marks tests as slow (deselect with '-m \"not slow\"')",
79
+ "export: marks to test exporter functions",
80
+ "serialize: marks tests for serialization functionality"
81
+ ]
82
+
83
+ [tool.mypy]
84
+ strict = true
85
+ exclude = ["tests/"]
86
+ plugins = [
87
+ "pydantic.mypy"
88
+ ]
89
+
90
+
91
+ [tool.ruff]
92
+ line-length = 110
93
+ extend-exclude = [
94
+ ".venv",
95
+ "venv",
96
+ "build",
97
+ "dist",
98
+ "*.egg-info",
99
+ ]
100
+
101
+ [tool.ruff.lint]
102
+ select = [
103
+ "D", # pyddoc
104
+ "E", # pycodestyle errors
105
+ "W", # pycodestyle warnings
106
+ "F", # pyflakes
107
+ "I", # isort
108
+ "N", # pep8-naming
109
+ "UP", # pyupgrade
110
+ "B", # flake8-bugbear
111
+ "C4", # flake8-comprehensions
112
+ "SIM", # flake8-simplify
113
+ "PIE", # flake8-pie
114
+ "PERF", # perflint (performance)
115
+ "RUF", # ruff-specific rules
116
+ ]
117
+ ignore = [
118
+ "E501", # Line too long (handled by formatter)
119
+ "B027", # Empty method in abstract class without @abstractmethod (intentional for hooks)
120
+ ]
121
+
122
+
123
+ [tool.ruff.lint.pydocstyle]
124
+ convention = "numpy"
125
+
126
+ [tool.ruff.lint.per-file-ignores]
127
+ # Ignore `D` rules everywhere except for the `src/` directory.
128
+ "!src/**.py" = ["D", "S101"]
129
+
130
+ [tool.ruff.lint.isort]
131
+ known-first-party = ["r2x_core"]
132
+ section-order = ["future", "standard-library", "third-party", "first-party", "local-folder"]
133
+
134
+ [tool.ruff.lint.mccabe]
135
+ # Cyclomatic complexity threshold
136
+ max-complexity = 10
@@ -0,0 +1,49 @@
1
+ """R2X PLEXOS Plugin.
2
+
3
+ A plugin for parsing PLEXOS model data into the R2X framework using infrasys components.
4
+ """
5
+
6
+ from importlib.metadata import version
7
+
8
+ from loguru import logger
9
+
10
+ from .config import PLEXOSConfig
11
+ from .models import (
12
+ PLEXOSObject,
13
+ PLEXOSProperty,
14
+ PLEXOSPropertyValue,
15
+ PLEXOSRow,
16
+ get_horizon,
17
+ get_scenario_priority,
18
+ horizon,
19
+ scenario_and_horizon,
20
+ scenario_priority,
21
+ set_horizon,
22
+ set_scenario_priority,
23
+ )
24
+ from .parser import PLEXOSParser
25
+
26
+ __version__ = version("r2x_plexos")
27
+
28
+
29
+ # Disable default loguru handler for library usage
30
+ # Applications using this library should configure their own handlers
31
+ logger.disable("r2x_plexos")
32
+
33
+
34
+ __all__ = [
35
+ "PLEXOSConfig",
36
+ "PLEXOSObject",
37
+ "PLEXOSParser",
38
+ "PLEXOSProperty",
39
+ "PLEXOSPropertyValue",
40
+ "PLEXOSRow",
41
+ "__version__",
42
+ "get_horizon",
43
+ "get_scenario_priority",
44
+ "horizon",
45
+ "scenario_and_horizon",
46
+ "scenario_priority",
47
+ "set_horizon",
48
+ "set_scenario_priority",
49
+ ]
@@ -0,0 +1,18 @@
1
+ {
2
+ "export-configuration": {
3
+ "time_series_naming_pattern": "${type(component).__name__}_$(ts_metadata).csv"
4
+ },
5
+ "horizon-properties": {},
6
+ "horizon_year": null,
7
+ "model-properties": {},
8
+ "models": [],
9
+ "properties-defaults": {
10
+ "Decomposition Method": 1,
11
+ "Dump Energy Price": -100,
12
+ "VoLL": 1000000.0,
13
+ "Wheeling Charge": 0.001,
14
+ "Wheeling Charge Back": 0.001
15
+ },
16
+ "resolution": null,
17
+ "template": null
18
+ }
@@ -0,0 +1,7 @@
1
+ [
2
+ {
3
+ "description": "PLEXOS XML file",
4
+ "glob": "*.xml",
5
+ "name": "xml_file"
6
+ }
7
+ ]