powersimdata.design.generation package¶
Subpackages¶
Submodules¶
powersimdata.design.generation.clean_capacity_scaling module¶
- powersimdata.design.generation.clean_capacity_scaling.add_demand_to_targets(input_targets, scenario)[source]¶
Add demand data to targets.
- Parameters:
input_targets (pandas.DataFrame) – table including target names, used to summarize demand.
scenario (powersimdata.scenario.scenario.Scenario) – A Scenario instance.
- Returns:
(pandas.DataFrame) – DataFrame of targets including demand data.
- powersimdata.design.generation.clean_capacity_scaling.add_new_capacities_collaborative(input_targets, scenario_length, solar_fraction=None, addl_curtailment=None)[source]¶
Calculates new capacities based on a Collaborative strategy.
- Parameters:
input_targets (pandas.DataFrame) – table of targets.
scenario_length (int) – number of hours in new scenario.
solar_fraction (float/None) – how much new capacity should be solar. If given None, maintain previous ratio.
addl_curtailment (dict/None) – how much new curtailment is expected, by resource. If given None, assume zero.
- Returns:
(pandas.DataFrame) – targets dataframe with next capacities added.
- powersimdata.design.generation.clean_capacity_scaling.add_new_capacities_independent(input_targets, scenario_length, addl_curtailment=None)[source]¶
Calculates new capacities based on an Independent strategy.
- Parameters:
input_targets (pandas.DataFrame) – table of targets.
scenario_length (int) – number of hours in new scenario.
addl_curtailment (pandas.DataFrame/None) – additional expected curtailment by target/resource. If None, assumed zero for all targets/resources.
- Returns:
(pandas.DataFrame) – targets dataframe with next capacities added.
- powersimdata.design.generation.clean_capacity_scaling.add_resource_data_to_targets(input_targets, scenario, calculate_curtailment=False)[source]¶
Add resource data to targets. This data includes: previous capacity, previous generation, previous capacity factor (with and without curtailment), and previous curtailment.
- Parameters:
input_targets (pandas.DataFrame) – table includeing target names, used to summarize resource data.
scenario (powersimdata.scenario.scenario.Scenario) – A Scenario instance.
- Returns:
(pandas.DataFrame) – data frame of targets including resource data.
- powersimdata.design.generation.clean_capacity_scaling.add_shortfall_to_targets(input_targets)[source]¶
Add shortfall data to targets.
- Parameters:
input_targets (pandas.DataFrame) – table with demand, prev_generation, and ce_target_fraction.
- Returns:
(pandas.DataFrame) – DataFrame of targets including shortfall data.
- powersimdata.design.generation.clean_capacity_scaling.calculate_clean_capacity_scaling(ref_scenario, method, targets=None, targets_filename=None, addl_curtailment=None, next_scenario=None, solar_fraction=None)[source]¶
Given a reference scenario (to get ‘baseline’ values), a method, and a set of targets (either via a dataframe or a filename to load a dataframe), calculate capacities for a new scenario to meet the calculated shortfall.
- Parameters:
ref_scenario (powersimdata.scenario.scenario.Scenario) – Scenario instance to get baseline capacities and capacity factors from.
method (str) – which capacity scaling method to use.
targets (pandas.DataFrame/None) – a dataframe of targets, containing appropriate columns.
targets_filename (str/None) – a filepath to a CSV file of targets, containing appropriate columns.
addl_curtailment (dict/pandas.DataFrame/None) – additional expected curtailment, either by resource (for method == ‘collaborative’), or by target/resource (for method == ‘independent’).
next_scenario (powersimdata.scenario.scenario.Scenario/None) – a Scenario to plan for, using this Scenario’s length and demand to determine capacity additions.
solar_fraction (float/None) – the fraction of new capacity to be solar, for method == ‘collaborative’ only. For method == ‘independent’, these values are specified in the targets table.
- Returns:
(pandas.DataFrame) – dataframe of targets including new capacities, plus intermediate values used in calculation.
- Raises:
TypeError – if
ref_scenario
is not a Scenario object. if bothtargets
andtargets_filename
are None or set. iftargets
is not a pandas.DataFrameValueError – if
ref_scenario
is not in the analyze state. ifmethod
is incorrectly set.
- powersimdata.design.generation.clean_capacity_scaling.calculate_overall_shortfall(targets, method, normalized=False)[source]¶
Calculates overall shortfall.
- Parameters:
targets (pandas.DataFrame) – table of targets.
method (str) – shortfall calculation method (“independent” or “collaborative”).
normalized (bool) – whether to normalize by total demand.
- Returns:
(float) – overall shortfall, either in MWh or normalized by total demand.
- powersimdata.design.generation.clean_capacity_scaling.create_change_table(input_targets, ref_scenario)[source]¶
Using a reference scenario, create a change table which scales all plants in a base grid to capacities matching the reference grid, with the exception of wind and solar plants which are scaled up according to the clean capacity scaling logic.
- Parameters:
input_targets (pandas.DataFrame) – table of targets, with previous and next capacities.
ref_scenario (powersimdata.scenario.scenario.Scenario) – reference scenario to mimic.
- Returns:
(dict) – dictionary to be passed to a change table.
- powersimdata.design.generation.clean_capacity_scaling.load_targets_from_csv(filename, drop_ignored=True)[source]¶
Interprets a CSV file as a set of targets, ensuring that required columns are present, and filling in default values for optional columns.
- Parameters:
filename (str) – filepath to targets csv.
drop_ignored (bool) – if True, drop all ignored columns from output.
- Returns:
(pandas.DataFrame) – DataFrame of targets from csv file
- Raises:
TypeError – if filename is not a string
ValueError – if one or more required columns is missing.
powersimdata.design.generation.cost_curves module¶
- powersimdata.design.generation.cost_curves.build_supply_curve(grid, num_segments, area, gen_type, area_type=None, plot=True)[source]¶
Builds a supply curve for a specified area and generation type.
- Parameters:
grid (powersimdata.input.grid.Grid) – Grid object.
num_segments (int) – The number of segments into which the piecewise linear cost curve is split.
area (str) – Either the load zone, state name, state abbreviation, or interconnect.
gen_type (str/iterable) – Generation type(s).
area_type (str) – one of ‘loadzone’, ‘state’, ‘state_abbr’, ‘interconnect’. If set to None, type will be inferred.
plot (bool) – If True, the supply curve plot is shown. If False, the plot is not shown.
- Returns:
(tuple) – First element is a list of capacity (MW) amounts needed to create supply curve. Second element is a list of bids ($/MW) in the supply curve.
- Raises:
TypeError – if a powersimdata.input.grid.Grid object is not input.
ValueError – if the specified area or generator type is not applicable.
- powersimdata.design.generation.cost_curves.check_supply_data(supply_data, num_segments=1)[source]¶
Checks to make sure that the input supply data is a DataFrame and has the correct columns. This is especially needed for checking instances where the input supply data is not the DataFrame returned from get_supply_data().
- Parameters:
supply_data (pandas.DataFrame) – DataFrame containing the supply curve information.
num_segments (int) – The number of segments into which the piecewise linear cost curve will be split.
- Raises:
TypeError – if the input supply data is not a pandas.DataFrame.
ValueError – if one of the mandatory columns is missing from the input supply data.
- powersimdata.design.generation.cost_curves.get_supply_data(grid, num_segments=1, save=None)[source]¶
Accesses the generator cost and plant information data from a specified Grid object.
- Parameters:
grid (powersimdata.input.grid.Grid) – Grid object.
num_segments (int) – The number of segments into which the piecewise linear cost curve will be split.
save (str) – Saves a .csv if a str representing a valid file path and file name is provided. If None, nothing is saved.
- Returns:
(pandas.DataFrame) – Supply information needed to analyze cost and supply curves.
- Raises:
TypeError – if a powersimdata.input.grid.Grid object is not input, or if the save parameter is not input as a str.
- powersimdata.design.generation.cost_curves.ks_test(capacity_data1, price_data1, capacity_data2, price_data2, area=None, gen_type=None, plot=True)[source]¶
Runs a test that is similar to the Kolmogorov-Smirnov test. This function takes two supply curves as inputs and returns the greatest difference in price between the two supply curves. This function requires that the supply curves offer the same amount of capacity.
- Parameters:
capacity_data1 (list) – List of capacity values for the first supply curve.
price_data1 (list) – List of price values for the first supply curve.
capacity_data2 (list) – List of capacity values for the second supply curve.
price_data2 (list) – List of price values for the second supply curve.
area (str) – Either the load zone, state name, state abbreviation, or interconnect. Defaults to None because it’s not essential.
gen_type (str) – Generation type. Defaults to None because it’s not essential.
plot (bool) – If True, the supply curve plot is shown. If False, the plot is not shown.
- Returns:
(float) – The maximum price difference between the two supply curves.
- Raises:
TypeError – if the capacity and price inputs are not provided as lists.
ValueError – if the supply curves do not offer the same amount of capacity.
- powersimdata.design.generation.cost_curves.lower_bound_index(desired_capacity, capacity_data)[source]¶
Determines the index of the lower capacity value that defines a price segment. Useful for accessing the prices associated with capacity values that aren’t explicitly stated in the capacity lists that are generated by the build_supply_curve() function. Needed for ks_test().
- Parameters:
desired_capacity (float/int) – Capacity value for which you want to determine the index of the lowest capacity value in a price segment.
capacity_data (list) – List of capacity values used to generate a supply curve.
- Returns:
(int) – Index of a price segment’s capacity lower bound.
- powersimdata.design.generation.cost_curves.plot_capacity_vs_price(grid, num_segments, area, gen_type, area_type=None, plot=True)[source]¶
- Plots the generator capacity vs. the generator price for a specified area
and generation type.
- Parameters:
grid (powersimdata.input.grid.Grid) – Grid object.
num_segments (int) – The number of segments into which the piecewise linear cost curve is split.
area (str) – Either the load zone, state name, state abbreviation, or interconnect.
gen_type (str) – Generation type.
area_type (str) – one of: ‘loadzone’, ‘state’, ‘state_abbr’, ‘interconnect’. If set to None, the type will be inferred.
plot (bool) – If True, the supply curve plot is shown. If False, the plot is not shown.
- Returns:
(None) – The capacity vs. price plot is displayed according to the user.
- Raises:
TypeError – if a powersimdata.input.grid.Grid object is not input.
ValueError – if the specified area or generator type is not applicable.
- powersimdata.design.generation.cost_curves.plot_linear_vs_quadratic_terms(grid, area, gen_type, area_type=None, plot=True, zoom=False, num_sd=3, alpha=0.1)[source]¶
Compares the linear (c1) and quadratic (c2) parameters from the quadratic generator cost curves.
- Parameters:
grid (powersimdata.input.grid.Grid) – Grid object.
area (str) – Either the load zone, state name, state abbreviation, or interconnect.
gen_type (str) – Generation type.
area_type (str) – one of: ‘loadzone’, ‘state’, ‘state_abbr’, ‘interconnect’. if set to None, the type will be inferred.
plot (bool) – If True, the linear term vs. quadratic term plot is shown. If False, the plot is not shown.
zoom (bool) – If True, filters out quadratic term outliers to enable better visualization. If False, there is no filtering.
num_sd (float/int) – The number of standard deviations used to filter out quadratic term outliers.
alpha (float) – The alpha blending value for the scatter plot; takes values between 0 (transparent) and 1 (opaque).
- Returns:
(None) – The linear term vs. quadratic term plot is displayed according to the user.
- Raises:
TypeError – if a powersimdata.input.grid.Grid object is not input.
ValueError – if the specified area or generator type is not applicable.
powersimdata.design.generation.curtailment module¶
- powersimdata.design.generation.curtailment.temporal_curtailment(scenario, pmin_by_type=None, pmin_by_id=None, curtailable=None)[source]¶
Calculate the minimum share of potential renewable energy that will be curtailed due to supply/demand mismatch, assuming no storage is present.
- Parameters:
scenario (powersimdata.scenario.scenario.Scenario) – scenario instance.
pmin_by_type (dict/pandas.Series) – Mapping of types to Pmin assumptions. Values between 0 and 1 (inclusive) are treated as shares of Pmax, and None values either maintain given Pmin values (for dispatchable resources) or track profiles (for profile resources, e.g. hydro).
pmin_by_id (dict/pandas.Series) – Mapping of IDs to Pmin assumptions, as an override to the default behavior for that plant type. Values between 0 and 1 (inclusive) are treated as shares of Pmax, and None values either maintain given Pmin values (for dispatchable resources) or track profiles (for profile resources, e.g. hydro).
curtailable (iterable) – resource types which can be curtailed.
- Returns:
(float) – share of curtailable resources that will be curtailed.
- Raises:
TypeError – if inputs do not mach specified type.
ValueError – if any entries in curtailable or keys in pmin_by_type are not types in the grid, any keys in pmin_by_id are not plant IDs in the Grid, or any values in pmin_by_type/pmin_by_id are not in the range [0, 1] or None.