postreise.analyze.generation package¶
Subpackages¶
- postreise.analyze.generation.tests package
- Submodules
- postreise.analyze.generation.tests.test_binding module
TestCheckEpsilon
TestCheckScenario
TestPmaxConstraints
TestPmaxConstraints.get_default_expected()
TestPmaxConstraints.setUp()
TestPmaxConstraints.test_pmax_constraints_default()
TestPmaxConstraints.test_pmax_constraints_default_sepc_epsilon1()
TestPmaxConstraints.test_pmax_constraints_default_sepc_epsilon2()
TestPmaxConstraints.test_pmax_constraints_default_sepc_epsilon3()
TestPminConstraints
TestPminConstraints.get_default_expected()
TestPminConstraints.setUp()
TestPminConstraints.test_pmin_constraints_default()
TestPminConstraints.test_pmin_constraints_default_spec_epsilon1()
TestPminConstraints.test_pmin_constraints_default_spec_epsilon2()
TestPminConstraints.test_pmin_constraints_default_spec_epsilon3()
TestRampConstraints
- postreise.analyze.generation.tests.test_capacity module
test_NLDC_calculation_solar()
test_NLDC_calculation_solar_wind()
test_NLDC_calculation_wind_5_hour()
test_NLDC_calculation_wind_list()
test_NLDC_calculation_wind_set()
test_NLDC_calculation_wind_solar()
test_NLDC_calculation_wind_str()
test_NLDC_calculation_wind_tuple()
test_calculate_net_load_peak_solar()
test_calculate_net_load_peak_solar_5()
test_calculate_net_load_peak_solar_wind()
test_calculate_net_load_peak_solar_wind_5()
test_calculate_net_load_peak_wind()
test_calculate_net_load_peak_wind_5()
test_failure_hours_type()
test_failure_no_resources()
test_failure_no_resources_present()
test_failure_one_resource_not_present()
test_failure_resources_type_dict()
test_failure_scenario_type()
test_failure_too_many_hours()
test_failure_zero_hours()
test_get_capacity_by_resources()
test_get_capacity_factor_time_series()
test_get_storage_capacity()
test_sum_capacity_by_type_zone()
- postreise.analyze.generation.tests.test_costs module
- postreise.analyze.generation.tests.test_curtailment module
TestCalculateCurtailmentPercentage
TestCalculateCurtailmentPercentage.test_calculate_curtailment_percentage_default()
TestCalculateCurtailmentPercentage.test_calculate_curtailment_percentage_solar()
TestCalculateCurtailmentPercentage.test_calculate_curtailment_percentage_solar_wind()
TestCalculateCurtailmentPercentage.test_calculate_curtailment_percentage_wind()
TestCalculateCurtailmentPercentage.test_calculate_curtailment_percentage_wind_offshore()
TestCalculateCurtailmentTimeSeries
TestCalculateCurtailmentTimeSeries.test_calculate_curtailment_time_series_default()
TestCalculateCurtailmentTimeSeries.test_calculate_curtailment_time_series_solar()
TestCalculateCurtailmentTimeSeries.test_calculate_curtailment_time_series_solar_wind_set()
TestCalculateCurtailmentTimeSeries.test_calculate_curtailment_time_series_solar_wind_tuple()
TestCalculateCurtailmentTimeSeries.test_calculate_curtailment_time_series_wind_argument_type()
TestCalculateCurtailmentTimeSeries.test_calculate_curtailment_time_series_wind_solar_list()
TestCalculateCurtailmentTimeSeriesGrouped
TestCalculateCurtailmentTimeSeriesGrouped.test_curtailment_time_series_by_areas()
TestCalculateCurtailmentTimeSeriesGrouped.test_curtailment_time_series_by_areas_and_resource()
TestCalculateCurtailmentTimeSeriesGrouped.test_curtailment_time_series_by_areas_and_resources()
TestCalculateCurtailmentTimeSeriesGrouped.test_curtailment_time_series_by_resource_and_area()
TestCalculateCurtailmentTimeSeriesGrouped.test_curtailment_time_series_by_resources_and_areas()
TestCheckResourceInScenario
TestGetCurtailmentTimeSeries
TestSummarizeCurtailmentByBus
TestSummarizeCurtailmentByLocation
- postreise.analyze.generation.tests.test_emissions module
- postreise.analyze.generation.tests.test_summarize module
TestSumGenerationByTypeZone
TestSumGenerationByTypeZone.setUp()
TestSumGenerationByTypeZone.test_print_statement()
TestSumGenerationByTypeZone.test_sum_generation()
TestSumGenerationByTypeZone.test_with_scenario_not_analyze()
TestSumGenerationByTypeZone.test_with_string()
TestSumGenerationByTypeZone.test_with_time_change()
TestSumGenerationByTypeZone.test_with_time_change_and_time_slice()
TestSumGenerationByTypeZone.test_with_time_slice()
hist_gen_raw()
sim_gen_result()
test_get_generation_time_series_by_resources()
test_get_storage_time_series()
test_sum_generation_by_state_shape()
test_sum_generation_by_state_values_scaled()
test_summarize_hist_gen_include_areas()
test_summarize_hist_gen_shape()
- Module contents
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:
scenario (powersimdata.scenario.scenario.Scenario) – scenario instance.
epsilon (float) – allowable ‘fuzz’ for whether constraint is binding.
- 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:
scenario (powersimdata.scenario.scenario.Scenario) – scenario instance.
epsilon (float) – allowable ‘fuzz’ for whether constraint is binding.
- 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:
scenario (powersimdata.scenario.scenario.Scenario) – scenario instance.
epsilon (float) – allowable ‘fuzz’ for whether constraint is binding.
- 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:
scenario (powersimdata.scenario.scenario.Scenario) – scenario instance.
resources (str/list/tuple/set) – one or more resources to analyze.
hours (int) – number of hours to analyze.
- 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:
scenario (powersimdata.scenario.scenario.Scenario) – scenario instance.
resources (str/list/tuple/set) – one or more resources to analyze.
hours (int) – number of hours to analyze.
- 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
ANDgencost
) 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
ANDgencost
)) is specified, or ifpg
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:
scenario (powersimdata.scenario.scenario.Scenario) – scenario instance.
resources (str/tuple/list/set) – names of resources to analyze. Default is all renewable resources.
- 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:
scenario (powersimdata.scenario.scenario.Scenario) – scenario instance.
resources (str/tuple/list/set) – names of resources to analyze. Default is all renewable esources.
- 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:
scenario_1 (powersimdata.scenario.scenario.Scenario) – scenario instance.
scenario_2 (powersimdata.scenario.scenario.Scenario) – scenario instance.
- 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:
scenario (powersimdata.scenario.scenario.Scenario) – scenario instance.
pollutant (str) – pollutant to analyze.
method (str) – selected method to handle no-load fuel consumption.
- 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:
emissions (pandas.DataFrame) – hourly emissions by generator as returned by
generate_emissions_stats()
.grid (powersimdata.input.grid.Grid) – grid object.
- 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
(withouttime_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.