R2X plug-in for translating to and from PLEXOS XML databases.
R2X PLEXOS plugin for parsing and exporting PLEXOS power system models.
uv add r2x-plexosfrom pathlib import Path
from r2x_core import (
DataFile,
DataStore,
PluginContext,
Rule,
System,
apply_rules_to_context,
)
from r2x_plexos import PLEXOSParser, PLEXOSConfig
xml_path = /path/to/xml
db = PlexosDB.from_xml(xml_path)
model_names = db.list_objects_by_class(ClassEnum.Model)
model_name = model_names[1] if model_names else "Base"
plexos_config = PLEXOSConfig(
model_name=model_name,
horizon_year=2012,
models=("r2x_plexos.models", "r2x_sienna.models"),)
data_file = DataFile(name="xml_file", fpath=xml_path)
store = DataStore(path=folder_path)
store.add_data([data_file])
context = PluginContext(
config=plexos_config,
store=store
)
parser = PLEXOSParser.from_context(context)
plexos_sys_result = parser.run()
plexos_sys = plexos_sys_result.system
context.source_system = plexos_sys- Tutorials - Step-by-step learning guides
- How-To Guides - Task-focused recipes
- Explanations - Architecture and design
- References - API and configuration reference
If you're curious about what we're working on, check out the roadmap:
- Active issues: Issues that we are actively working on.
- Prioritized backlog: Issues we'll be working on next.
- Nice-to-have: Nice to have features or Issues to fix. Anyone can start working on (please let us know before you do).
- Ideas: Future work or ideas for R2X Core.