PLEXOS#
- class gat.scenariohandlers.plexos.PlexosScenario(simulation_files=None, system_file=None, gen_area_map=None, load_area_map=None, line_rating_map=None, config=None, pattern='*.h5', solution_data=None, solution_path=None, force_convert=False)#
Class for interfacing with PLEXOS solutions — either legacy H5 files generated by H5PLEXOS.jl, or native PLEXOS
Solution.zipfiles (converted in-process via the optionalplexos2duckdbdependency,pip install nlr-gat[plexos-duckdb]). The backend is detected automatically from the file extension(s) resolved fromsimulation_files— every abstract method transparently routes to whichever backend was detected; the public API is identical either way.- Parameters:
solution_data (str or List[str], optional) – Path to simulation output data or list of paths to h5 files, OR a native PLEXOS
Solution.zip/.duckdbpath or list of them. Can be a directory, single file path, list of file paths, or glob pattern. Mixing h5 and zip/duckdb paths in one call raisesValueError— a single instance speaks one backend.system_file (str, optional) – Path to system data file (for future use with PLEXOS XML files)
config (ScenarioConfig, optional) – Configuration object for the scenario
pattern (str, optional) – Glob pattern to use when searching for files (default: “*.h5”). Only consulted for directory/glob-string input — explicit file path(s) resolve regardless of extension, so this rarely needs overriding even for zip/duckdb input (see
_resolve_plexos_backend_and_files).force_convert (bool, optional) – Duckdb backend only (ignored on the h5 backend). Reconvert every
.zipinput even if a fresh.duckdbcache already exists.Properties (Internal)
-------------------
self.parser (PlexosParser | None) – For reading raw datasets across h5 files.
Noneon the duckdb backend.self._backend ("h5" | "duckdb") – Which engine this instance is using.
simulation_files (str | List[str] | None)
gen_area_map (dict | None)
load_area_map (dict | None)
line_rating_map (dict | None)
solution_path (str | List[str] | None)
- generate_gen_area_map()#
Generates the generator technology map. Checks if ‘batteries’ is found in the h5 ST/interval group. If so appends the battery->tech map into the overall generator-tech map.
- Return type:
dict
- generate_line_rating_map(frequency='year')#
PLEXOS Dataset: /ST/year/lines/Export Limit
Parses the line capacity dataset to populate self._line_rating_map
- Returns:
Dictionary of {Line ID: Line capacity}
- Return type:
dict
- generate_map(map_generator)#
Generates a dictionary relationship
- Return type:
dict
- property generator_technology_map: Dict[str, str]#
Generates the generator technology map. Checks if ‘batteries’ is found in the h5 ST/interval group. If so appends the battery->tech map into the overall generator-tech map.
On the v1 duckdb backend, reads the Generator class’s own
categorycolumn directly — no battery union needed (PLEXOS Storage objects are internal head/tail bookkeeping for battery-capable generators, not separately-categorized entities; see gat/systems/plexos_duckdb.py for the full explanation).
- get_availability()#
PLEXOS H5 Dataset Path: /ST/interval/generators/Available Capacity
- Returns:
Timeseries of the VRE availability across one or multiple h5 files. Used in Curtailment calculations.
- Return type:
DataFrame
- get_generation()#
PLEXOS H5 Datset Path: /ST/interval/generators/Generation
- Returns:
Timeseries of the generation across one or multiple h5 files
- Return type:
DataFrame
- get_generation_capacity()#
PLEXOS H5 Dataset Path: /ST/year/generators/Installed Capacity
Reads only first file in the list of h5 files
- Returns:
Dataframe of capacity by Area and Technology.
- Return type:
DataFrame
- get_line_flow()#
PLEXOS H5 Dataset Path: /ST/interval/Lines/Flow
- Returns:
Timeseries dataframe of the line flow across one or multiple h5 files.
- Return type:
DataFrame
- get_load()#
PLEXOS H5 Dataset Path: /ST/interval/regions/Load
- Returns:
Timeseries dataframe of the load by region.
- Return type:
DataFrame
- get_plexos_h5map(h5path)#
Parses a relationship dataset found in the h5 files
- Parameters:
h5path – example /relations/generator_region
- Return type:
dict
- get_production_cost(zone=None)#
gets the production cost for a specific region, broken down by cost type #TODO: add datetime slicing capability
- Return type:
DataFrame
- get_storage_charging()#
PLEXOS H5 Dataset: /ST/interval/storages/Pump Load
- Returns:
Timeseries Dataframe of Pump load by generator.
- Return type:
DataFrame
- get_unserved()#
PLEXOS H5 Dataset Path: /ST/interval/regions/Unserved Energy
- Returns:
Timeseries dataframe of unserved energy by region.
- Return type:
DataFrame
- set_area_map(area_map)#
Sets the load->area and generator->area mapping based on available relations in the h5 dataset.
- Parameters:
area_map (str) – ‘zone’ or ‘region’
- Return type:
None