Skip to content

Commit

Permalink
Merge pull request #479 from NREL/pp/cost_in_mw_instead_kw
Browse files Browse the repository at this point in the history
Fix cost units
  • Loading branch information
ppinchuk authored Oct 23, 2024
2 parents a6c1bf7 + 23c286d commit 09f04bb
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 18 deletions.
4 changes: 2 additions & 2 deletions reV/bespoke/bespoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,7 @@ def run_wind_plant_ts(self):
self._meta[SupplyCurveField.MEAN_CF_DC] = np.nan
self._meta[SupplyCurveField.MEAN_CF_AC] = np.nan
self._meta[SupplyCurveField.MEAN_LCOE] = np.nan
self._meta[SupplyCurveField.SC_POINT_ANNUAL_ENERGY_MW] = np.nan
self._meta[SupplyCurveField.SC_POINT_ANNUAL_ENERGY_MWH] = np.nan
# copy dataset outputs to meta data for supply curve table summary
if "cf_mean-means" in self.outputs:
self._meta.loc[:, SupplyCurveField.MEAN_CF_AC] = self.outputs[
Expand All @@ -1294,7 +1294,7 @@ def run_wind_plant_ts(self):
]
self.recalc_lcoe()
if "annual_energy-means" in self.outputs:
self._meta[SupplyCurveField.SC_POINT_ANNUAL_ENERGY_MW] = (
self._meta[SupplyCurveField.SC_POINT_ANNUAL_ENERGY_MWH] = (
self.outputs["annual_energy-means"] / 1000
)

Expand Down
8 changes: 4 additions & 4 deletions reV/supply_curve/points.py
Original file line number Diff line number Diff line change
Expand Up @@ -2154,7 +2154,7 @@ def fixed_charge_rate(self):
return self.exclusion_weighted_mean(self.gen["fixed_charge_rate"])

@property
def _sam_system_capacity(self):
def _sam_system_capacity_kw(self):
"""float: Mean SAM generation system capacity input, defaults to 0. """
if self._ssc is not None:
return self._ssc
Expand Down Expand Up @@ -2187,14 +2187,14 @@ def _sam_lcoe_kwargs(self):

def _compute_cost_per_ac_mw(self, dset):
"""Compute a cost per AC MW for a given input. """
if self._sam_system_capacity <= 0:
if self._sam_system_capacity_kw <= 0:
return None

if dset not in self.gen.datasets:
return None

sam_cost = self.exclusion_weighted_mean(self.gen[dset])
sam_cost_per_mw = sam_cost / self._sam_system_capacity
sam_cost_per_mw = sam_cost / (self._sam_system_capacity_kw / 1000)
sc_point_cost = sam_cost_per_mw * self.capacity

ac_cap = (self.capacity
Expand Down Expand Up @@ -2318,7 +2318,7 @@ def point_summary(self, args=None):
SupplyCurveField.CAPACITY_DC_MW: self.capacity_dc,
SupplyCurveField.EOS_MULT: 1, # added later
SupplyCurveField.REG_MULT: self.regional_multiplier,
SupplyCurveField.SC_POINT_ANNUAL_ENERGY_MW: (
SupplyCurveField.SC_POINT_ANNUAL_ENERGY_MWH: (
self.sc_point_annual_energy
),
SupplyCurveField.COST_SITE_OCC_USD_PER_AC_MW: (
Expand Down
4 changes: 2 additions & 2 deletions reV/utilities/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class SupplyCurveField(FieldEnum):
RAW_LCOE = "lcoe_raw_usd_per_mwh"
EOS_MULT = "multiplier_cc_eos"
REG_MULT = "multiplier_cc_regional"
SC_POINT_ANNUAL_ENERGY_MW = "annual_energy_site_mwh"
SC_POINT_ANNUAL_ENERGY_MWH = "annual_energy_site_mwh"
COST_BASE_OCC_USD_PER_AC_MW = "cost_base_occ_usd_per_ac_mw"
COST_SITE_OCC_USD_PER_AC_MW = "cost_site_occ_usd_per_ac_mw"
COST_BASE_FOC_USD_PER_AC_MW = "cost_base_foc_usd_per_ac_mw"
Expand Down Expand Up @@ -248,7 +248,7 @@ class _LegacySCAliases(Enum):
N_PARALLEL_TRANS = "n_parallel_trans"
EOS_MULT = "eos_mult", "capital_cost_multiplier"
REG_MULT = "reg_mult"
SC_POINT_ANNUAL_ENERGY_MW = "sc_point_annual_energy"
SC_POINT_ANNUAL_ENERGY_MWH = "sc_point_annual_energy"
POI_LAT = "poi_lat"
POI_LON = "poi_lon"
REINFORCEMENT_POI_LAT = "reinforcement_poi_lat"
Expand Down
2 changes: 1 addition & 1 deletion reV/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
reV Version number
"""

__version__ = "0.9.5"
__version__ = "0.9.6"
6 changes: 3 additions & 3 deletions tests/test_bespoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
SupplyCurveField.CAPACITY_DC_MW,
SupplyCurveField.MEAN_CF_AC,
SupplyCurveField.MEAN_CF_DC,
SupplyCurveField.SC_POINT_ANNUAL_ENERGY_MW,
SupplyCurveField.SC_POINT_ANNUAL_ENERGY_MWH,
SupplyCurveField.EOS_MULT,
SupplyCurveField.REG_MULT,
SupplyCurveField.COST_BASE_OCC_USD_PER_AC_MW,
Expand Down Expand Up @@ -660,7 +660,7 @@ def test_bespoke():
atol=0.01)
assert np.allclose(
f["annual_energy-means"] / 1000,
meta[SupplyCurveField.SC_POINT_ANNUAL_ENERGY_MW]
meta[SupplyCurveField.SC_POINT_ANNUAL_ENERGY_MWH]
)

dsets_2d = (
Expand Down Expand Up @@ -694,7 +694,7 @@ def test_bespoke():
* meta[SupplyCurveField.CAPACITY_AC_MW])
voc = (meta[SupplyCurveField.COST_SITE_VOC_USD_PER_AC_MW]
* meta[SupplyCurveField.CAPACITY_AC_MW])
aep = meta[SupplyCurveField.SC_POINT_ANNUAL_ENERGY_MW]
aep = meta[SupplyCurveField.SC_POINT_ANNUAL_ENERGY_MWH]
lcoe_site = lcoe_fcr(fcr, cap_cost, foc, aep, voc)

cap_cost = (meta[SupplyCurveField.COST_BASE_OCC_USD_PER_AC_MW]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_econ_of_scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def test_econ_of_scale_baseline(request_h5):
capital_cost_per_mw = SupplyCurveField.COST_SITE_OCC_USD_PER_AC_MW
assert np.allclose(sc_df['mean_capital_cost'],
sc_df[capital_cost_per_mw]
* data["system_capacity"])
* data["system_capacity"] / 1000)
assert np.allclose(sc_df[SupplyCurveField.COST_BASE_OCC_USD_PER_AC_MW],
sc_df[SupplyCurveField.COST_SITE_OCC_USD_PER_AC_MW])

Expand Down
12 changes: 7 additions & 5 deletions tests/test_supply_curve_sc_aggregation.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,11 @@ def test_agg_summary_solar_ac(pd):
assert np.allclose(summary[SupplyCurveField.CAPACITY_DC_MW]
* summary[SupplyCurveField.MEAN_CF_DC]
* 8760,
summary[SupplyCurveField.SC_POINT_ANNUAL_ENERGY_MW])
summary[SupplyCurveField.SC_POINT_ANNUAL_ENERGY_MWH])
assert np.allclose(summary[SupplyCurveField.CAPACITY_AC_MW]
* summary[SupplyCurveField.MEAN_CF_AC]
* 8760,
summary[SupplyCurveField.SC_POINT_ANNUAL_ENERGY_MW])
summary[SupplyCurveField.SC_POINT_ANNUAL_ENERGY_MWH])


def test_multi_file_excl():
Expand Down Expand Up @@ -582,6 +582,8 @@ def test_recalc_lcoe(cap_cost_scale):
assert np.allclose(summary[SupplyCurveField.EOS_MULT],
summary[SupplyCurveField.COST_SITE_OCC_USD_PER_AC_MW]
/ summary[SupplyCurveField.COST_BASE_OCC_USD_PER_AC_MW])
assert np.allclose(data['capital_cost'] / data['system_capacity'] * 1000,
summary[SupplyCurveField.COST_BASE_OCC_USD_PER_AC_MW])

expected_recalc_lcoe = lcoe_fcr(data["fixed_charge_rate"],
data["capital_cost"],
Expand All @@ -604,9 +606,9 @@ def test_recalc_lcoe(cap_cost_scale):
* summary[SupplyCurveField.CAPACITY_AC_MW])
voc = (summary[SupplyCurveField.COST_SITE_VOC_USD_PER_AC_MW]
* summary[SupplyCurveField.CAPACITY_AC_MW])
aep = summary[SupplyCurveField.SC_POINT_ANNUAL_ENERGY_MW]
aep_kwh = summary[SupplyCurveField.SC_POINT_ANNUAL_ENERGY_MWH] * 1000

lcoe = lcoe_fcr(fcr, cap_cost, foc, aep, voc)
lcoe = lcoe_fcr(fcr, cap_cost, foc, aep_kwh, voc)
assert np.allclose(lcoe, summary[SupplyCurveField.MEAN_LCOE])

cap_cost = (summary[SupplyCurveField.COST_BASE_OCC_USD_PER_AC_MW]
Expand All @@ -618,7 +620,7 @@ def test_recalc_lcoe(cap_cost_scale):
voc = (summary[SupplyCurveField.COST_BASE_VOC_USD_PER_AC_MW]
* summary[SupplyCurveField.CAPACITY_AC_MW])

lcoe = lcoe_fcr(fcr, cap_cost, foc, aep, voc)
lcoe = lcoe_fcr(fcr, cap_cost, foc, aep_kwh, voc)
assert np.allclose(lcoe, summary[SupplyCurveField.MEAN_LCOE])


Expand Down

0 comments on commit 09f04bb

Please sign in to comment.