powersimdata.design.investment package¶
Subpackages¶
- powersimdata.design.investment.tests package
- Submodules
- powersimdata.design.investment.tests.test_investment_costs module
mock_grid()
test_calculate_ac_inv_costs()
test_calculate_ac_inv_costs_lines_only()
test_calculate_ac_inv_costs_not_summed()
test_calculate_ac_inv_costs_transformers_only()
test_calculate_dc_inv_costs()
test_calculate_dc_inv_costs_not_summed()
test_calculate_gen_inv_costs_2030()
test_calculate_gen_inv_costs_not_summed()
- Module contents
Submodules¶
powersimdata.design.investment.const module¶
powersimdata.design.investment.create_mapping_files module¶
- powersimdata.design.investment.create_mapping_files.bus_to_neem_reg(df)[source]¶
Map bus to NEEM regions.
- Parameters:
df (pandas.DataFrame) – bus data frame.
- Returns:
(pandas.DataFrame) – index: bus id, columns: lat, lon, name_abbr (NEEM region)
Note
the shapefile used for mapping is pulled from the Energy Zones Mapping tool. This map is overly detailed, so the shapes are simplified using 1 km distance (Douglas-Peucker) method in QGIS.
- powersimdata.design.investment.create_mapping_files.bus_to_reeds_reg(df)[source]¶
Map bus to ReEDS regions.
- Parameters:
df (pandas.DataFrame) – bus data frame.
- Returns:
(pandas.DataFrame) – index: bus id, columns rs (wind resource region) and rb (BA region).
- powersimdata.design.investment.create_mapping_files.points_to_polys(df, name, shpfile, search_dist=0.04)[source]¶
Map node to closest region.
- Parameters:
df (pandas.DataFrame) – data frame with node id as index and ‘lat’ and ‘lon’ as columns.
name (str) – name of node, e.g., bus, plant, substation, etc.
shpfile (str) – shapefile enclosing Polygon/Multipolygon with region id.
search_dist (float/int) – radius around point to detect polygons.
- Raises:
ValueError – if some points are dropped because too far away from polygons.
- Returns:
(geopandas.GeoDataFrame) – columns: id name, (point) geometry, region and properties of region.
- powersimdata.design.investment.create_mapping_files.sjoin_nearest(left_df, right_df, search_dist=0.06)[source]¶
Perform a spatial join between two input layers.
- Parameters:
left_df (geopandas.GeoDataFrame) – A dataframe of Points.
right_df (geopandas.GeoDataFrame) – A dataframe of Polygons/Multipolygons.
search_dist (float/int) – radius (in map units) around point to detect polygons.
- Returns:
(geopandas.GeoDataFrame) – data frame of Points mapped to each Polygon.
Note
data from nearest Polygon/Multipolygon will be used as a result if a Point falls outside all available Polygon/Multipolygons.
- powersimdata.design.investment.create_mapping_files.write_bus_neem_map(base_grid)[source]¶
Write bus location to NEEM region mapping to file.
- Parameters:
base_grid (powersimdata.input.grid.Grid) – a Grid instance.
- Raises:
TypeError – if
base_grid
is not a Grid instance.
- powersimdata.design.investment.create_mapping_files.write_bus_reeds_map(base_grid)[source]¶
Write bus location to ReEDS region mapping to file.
- Parameters:
base_grid (powersimdata.input.grid.Grid) – a Grid instance.
- Raises:
TypeError – if
base_grid
is not a Grid instance.
powersimdata.design.investment.inflation module¶
- powersimdata.design.investment.inflation.calculate_inflation(start_year, end_year=None)[source]¶
Calculate the overall inflation between two years.
- Parameters:
start_year (int) – Year to start calculating inflation from.
end_year (int/None) – Year to calculate inflation to. Calculates using the rates from [start_year, end_year), since we calculate _to_ end_year, not _through_ end_year. If None, inflates to as recent as possible.
- Returns:
(float) – Inflation factor.
powersimdata.design.investment.investment_costs module¶
- powersimdata.design.investment.investment_costs.append_keep_index_name(df1, df2, *args, **kwargs)[source]¶
Append
df2
todf1
, preserving the index name of the first data frame.- Parameters:
df1 (pandas.DataFrame) – first data frame.
df2 (pandas.DataFrame) – second data frame.
*args – arbitrary positional arguments passed to pandas
concat()
.**kwargs – arbitrary keyword arguments passed to pandas
concat()
.
- Returns:
(pandas.DataFrame) –
df2
appended todf1
with index name set to name ofdf1
index.
- powersimdata.design.investment.investment_costs.calculate_ac_inv_costs(scenario, sum_results=True, exclude_branches=None, base_grid=None)[source]¶
Calculate cost of upgrading AC lines and/or transformers in a scenario. NEEM regions are used to find regional multipliers.
- Parameters:
scenario (powersimdata.scenario.scenario.Scenario) – scenario instance.
sum_results (bool) – whether to sum data frame for each branch type. Defaults to True.
base_grid (powersimdata.input.grid.Grid) – a Grid to compare against. If None, the grid model and interconnect from the
scenario
are used to instantiate a corresponding unmodified Grid.
- Returns:
(dict) – keys are {‘line_cost’, ‘transformer_cost’}, values are either float if
sum_results
, or pandas Series indexed by branch ID. Whether summed or not, values are $USD, inflation-adjusted to today.
- powersimdata.design.investment.investment_costs.calculate_dc_inv_costs(scenario, sum_results=True, base_grid=None)[source]¶
Calculate cost of upgrading HVDC lines in a scenario.
- Parameters:
scenario (powersimdata.scenario.scenario.Scenario) – scenario instance.
sum_results (bool) – whether to sum series to return total cost. Defaults to True.
base_grid (powersimdata.input.grid.Grid) – a Grid to compare against. If None, the grid model and interconnect from the
scenario
are used to instantiate a corresponding unmodified Grid.
- Returns:
(pandas.Series/float) – cost of upgrading HVDC lines, in $USD, inflation-adjusted to today. If
sum_results
, a float is returned, otherwise a Series.
- powersimdata.design.investment.investment_costs.calculate_gen_inv_costs(scenario, year, cost_case, sum_results=True, base_grid=None)[source]¶
Calculate cost of upgrading generators in a scenario. ReEDS regions are used to find regional multipliers.
- Parameters:
scenario (powersimdata.scenario.scenario.Scenario) – scenario instance.
year (int/str) – building year.
cost_case (str) – ATB cost case of data. ‘Moderate’: mid cost case, ‘Conservative’: generally higher costs, ‘Advanced’: generally lower costs
sum_results (bool) – whether to sum data frame for plant costs. Defaults to True.
base_grid (powersimdata.input.grid.Grid) – a Grid to compare against. If None, the grid model and interconnect from the
scenario
are used to instantiate a corresponding unmodified Grid.
- Returns:
(pandas.Series) – Overnight generation investment cost. If
sum_results
, indices are technologies and values are total cost. Otherwise, indices are IDs of plants (including storage, which is given pseudo-plant-IDs), and values are individual generator costs. Whether summed or not, values are $USD, inflation-adjusted to today.
Todo
it currently uses one (arbitrary) sub-technology. The rest of the costs are dropped. Wind and solar will need to be fixed based on the resource supply curves.
- powersimdata.design.investment.investment_costs.merge_keep_index(df1, df2, **kwargs)[source]¶
Merge
df1
anddf2
, preserving the index of the first dataframe.- Parameters:
df1 (pandas.DataFrame) – first data frame, to call pandas
merge()
from.df2 (pandas.DataFrame) – second data frame, argument to pandas
merge()
.**kwargs – arbitrary keyword arguments passed to pandas
merge()
.
- Returns:
(pandas.DataFrame) –
df1
merged withdf2
with indices preserved.