Repository navigation
Battery cost model and updates to performance model #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
244df1f
added battery cost model and updated pysam battery so capacity is input
elenya-grant 692726b
updated pysam battery
elenya-grant 5415a40
comment out name the linter did not accept
jaredthomas68 76952a7
added docstring for battery cost model
elenya-grant e5cfe42
resolve merge conflicts
jaredthomas68 37d64d4
remove todo
jaredthomas68 18a03fb
add blank line
jaredthomas68 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| from attrs import field, define | ||
|
|
||
| from h2integrate.core.utilities import CostModelBaseConfig, merge_shared_inputs | ||
| from h2integrate.core.validators import gt_zero, range_val | ||
| from h2integrate.core.model_baseclasses import CostModelBaseClass | ||
|
|
||
|
|
||
| @define | ||
| class ATBBatteryCostConfig(CostModelBaseConfig): | ||
| """Configuration class for the ATBBatteryCostModel with costs based on storage | ||
| capacity and charge rate. More information on ATB methodology and representative | ||
| battery technologies can be found | ||
| `here <https://atb.nrel.gov/electricity/2024/utility-scale_battery_storage>`_ | ||
| Reference cost values can be found on the `Utility-Scale Battery Storage`, | ||
| `Commercial Battery Storage`, and `Residential Battery Storage` sheets of the | ||
| `NREL ATB workbook <https://atb.nrel.gov/electricity/2024/data>`_. | ||
|
|
||
| Attributes: | ||
| energy_capex (float|int): battery energy capital cost in $/kWh | ||
| power_capex (float|int): battery power capital cost in $/kW | ||
| opex_fraction (float): annual operating cost as a fraction of the total system cost. | ||
| cost_year (int): dollar year corresponding to input costs | ||
| """ | ||
|
|
||
| energy_capex: float | int = field(validator=gt_zero) | ||
| power_capex: float | int = field(validator=gt_zero) | ||
| opex_fraction: float = field(validator=range_val(0, 1)) | ||
|
|
||
|
|
||
| class ATBBatteryCostModel(CostModelBaseClass): | ||
| """This cost model is based on the equations in the "Utility-Scale Battery Storage" | ||
| sheet in the ATB 2024 workbook. | ||
|
|
||
| - Cell E29 has the equation for CapEx. Also found in the cells for the CapEx section. | ||
| - Cell G121 (all the cells in the Fixed Operation and Maintenance Expenses | ||
| section) include the equation to calculate fixed o&m costs. | ||
|
|
||
| Total_CapEx = Energy_CapEx * Storage_Hours + Power_CapEx | ||
|
|
||
| - Total_CapEx: Total System Cost (USD/kW) | ||
| - Storage_Hours: Storage Duration (hr) | ||
| - Energy_CapEx: Battery Energy Cost (USD/kWh) | ||
| - Power_CapEx: Battery Power Cost (USD/kW) | ||
|
|
||
| """ | ||
|
|
||
| def setup(self): | ||
| self.config = ATBBatteryCostConfig.from_dict( | ||
| merge_shared_inputs(self.options["tech_config"]["model_inputs"], "cost") | ||
| ) | ||
|
|
||
| super().setup() | ||
|
|
||
| self.add_input("charge_rate", val=0.0, units="kW", desc="Battery charge/discharge rate") | ||
| self.add_input("storage_capacity", val=0.0, units="kW*h", desc="Battery storage capacity") | ||
|
|
||
| def compute(self, inputs, outputs, discrete_inputs, discrete_outputs): | ||
| storage_duration_hrs = inputs["storage_capacity"][0] / inputs["charge_rate"][0] | ||
|
|
||
| # CapEx equation from Cell E29 | ||
| total_system_cost = ( | ||
| storage_duration_hrs * self.config.energy_capex | ||
| ) + self.config.power_capex | ||
| capex = total_system_cost * inputs["charge_rate"][0] | ||
| # OpEx equation from cells in the Fixed Operation and Maintenance Expenses section | ||
| opex = self.config.opex_fraction * capex | ||
| outputs["CapEx"] = capex | ||
| outputs["OpEx"] = opex | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not confident on the math here for lines 44-50. I also think total_system_cost is confusing when we use that to calculate capex. Can you include the reference in the ATB for the cell where the equation(s) is(are) you are using?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done