Base#

The Base Scenario Object Class. Do not import directly. Base class provides higher level aggregations for concrete classes that implement the core data extraction methods.

@author: Micah Webb

class gat.scenariohandlers.base.BaseScenario(simulation_files=None, tech_map=None, gen_area_map=None, load_area_map=None, line_rating_map=None, config=None, system_data=None, pattern='*.h5', solution_data=None)#

Initialize a scenario object with configuration, system data, and solution data.

Parameters:#

simulation_filesstr or list of str, optional

Path to simulation output data or directory containing such data. Can be a single file path, list of file paths, or a directory path.

tech_mapdict, optional

Mapping from generator IDs to technology types.

gen_area_mapdict, optional

Mapping from generator IDs to geographic areas.

load_area_mapdict, optional

Mapping from load IDs to geographic areas.

line_rating_mapdict, optional

Mapping from line IDs to line capacities.

configScenarioConfig, optional

Configuration object for the scenario.

system_datastr, optional

Path to system data file (e.g., Sienna JSON or Plexos XML).

property area: str#

"area").

Type:

Display label for the aggregation column (default

property display_name: str | None#

Get the display name for this scenario

classmethod from_config(config_path, system_path=None, simulation_paths=None, display_name=None, pattern='*.h5')#

Create a scenario from a configuration file or object.

Parameters:#

config_pathstr or ScenarioConfig

Path to config file or config object

system_pathstr, optional

Override system path in config

simulation_pathsstr or list of str, optional

Override simulation paths in config

display_namestr, optional

Override display name in config

patternstr, optional

Glob pattern for finding solution files

Returns:#

BaseScenario

Initialized scenario object

Parameters:
  • config_path (str | ScenarioConfig)

  • system_path (str | None)

  • simulation_paths (str | List[str] | None)

  • display_name (str | None)

  • pattern (str)

property gen_area_map: dict#

Mapping of generator name → area. Populated from solution metadata at construction; can be overridden post-hoc.

abstract property generator_technology_map: Dict[str, str]#

Abstract property representing the generation id to the technology name found in the underlying model. This property function should make no attempt to translate technology names into display names.

get_area_charging()#

Aggregates the Energy Storage Charging by Area for each storage type (Pump Load, Battery Charging)

Return type:

DataFrame | NotImplementedError

get_area_curtailment_aggregates()#

Gets the curtailment aggregated for each available technology category and area

Return type:

DataFrame

get_area_dispatch(include_load=True, include_use=True, include_charging=True)#

Gets interval generation, load, charging and unserved energy aggregated by technology and area

Parameters:
  • include_load – boolean (whether to include load, skipped if not implemented)

  • include_use – boolean (whether to include unserved energy, skipped if not implemented)

  • include_charging – boolean (whether to include storage charging, skipped if not implemented)

  • **kwargs

    Arguments passed to get_area_load

Returns:

Timeseries DataFrame of generation, load, unserved energy and charging aggregated by technology and area.

Return type:

DataFrame

get_area_load()#

Gets the aggregated interval Load by Area

Return type:

DataFrame | None

get_area_tech_aggregates()#

Gets the aggregated interval generation and curtailment by each area and technology

Return type:

DataFrame

get_area_unserved()#

Gets the Unserved Energy Aggregated by Area

Return type:

DataFrame

abstractmethod get_availability()#

Abstract Method to be implemented by model specific classes to return VRE availability by generator.

get_availability_tech(simplify=True)#

Gets the availability for each generator and includes the technology type

Return type:

DataFrame

get_curtailment()#

Calculates the curtailment for each generator based on which technologies are configured as curtailable

Returns:

Timeseries Dataframe of curtailment for each generator.

Return type:

DataFrame

get_flow()#

Deprecated: Use Line flow instead.

get_gen_and_curtailment()#
Returns:

Timeseries Datafrom of generation and curtailment for each generator

Return type:

DataFrame

abstractmethod get_generation()#

Abstract Method to be implemented by model specific classes to return generation by generator.

abstractmethod get_generation_capacity()#

Abstract Method to be implemented by model specific classes to return generation capacity.

get_generators_tech()#

Returns a Dataframe with a column for each generator along with technology category

Return type:

DataFrame

get_line_congestion_hours(threshold=100.0)#

Calculates a boolean flag for each hour and line congested

Return type:

DataFrame

abstractmethod get_line_flow()#

Abstract function implemented by concrete classes to enable transmission specific calculations.

get_line_loading()#

Gets the line loading as a % of the lines capacity. Line Capacity is stored in based on _line_rating_map

Return type:

DataFrame

get_line_utilization(threshold=[99, 95, 90, 75])#

Calculates a flag for each hour on whether the line is overloaded by 75, 90, 95, or 99 percent

Parameters:

threshold – List(float) - list of loading thresholds to determine if utilization is above or below.

Returns:

Dataframe with boolean flags for each timestamp that is over the threshold.

Return type:

DataFrame

abstractmethod get_load()#

Abstract Method to be implemented by model specific classes to return load by node or area.

get_peak_stats(winter_months=[1, 2, 12])#

Gets the timestamp for winter and summer peaks for Net Load and Total Load.

Parameters:

winter_months – The months defined as winter months to separate winter and summer peaks.

Returns:

A dataframe of winter summer peak/min load stats.

Return type:

dict

abstractmethod get_production_cost(zone=None)#

Abstract function implemented by concrete classes to enable cost specific aggregations.

Parameters:

zone (str | None)

get_production_cost_tech()#

Gets the production cost aggregated by technology.

Returns:

Production cost timeseries with generation technology.

Return type:

DataFrame

abstractmethod get_storage_charging()#

Abstract function implemented by concrete classes to enable charging specific aggregations.

get_system_charging()#

Gets interval storage charging aggregated by technology for the entire system.

Returns:

Timeseries DataFrame of storage charging aggregated by technology. Returns None if charging data is not available.

Return type:

DataFrame | None

get_system_dispatch(include_load=True, include_use=True, include_charging=True)#

Gets interval generation, load, charging and unserved energy aggregated by technology for the entire system.

Parameters:
  • include_load – boolean (whether to include load, skipped if not implemented)

  • include_use – boolean (whether to include unserved energy, skipped if not implemented)

  • include_charging – boolean (whether to include storage charging, skipped if not implemented)

  • **kwargs

    Arguments passed to get_area_load

Returns:

Timeseries DataFrame of generation, load, unserved energy and charging aggregated by technology and area.

Return type:

DataFrame

abstractmethod get_unserved()#

Abstract Method to be implemented by model specific classes to return unserved energy by node or area.

property line_rating_map: dict#

Mapping of line name → rating in MW.

property load_area_map: dict#

Mapping of load/node name → area.

property load_includes_charging: bool#

Whether get_load() already includes storage charging.

When True, the dispatch frame’s load column is aliased as “Total Demand”; when False (the default), it’s “Native Demand” and storage charging is added separately by fill_missing_loads. Backed by ScenarioConfig.load_includes_charging.

save_config(filepath=None)#

Save current configuration to a file

Parameters:

filepath (str | None)

Return type:

None

property tech_simple#

A dictionary/map that maps model specific technology names to simplified technology names for further aggregation and presentation.

to_config()#

Create a ScenarioConfig object from the current scenario

Return type:

ScenarioConfig

Parameters:
  • simulation_files (str | List[str] | None)

  • tech_map (dict | None)

  • gen_area_map (dict | None)

  • load_area_map (dict | None)

  • line_rating_map (dict | None)

  • config (ScenarioConfig | None)

  • system_data (str | None)

  • pattern (str)

  • solution_data (str | List[str] | None)

gat.scenariohandlers.base.calc_curtailment(gen_tech, avail_tech)#

Calculates the curtailment for generator technologies that fall under gc.config.curtailable_tech

gat.scenariohandlers.base.fill_missing_loads(dispatch, charging, load_includes_charging=False)#

Calculates missing load values of a dispatch dataframe if only Native Load or Total Load are present.

Parameters:
  • dispatch (DataFrame)

  • charging (DataFrame)

gat.scenariohandlers.base.get_peak_stats(dispatch, winter_months=[1, 2, 12])#

Calculates the peak/min total and net load, split by winter and summer months

Parameters:
  • dispatch – A dataframe with aggregate generation and load by technology and load type.

  • winter_months – The month numbers to designate as winter months. Defaults to [1,2,12] (Jan, Feb, Dec)

Returns:

Dataframe of peak/min timestamps and corresponding load/net load, and vre values.

Return type:

DataFrame

gat.scenariohandlers.base.load_map(map)#

Loads a dictionary/mapping from a JSON file or dictionary.