Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
b9ae178
Cast AC cap as float
ppinchuk Jul 24, 2025
5a520be
Add guard for floating point errors
ppinchuk Jul 24, 2025
7a4d73c
Add `POIFeatures` class +tests
ppinchuk Jul 24, 2025
6786ba3
`connect` method now returns amount of capacity to connect
ppinchuk Jul 24, 2025
e1a3c82
Refactor full sort method
ppinchuk Jul 24, 2025
ca3bb39
Add missing methods
ppinchuk Jul 24, 2025
e96778c
Fix bug
ppinchuk Jul 24, 2025
bea719e
Fix
ppinchuk Jul 24, 2025
7d19dd3
Rename mask attr (WIP)
ppinchuk Jul 24, 2025
a3ce82c
Fix bug with only 0-based GID's
ppinchuk Jul 25, 2025
877d09e
SUpply curve can now accept POI info as input
ppinchuk Jul 25, 2025
281a827
Add functionality to extract trans GID from poi table
ppinchuk Jul 25, 2025
df45add
Update imports
ppinchuk Jul 25, 2025
f38b87a
Spelling
ppinchuk Jul 28, 2025
f539b3c
Minor statement update
ppinchuk Jul 28, 2025
69776e1
Fix typo
ppinchuk Jul 28, 2025
9235ac1
Formatting
ppinchuk Aug 4, 2025
1b9aa49
`trans_table` now an input to functions
ppinchuk Aug 4, 2025
187af87
New connection logic
ppinchuk Aug 4, 2025
d14ae61
Add helper functions
ppinchuk Aug 4, 2025
5c19aba
New full sort logic
ppinchuk Aug 4, 2025
e34c1e7
fcr now an input to full sort
ppinchuk Aug 4, 2025
53efc91
Extra inputs to `_full_sort`
ppinchuk Aug 4, 2025
e32f6b5
Fix full sort calls
ppinchuk Aug 4, 2025
9d58127
Add helpers
ppinchuk Aug 4, 2025
1d6ba80
Add `poi_sort` method
ppinchuk Aug 4, 2025
e5d8f8b
Fix test checker
ppinchuk Aug 4, 2025
0c01cb3
Add POI tests
ppinchuk Aug 4, 2025
f572045
Linter
ppinchuk Aug 4, 2025
f8e7adc
Merge remote-tracking branch 'origin/main' into pp/atm_tx
ppinchuk Aug 7, 2025
5276d69
Add new option to full sort
ppinchuk Aug 7, 2025
ff3a262
Add logic for new option
ppinchuk Aug 7, 2025
4e052c2
Expose new option to user
ppinchuk Aug 7, 2025
3533788
Fix tests
ppinchuk Aug 7, 2025
4ff0947
Fix tests
ppinchuk Aug 7, 2025
e41e1f4
Add cost check
ppinchuk Aug 7, 2025
b20ab6f
Parametrize test
ppinchuk Aug 7, 2025
4bf4f7e
Parametrize test
ppinchuk Aug 7, 2025
35cda1a
Generalize test
ppinchuk Aug 7, 2025
b67b7b9
Parametrize test
ppinchuk Aug 7, 2025
9e81e62
parametrize test
ppinchuk Aug 7, 2025
66fb33d
parametrize test
ppinchuk Aug 7, 2025
16192ec
Add test with partial connections
ppinchuk Aug 7, 2025
e92ee45
Add new functionality as CLI command
ppinchuk Aug 7, 2025
d42791a
Linter fixes
ppinchuk Aug 7, 2025
a4d66b3
Linter fix
ppinchuk Aug 8, 2025
665563a
Add new arg
ppinchuk Aug 21, 2025
05a43c9
Rename var
ppinchuk Aug 21, 2025
19c86fd
Add new function
ppinchuk Aug 21, 2025
ace8fe6
Add limit to no-scale
ppinchuk Aug 21, 2025
d194851
Use new method
ppinchuk Aug 21, 2025
d1a4481
Pass down arg
ppinchuk Aug 21, 2025
f02f2f4
Add logging statements
ppinchuk Aug 21, 2025
aca9412
Add connection upper limit logic to entire algorithm
ppinchuk Aug 21, 2025
8bba2cd
Update logger statement
ppinchuk Aug 21, 2025
6298adb
Add tests for upper limit
ppinchuk Aug 21, 2025
2823d34
Connections at max capacity now done in priority order
ppinchuk Aug 22, 2025
8f6a92b
Add connections at priority order
ppinchuk Aug 22, 2025
d7c984b
Remove 0 cap points in addition to null LCOT
ppinchuk Sep 15, 2025
4f6bd03
Linter fixes
ppinchuk Sep 15, 2025
d000eb8
Try linter fix
ppinchuk Sep 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions reV/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from reV.handlers.cli_multi_year import my_command
from reV.supply_curve.cli_sc_aggregation import (sc_agg_command,
sc_col_descriptions)
from reV.supply_curve.cli_supply_curve import sc_command
from reV.supply_curve.cli_supply_curve import sc_command, sc_poi_command
from reV.supply_curve.cli_tech_mapping import tm_command
from reV.rep_profiles.cli_rep_profiles import rep_profiles_command
from reV.hybrids.cli_hybrids import hybrids_command
Expand All @@ -26,7 +26,7 @@


commands = [bespoke_command, gen_command, econ_command, collect_command,
my_command, tm_command, sc_agg_command, sc_command,
my_command, tm_command, sc_agg_command, sc_command, sc_poi_command,
rep_profiles_command, hybrids_command, nrwal_command,
qa_qc_command]
main = make_cli(commands, info={"name": "reV", "version": __version__})
Expand Down
108 changes: 101 additions & 7 deletions reV/handlers/transmission.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ def _features_from_table(self, trans_table):
cap_frac = self._avail_cap_frac
if "ac_cap" not in trans_table:
trans_table["ac_cap"] = -1
trans_table['ac_cap'] = trans_table['ac_cap'].astype(np.float32)
trans_features = trans_table.groupby(SupplyCurveField.TRANS_GID)
trans_features = trans_features.first()

Expand Down Expand Up @@ -369,7 +370,7 @@ def _update_availability(self, gid):
Feature gid to check
"""
avail_cap = self.available_capacity(gid)
if avail_cap == 0:
if avail_cap is not None and avail_cap <= 0:
self._available_mask[gid] = False

def check_availability(self, gid):
Expand Down Expand Up @@ -504,7 +505,7 @@ def connect(self, gid, capacity, apply=True):
Parameters
----------
gid : int
Unique id of feature of intereset
Unique id of feature of interest
capacity : float
Capacity needed in MW
apply : bool
Expand All @@ -513,15 +514,15 @@ def connect(self, gid, capacity, apply=True):

Returns
-------
connected : bool
Flag as to whether connection is possible or not
connected : float
Amount of capacity possible to connect
"""
if self.check_availability(gid):
avail_cap = self.available_capacity(gid)
if avail_cap is not None and capacity > avail_cap:
connected = False
connected = 0
else:
connected = True
connected = capacity
if apply:
feature_type = self[gid]['type']
if feature_type == 'transline':
Expand All @@ -534,7 +535,7 @@ def connect(self, gid, capacity, apply=True):

self._update_availability(gid)
else:
connected = False
connected = 0

return connected

Expand Down Expand Up @@ -624,6 +625,99 @@ def feature_capacity(cls, trans_table, avail_cap_frac=1):
return feature_cap


class POIFeatures(TransmissionFeatures):
"""Class that allows incremental connections to POI's"""

def __init__(self, trans_table):
"""

Parameters
----------
trans_table : str | pandas.DataFrame
Path to .csv or config file or DataFrame with supply curve
transmission mapping. This table is only used to track
remaining available capacity for connecting to POI's. Must
have the following columns:

- "trans_gid": Unique ID for every transmission feature
- "ac_cap": Available capacity for connection (in MW)


"""
super().__init__(trans_table, line_tie_in_cost=0, line_cost=0,
station_tie_in_cost=0, center_tie_in_cost=0,
sink_tie_in_cost=0, avail_cap_frac=1,
line_limited=False)

def _features_from_table(self, trans_table):
"""
Extract features and their capacity from supply curve transmission
mapping table

Parameters
----------
trans_table : pandas.DataFrame
DataFrame of transmission features

Returns
-------
features : dict of dicts
Nested dictionary of trans_gid -> poi capacity info.
"""

features = {}
trans_table['ac_cap'] = trans_table['ac_cap'].astype(np.float32)
trans_features = trans_table.groupby(SupplyCurveField.TRANS_GID)
trans_features = trans_features.first()

for gid, feature in trans_features.iterrows():
feature_dict = {'type': "poi",
SupplyCurveField.TRANS_CAPACITY: feature['ac_cap']}

features[gid] = feature_dict

return features

def connect(self, gid, capacity):
"""
Check if you can connect to given feature
If apply, update internal dictionary accordingly

Parameters
----------
gid : int
Unique id of feature of interest
capacity : float
Capacity needed in MW
apply : bool
Apply capacity to feature with given gid and update
internal dictionary

Returns
-------
connected : bool
Flag as to whether connection is possible or not
"""
if not self.check_availability(gid):
return 0

avail_cap = self.available_capacity(gid)
if avail_cap is None:
return 0

connect_capacity = min(capacity, avail_cap)
self._connect(gid, connect_capacity)
self._update_availability(gid)
return connect_capacity

def cost(self, *__, **___):
raise NotImplementedError("Cost computation not supported for POIs")

@staticmethod
def _calc_cost(*__, **___):
raise NotImplementedError("Cost computation not supported for POIs")


class TransmissionCosts(TransmissionFeatures):
"""
Class to compute supply curve -> transmission feature costs
Expand Down
5 changes: 5 additions & 0 deletions reV/supply_curve/cli_supply_curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ def _preprocessor(config, out_dir):
config_preprocessor=_preprocessor)
main = as_click_command(sc_command)

sc_poi_command = CLICommandFromClass(SupplyCurve, method="run_poi",
name=str(ModuleName.SUPPLY_CURVE_POI),
add_collect=False, split_keys=None,
config_preprocessor=_preprocessor)


if __name__ == '__main__':
try:
Expand Down
Loading
Loading