postreise.analyze.generation package

Subpackages

Submodules

postreise.analyze.generation.binding module

postreise.analyze.generation.binding.pmax_constraints(scenario, epsilon=0.001)[source]

Identify time periods in which generators are at maximum power.

Parameters:
Returns:

(pandas.DataFrame) – boolean data frame of same shape as PG.

postreise.analyze.generation.binding.pmin_constraints(scenario, epsilon=0.001)[source]

Identify time periods in which generators are at minimum power.

Parameters:
Returns:

(pandas.DataFrame) – boolean data frame of same shape as PG.

postreise.analyze.generation.binding.ramp_constraints(scenario, epsilon=0.001)[source]

Identify time periods in which generators have binding ramp constraints.

Parameters:
Returns:

(pandas.DataFrame) – boolean data frame of same shape as PG.

Note

The first time period will always return False for each column.

postreise.analyze.generation.capacity module

postreise.analyze.generation.capacity.calculate_NLDC(scenario, resources, hours=100)[source]

Calculate the capacity value of a class of resources by comparing the mean of the top N hour of absolute demand to the mean of the top N hours of net demand. NLDC = ‘Net Load Duration Curve’.

Parameters:
Returns:

(float) – difference between peak demand and peak net demand.

postreise.analyze.generation.capacity.calculate_net_load_peak(scenario, resources, hours=100)[source]

Calculate the capacity value of a class of resources by averaging the power generated in the top N hours of net load peak.

Parameters:
Returns:

(float) – resource capacity during hours of peak net demand.

postreise.analyze.generation.capacity.get_capacity_by_resources(scenario, area, resources, area_type=None)[source]

Get the total nameplate capacity for generator type(s) in an area

Parameters:
  • scenario (powersimdata.scenario.scenario.Scenario) – scenario instance

  • area (str) – one of ‘loadzone’, ‘state’, ‘state_abbr’, ‘interconnect’ ‘all’

  • resources (str/list) – one or a list of resources

  • area_type (str) – one of ‘loadzone’, ‘state’, ‘state_abbr’, ‘interconnect’. If None, area will be searched successively into ‘state’, ‘loadzone’, ‘state abbreviation’, ‘interconnect’ and ‘all’.

Returns:

(pandas.Series) – index: resources, column: total nameplate Pmax capacity

postreise.analyze.generation.capacity.get_capacity_factor_time_series(scenario, area, resources, area_type=None)[source]

Get the hourly capacity factor of each generator fueled by resource(s) in an area.

Parameters:
  • scenario (powersimdata.scenario.scenario.Scenario) – scenario instance

  • area (str) – one of ‘loadzone’, ‘state’, ‘state_abbr’, ‘interconnect’ ‘all’

  • resources (str/list) – one or a list of resources

  • area_type (str) – one of ‘loadzone’, ‘state’, ‘state_abbr’, ‘interconnect’. If None, area will be searched successively into ‘state’, ‘loadzone’, ‘state abbreviation’, ‘interconnect’ and ‘all’

Returns:

(pandas.DataFrame) – index: timestamps, column: plant ids, value: capacity factors

postreise.analyze.generation.capacity.get_storage_capacity(scenario, area, area_type=None)[source]

Get total storage nameplate capacity in an area.

Parameters:
  • scenario (powersimdata.scenario.scenario.Scenario) – scenario instance

  • area (str) – one of ‘loadzone’, ‘state’, ‘state_abbr’, ‘interconnect’ ‘all’

  • area_type (str) – one of ‘loadzone’, ‘state’, ‘state_abbr’, ‘interconnect’. If None, area will be searched successively into ‘state’, ‘loadzone’, ‘state abbreviation’, ‘interconnect’ and ‘all’

Returns:

(float) – total storage capacity value

postreise.analyze.generation.capacity.sum_capacity_by_type_zone(scenario)[source]

Get total capacity for each generator type and load zone combination.

Parameters:

scenario (powersimdata.scenario.scenario.Scenario) – scenario instance.

Returns:

(pandas.DataFrame) – index: generator type, column: load zone, value: total capacity.

postreise.analyze.generation.costs module

postreise.analyze.generation.costs.calculate_costs(scenario=None, pg=None, gencost=None, decommit=False, decommit_threshold=1)[source]

Calculate individual generator costs at given powers. If decommit is True, costs will be zero below the decommit threshold (1 MW). Either scenario XOR (pg AND gencost) must be specified.

Parameters:
  • scenario (powersimdata.scenario.scenario.Scenario) – scenario to analyze.

  • pg (pandas.DataFrame) – Generation solution data frame.

  • gencost (pandas.DataFrame) – cost curve polynomials.

  • decommit (bool) – Whether to decommit generator at low power.

  • decommit_threshold (int/float) – The power (MW) below which generators are assumed to be ‘decommitted’, and costs are zero (if decommit is True).

Raises:

ValueError – if not (scenario XOR (pg AND gencost)) is specified, or if pg is passed and has negative values.

Returns:

(pandas.DataFrame) – data frame of costs. Index is hours, columns are plant IDs, values are $/hour.

postreise.analyze.generation.curtailment module

postreise.analyze.generation.curtailment.calculate_curtailment_percentage_by_resources(scenario, resources=None)[source]

Calculate scenario-long average curtailment fraction for a set of generator type(s).

Parameters:
Returns:

(float) – average curtailment fraction over the scenario.

postreise.analyze.generation.curtailment.calculate_curtailment_time_series(scenario)[source]

Calculate hourly curtailment for each renewable generator.

Parameters:

scenario (powersimdata.scenario.scenario.Scenario) – scenario instance.

Returns:

(pandas.DataFrame) – time series of curtailment.

postreise.analyze.generation.curtailment.calculate_curtailment_time_series_by_areas(scenario, areas=None)[source]

Calculate hourly curtailment by area(s).

Parameters:
  • scenario (powersimdata.scenario.scenario.Scenario) – scenario instance.

  • areas (dict) – keys are area types (’loadzone’, ‘state’ or ‘interconnect’), values are a list of areas. Default is the interconnect of the scenario. Default is the scenario interconnect.

Returns:

(dict) – keys are areas, values are data frames indexed by (datetime, plant id).

postreise.analyze.generation.curtailment.calculate_curtailment_time_series_by_areas_and_resources(scenario, areas=None, resources=None)[source]

Calculate hourly curtailment of each generator located in area(s) area and fueled by resource(s).

Parameters:
  • scenario (powersimdata.scenario.scenario.Scenario) – scenario instance.

  • areas (dict) – keys are area types (’loadzone’, ‘state’ or ‘interconnect’), values are a list of areas. Default is the scenario interconnect(s).

  • resources (str/tuple/list/set) – names of resources to analyze. Default is all renewable resources.

Returns:

(dict) – keys are areas, values are dictionaries whose keys are resources and values are data frames indexed by (datetime, plant id).

postreise.analyze.generation.curtailment.calculate_curtailment_time_series_by_resources(scenario, resources=None)[source]

Calculate hourly curtailment by generator type(s).

Parameters:
Returns:

(dict) – keys are resources, values are data frames indexed by (datetime, plant id).

postreise.analyze.generation.curtailment.calculate_curtailment_time_series_by_resources_and_areas(scenario, areas=None, resources=None)[source]

Calculate hourly curtailment of each generator fueled by resources and located in area(s).

Parameters:
  • scenario (powersimdata.scenario.scenario.Scenario) – scenario instance.

  • resources (str/tuple/list/set) – names of resources. Default is all renewable resources.

  • areas (dict) – keys are area types (’loadzone’, ‘state’ or ‘interconnect’), values are a list of areas. Default is the scenario interconnect(s).

Returns:

(dict) – keys are resources, values are dictionaries whose keys are areas and values are data frames indexed by (timestamp, plant id).

postreise.analyze.generation.curtailment.get_curtailment_time_series(scenario, area, area_type=None)[source]

Get hourly curtailment for each available resource(s) in area.

Parameters:
  • scenario (powersimdata.scenario.scenario.Scenario) – scenario instance

  • area (str) – one of loadzone, state, state abbreviation, interconnect, ‘all’

  • area_type (str) – one of ‘loadzone’, ‘state’, ‘state_abbr’, ‘interconnect’

Returns:

(pandas.DataFrame) – index: timestamps, columns: available renewable resource(s).

postreise.analyze.generation.curtailment.summarize_curtailment_by_bus(scenario)[source]

Calculate total curtailment by bus.

Parameters:

scenario (powersimdata.scenario.scenario.Scenario) – scenario instance.

Returns:

(dict) – keys are resources, values are dict of (bus: curtailment vector).

postreise.analyze.generation.curtailment.summarize_curtailment_by_location(scenario)[source]

Calculate total curtailment by location.

Parameters:

scenario (powersimdata.scenario.scenario.Scenario) – scenario instance.

Returns:

(dict) – keys are resources, values are dict of ((lat, lon): curtailment vector).

postreise.analyze.generation.emissions module

postreise.analyze.generation.emissions.carbon_diff(scenario_1, scenario_2)[source]

Prints percentage change in carbon emissions of two scenarios.

Parameters:
Returns:

(float) – relative difference in emission in percent.

postreise.analyze.generation.emissions.generate_emissions_stats(scenario, pollutant='carbon', method='simple')[source]

Calculate hourly emissions for each generator.

Parameters:
Returns:

(pandas.DataFrame) – emissions data frame. index: timestamps, column: plant id, values: emission in tons.

Note

method descriptions:

  • ‘simple’ uses a fixed ratio of CO2 to MWh

  • ‘always-on’ uses generator heat-rate curves including non-zero intercepts

  • ‘decommit’ uses generator heat-rate curves but de-commits generators if they are off (detected by pg < 1 MW).

postreise.analyze.generation.emissions.summarize_emissions_by_bus(emissions, grid)[source]

Calculate total emissions by generator type and bus.

Parameters:
Returns:

(dict) – annual emissions by fuel and bus.

postreise.analyze.generation.summarize module

postreise.analyze.generation.summarize.get_generation_time_series_by_resources(scenario, area, resources, area_type=None)[source]

Get hourly total generation for generator type(s) in an area.

Parameters:
  • scenario (powersimdata.scenario.scenario.Scenario) – scenario instance

  • area (str) – one of loadzone, state, state abbreviation, interconnect, ‘all’

  • resources (str/list) – one or a list of resources

  • area_type (str) – one of ‘loadzone’, ‘state’, ‘state_abbr’, ‘interconnect’

Returns:

(pandas.DataFrame) – times series of generation for each resource, index: timestamps, columns: resources

postreise.analyze.generation.summarize.get_storage_time_series(scenario, area, area_type=None, storage_e=False)[source]

Get hourly total storage power generation in an area

Parameters:
  • scenario (powersimdata.scenario.scenario.Scenario) – scenario instance

  • area (str) – one of loadzone, state, state abbreviation, interconnect, ‘all’

  • area_type (str) – one of ‘loadzone’, ‘state’, ‘state_abbr’, ‘interconnect’

  • storage_e (bool) – if set, return time series energy of storage devices instead of power generation. Default to False.

Returns:

(pandas.Series) – time series of total storage power generation, if storage_e is not set, otherwise, time series of total storage energy, index: timestamps, values: storage power/storage energy

postreise.analyze.generation.summarize.sum_generation_by_state(scenario: Scenario) DataFrame[source]

Get the total generation for each generator type and state combination, adding totals for the interconnects and for all states.

Parameters:

scenario (powersimdata.scenario.scenario.Scenario) – scenario instance.

Returns:

(pandas.DataFrame) – total generation per resource, by area.

postreise.analyze.generation.summarize.sum_generation_by_type_zone(scenario: Scenario, time_range=None, time_zone=None) DataFrame[source]

Get total generation for each generator type and load zone combination.

Parameters:
  • scenario (powersimdata.scenario.scenario.Scenario) – scenario instance.

  • time_range (tuple) – [start_timestamp, end_timestamp] where each timestamp is pandas.Timestamp/numpy.datetime64/datetime.datetime. If None, the entire time range is used for the given scenario.

  • time_zone (str) – new time zone.

Returns:

(pandas.DataFrame) – total generation, indexed by {type, zone}.

Note

The returned data frame will not be affected if only time_zone (without time_range) is set since all entries in the PG data frame will be summed.

postreise.analyze.generation.summarize.summarize_hist_gen(hist_gen_raw: DataFrame, all_resources: list, grid_model='usa_tamu') DataFrame[source]

Get the total historical generation for each generator type and state combination, adding totals for interconnects and for all states.

Parameters:
  • hist_gen_raw (pandas.DataFrame) – historical generation data frame. Columns are resources and indices are either state or load zone.

  • all_resources (list) – list of resources.

  • grid_model (str) – grid_model

Returns:

(pandas.DataFrame) – historical generation per resource.

Module contents