Skip to content

Commit

Permalink
Align SAM costs passthrough for geothermal runs
Browse files Browse the repository at this point in the history
  • Loading branch information
ppinchuk committed Jun 18, 2024
1 parent 71764f2 commit 6d2c7c6
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 7 deletions.
38 changes: 31 additions & 7 deletions reV/SAM/generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1786,6 +1786,10 @@ def _set_nameplate_to_match_resource_potential(self, resource):
"{}".format(self.sam_sys_inputs["nameplate"])
)
logger.info(msg)
# required for downstream LCOE calcs
self.sam_sys_inputs["system_capacity"] = (
self.sam_sys_inputs["nameplate"]
)
return

val = set(resource["potential_MW"].unique())
Expand All @@ -1801,6 +1805,8 @@ def _set_nameplate_to_match_resource_potential(self, resource):

logger.debug("Setting the nameplate to {}".format(val))
self.sam_sys_inputs["nameplate"] = val
# required for downstream LCOE calcs
self.sam_sys_inputs["system_capacity"] = val

def _set_resource_potential_to_match_gross_output(self):
"""Set the resource potential input to match the gross generation.
Expand Down Expand Up @@ -1861,7 +1867,9 @@ def _set_costs(self):
logger.debug(
"Setting the capital_cost to ${:,.2f}".format(capital_cost)
)
self.sam_sys_inputs["capital_cost"] = capital_cost
reg_mult = self.sam_sys_inputs.get("capital_cost_multiplier", 1)
self.sam_sys_inputs["base_capital_cost"] = capital_cost
self.sam_sys_inputs["capital_cost"] = capital_cost * reg_mult

dc_per_well = self.sam_sys_inputs.pop("drill_cost_per_well", None)
num_wells = self.sam_sys_inputs.pop(
Expand All @@ -1884,19 +1892,35 @@ def _set_costs(self):
drill_cost, num_wells, dc_per_well
)
)
self.sam_sys_inputs["capital_cost"] = capital_cost + drill_cost
reg_mult = self.sam_sys_inputs.get(
"capital_cost_multiplier", 1
)
base_cc = capital_cost / reg_mult
new_base_cc = base_cc + drill_cost
self.sam_sys_inputs["base_capital_cost"] = new_base_cc
self.sam_sys_inputs["capital_cost"] = new_base_cc * reg_mult

foc_per_kw = self.sam_sys_inputs.pop(
"fixed_operating_cost_per_kw", None
)
if foc_per_kw is not None:
fixed_operating_cost = foc_per_kw * plant_size_kw
foc = foc_per_kw * plant_size_kw
logger.debug(
"Setting the fixed_operating_cost to ${:,.2f}".format(
capital_cost
)
"Setting the fixed_operating_cost to ${:,.2f}".format(foc)
)
self.sam_sys_inputs["base_fixed_operating_cost"] = foc
self.sam_sys_inputs["fixed_operating_cost"] = foc

voc_per_kw = self.sam_sys_inputs.pop(
"variable_operating_cost_per_kw", None
)
if voc_per_kw is not None:
voc = voc_per_kw * plant_size_kw
logger.debug(
"Setting the variable_operating_cost to ${:,.2f}".format(voc)
)
self.sam_sys_inputs["fixed_operating_cost"] = fixed_operating_cost
self.sam_sys_inputs["base_variable_operating_cost"] = voc
self.sam_sys_inputs["variable_operating_cost"] = voc

def _create_pysam_wfile(self, resource, meta):
"""Create PySAM weather input file.
Expand Down
35 changes: 35 additions & 0 deletions tests/test_gen_geothermal.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ def test_gen_geothermal(depth, sample_resource_data):
"lcoe_fcr": 12.52,
"nameplate": 200_000,
"resource_temp": 150,
"capital_cost" : 172485199.53989035,
"fixed_operating_cost" : 4885201.7298879623,
"variable_operating_cost" : 0,
"fixed_charge_rate" : 0.098000000000000004,
"base_capital_cost" : 172485199.53989035,
"base_fixed_operating_cost" : 4885201.7298879623,
"base_variable_operating_cost" : 0,
"system_capacity": 200_000,
}
for dset in output_request:
truth = truth_vals[dset]
Expand Down Expand Up @@ -156,6 +164,14 @@ def test_gen_geothermal_temp_too_low(sample_resource_data):
"lcoe_fcr": 0,
"nameplate": 0,
"resource_temp": 60,
"capital_cost" : 0,
"fixed_operating_cost" : 0,
"variable_operating_cost" : 0,
"fixed_charge_rate" : 0,
"base_capital_cost" : 0,
"base_fixed_operating_cost" : 0,
"base_variable_operating_cost" : 0,
"system_capacity": 0,
}
for dset in output_request:
truth = truth_vals[dset]
Expand Down Expand Up @@ -207,7 +223,13 @@ def test_per_kw_cost_inputs(sample_resource_data):
truth_vals = {
"capital_cost": 383_086_656,
"fixed_operating_cost": 25539104,
"variable_operating_cost" : 0,
"lcoe_fcr": 72.5092,
"fixed_charge_rate" : 0.098000000000000004,
"base_capital_cost" : 383_086_656,
"base_fixed_operating_cost" : 25539104,
"base_variable_operating_cost" : 0,
"system_capacity": 383_086_656 / 3_000,
}
for dset in output_request:
truth = truth_vals[dset]
Expand Down Expand Up @@ -257,7 +279,12 @@ def test_drill_cost_inputs(sample_resource_data):
truth_vals = {
"capital_cost": 466_134_733,
"fixed_operating_cost": 25539104,
"variable_operating_cost" : 0,
"lcoe_fcr": 81.8643,
"fixed_charge_rate" : 0.098000000000000004,
"base_capital_cost" : 466_134_733,
"base_fixed_operating_cost" : 25539104,
"base_variable_operating_cost" : 0,
}
for dset in output_request:
truth = truth_vals[dset]
Expand Down Expand Up @@ -315,6 +342,14 @@ def test_gen_with_nameplate_input(sample_resource_data):
"lcoe_fcr": 62.613,
"nameplate": 40_000,
"resource_temp": 150,
"capital_cost" : 172485199.53989035,
"fixed_operating_cost" : 4885201.7298879623,
"variable_operating_cost" : 0,
"fixed_charge_rate" : 0.098000000000000004,
"base_capital_cost" : 172485199.53989035,
"base_fixed_operating_cost" : 4885201.7298879623,
"base_variable_operating_cost" : 0,
"system_capacity": 40_000,
}
for dset in output_request:
truth = truth_vals[dset]
Expand Down

0 comments on commit 6d2c7c6

Please sign in to comment.