-
Notifications
You must be signed in to change notification settings - Fork 21
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
Battery storage cost constant version 2 #348
base: develop
Are you sure you want to change the base?
Changes from 22 commits
53f7638
4b85f29
284ec0f
321e353
7cb7460
334f7cf
845e09a
42732c6
eb60c3c
97173fb
711ce88
f5192e3
60374c2
cb91a7e
8e5943d
1c7b658
c8c247d
4a20641
a887e78
88e25c4
6594016
b6fe81d
4138157
7c0acf0
ba610a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,10 @@ worth factor is used in the same manner irrespective of the `maintenance_strateg | |
When modeling degradation the following ElectricStorage inputs are not used: | ||
- `replace_cost_per_kwh` | ||
- `battery_replacement_year` | ||
The are replaced by the `maintenance_cost_per_kwh` vector. | ||
- `installed_cost_constant` | ||
- `replace_cost_constant` | ||
- `cost_constant_replacement_year` | ||
They are replaced by the `maintenance_cost_per_kwh` vector. | ||
Inverter replacement costs and inverter replacement year should still be used to model scheduled replacement of inverter. | ||
|
||
!!! note | ||
|
@@ -169,10 +172,13 @@ end | |
can_grid_charge::Bool = off_grid_flag ? false : true | ||
installed_cost_per_kw::Real = 910.0 | ||
installed_cost_per_kwh::Real = 455.0 | ||
installed_cost_constant::Real = 0.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @toddleif could you please add a brief description of this input to this markdown area? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a great idea. I just added a description. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @toddleif I just modified the description to be in-line with the inputs and to just give a short high-level description of what that input is. Could you review? |
||
replace_cost_per_kw::Real = 715.0 | ||
replace_cost_per_kwh::Real = 318.0 | ||
replace_cost_constant::Real = 0.0 | ||
inverter_replacement_year::Int = 10 | ||
battery_replacement_year::Int = 10 | ||
cost_constant_replacement_year::Int = 10 | ||
macrs_option_years::Int = 7 | ||
macrs_bonus_fraction::Float64 = 0.6 | ||
macrs_itc_reduction::Float64 = 0.5 | ||
|
@@ -204,10 +210,13 @@ Base.@kwdef struct ElectricStorageDefaults | |
can_grid_charge::Bool = off_grid_flag ? false : true | ||
installed_cost_per_kw::Real = 910.0 | ||
installed_cost_per_kwh::Real = 455.0 | ||
installed_cost_constant::Real = 0.0 | ||
replace_cost_per_kw::Real = 715.0 | ||
replace_cost_per_kwh::Real = 318.0 | ||
replace_cost_constant::Real = 0.0 | ||
inverter_replacement_year::Int = 10 | ||
battery_replacement_year::Int = 10 | ||
cost_constant_replacement_year::Int = 10 | ||
macrs_option_years::Int = 7 | ||
macrs_bonus_fraction::Float64 = 0.6 | ||
macrs_itc_reduction::Float64 = 0.5 | ||
|
@@ -245,10 +254,13 @@ struct ElectricStorage <: AbstractElectricStorage | |
can_grid_charge::Bool | ||
installed_cost_per_kw::Real | ||
installed_cost_per_kwh::Real | ||
installed_cost_constant::Real | ||
replace_cost_per_kw::Real | ||
replace_cost_per_kwh::Real | ||
replace_cost_constant::Real | ||
inverter_replacement_year::Int | ||
battery_replacement_year::Int | ||
cost_constant_replacement_year::Int | ||
macrs_option_years::Int | ||
macrs_bonus_fraction::Float64 | ||
macrs_itc_reduction::Float64 | ||
|
@@ -260,6 +272,7 @@ struct ElectricStorage <: AbstractElectricStorage | |
grid_charge_efficiency::Float64 | ||
net_present_cost_per_kw::Real | ||
net_present_cost_per_kwh::Real | ||
net_present_cost_cost_constant::Real | ||
model_degradation::Bool | ||
degradation::Degradation | ||
minimum_avg_soc_fraction::Float64 | ||
|
@@ -318,11 +331,39 @@ struct ElectricStorage <: AbstractElectricStorage | |
|
||
net_present_cost_per_kwh -= s.total_rebate_per_kwh | ||
|
||
net_present_cost_cost_constant = effective_cost(; | ||
itc_basis = s.installed_cost_constant, | ||
replacement_cost = s.cost_constant_replacement_year >= f.analysis_years ? 0.0 : s.replace_cost_constant, | ||
replacement_year = s.cost_constant_replacement_year, | ||
discount_rate = f.owner_discount_rate_fraction, | ||
tax_rate = f.owner_tax_rate_fraction, | ||
itc = s.total_itc_fraction, | ||
macrs_schedule = s.macrs_option_years == 7 ? f.macrs_seven_year : f.macrs_five_year, | ||
macrs_bonus_fraction = s.macrs_bonus_fraction, | ||
macrs_itc_reduction = s.macrs_itc_reduction | ||
|
||
) | ||
|
||
if haskey(d, :degradation) | ||
degr = Degradation(;dictkeys_tosymbols(d[:degradation])...) | ||
else | ||
degr = Degradation() | ||
end | ||
|
||
# copy the replace_costs in case we need to change them | ||
replace_cost_per_kw = s.replace_cost_per_kw | ||
replace_cost_per_kwh = s.replace_cost_per_kwh | ||
replace_cost_constant = s.replace_cost_constant | ||
if s.model_degradation | ||
if haskey(d, :replace_cost_per_kw) && d[:replace_cost_per_kw] != 0.0 || | ||
haskey(d, :replace_cost_per_kwh) && d[:replace_cost_per_kwh] != 0.0 || | ||
haskey(d, :replace_cost_constant) && d[:replace_cost_constant] != 0.0 | ||
@warn "Setting ElectricStorage replacement costs to zero. Using degradation.maintenance_cost_per_kwh instead." | ||
end | ||
replace_cost_per_kw = 0.0 | ||
replace_cost_per_kwh = 0.0 | ||
replace_cost_constant = 0.0 | ||
end | ||
|
||
return new( | ||
s.min_kw, | ||
|
@@ -338,10 +379,13 @@ struct ElectricStorage <: AbstractElectricStorage | |
s.can_grid_charge, | ||
s.installed_cost_per_kw, | ||
s.installed_cost_per_kwh, | ||
s.installed_cost_constant, | ||
replace_cost_per_kw, | ||
replace_cost_per_kwh, | ||
replace_cost_constant, | ||
s.inverter_replacement_year, | ||
s.battery_replacement_year, | ||
s.cost_constant_replacement_year, | ||
s.macrs_option_years, | ||
s.macrs_bonus_fraction, | ||
s.macrs_itc_reduction, | ||
|
@@ -353,6 +397,7 @@ struct ElectricStorage <: AbstractElectricStorage | |
s.grid_charge_efficiency, | ||
net_present_cost_per_kw, | ||
net_present_cost_per_kwh, | ||
net_present_cost_cost_constant, | ||
s.model_degradation, | ||
degr, | ||
s.minimum_avg_soc_fraction, | ||
|
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.
@toddleif If I'm understanding correctly, I think the following could work for avoiding the increased run time even when a cost constant isn't included:
if p.s.storage.attr[b].installed_cost_constant != 0 || p.s.storage.attr[b].replace_cost_constant != 0
toreopt.jl
. Within that statement, add a warning about binary vars and then call "add_elec_storage_cost_constant_constraints".add_prod_incent_vars_and_constraints
as an example)