Skip to content

Commit 857b2a3

Browse files
authored
Merge pull request #53 from NREL/develop
bug fix URDB fixed charges
2 parents ef113f6 + 65a6550 commit 857b2a3

6 files changed

Lines changed: 33 additions & 23 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# REopt Changelog
22

3+
## v0.15.2
4+
- bug fix for 15 & 30 minute electric, heating, and cooling loads
5+
- bug fix for URDB fixed charges
6+
- bug fix for default `Wind` `installed_cost_per_kw` and `federal_itc_pct`
7+
38
## v0.15.1
49
- add `AbsorptionChiller` technology
510
- add `ElectricStorage.minimum_avg_soc_fraction` input and constraint

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "REopt"
22
uuid = "d36ad4e8-d74a-4f7a-ace1-eaea049febf6"
33
authors = ["Nick Laws <nick.laws@nrel.gov>"]
4-
version = "0.15.1"
4+
version = "0.15.2"
55

66
[deps]
77
ArchGDAL = "c9ce4bd3-c3d5-55b8-8973-c0e20141b8c3"

src/core/reopt_inputs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ function setup_gen_inputs(s::AbstractScenario, max_sizes, min_sizes, existing_si
468468
cap_cost_slope, om_cost_per_kw, production_factor, techs_by_exportbin,
469469
segmented_techs, n_segs_by_tech, seg_min_size, seg_max_size, seg_yint, techs_no_curtail
470470
)
471-
max_sizes["Generator"] = s.generator.max_kw
471+
max_sizes["Generator"] = s.generator.existing_kw + s.generator.max_kw
472472
min_sizes["Generator"] = s.generator.existing_kw + s.generator.min_kw
473473
existing_sizes["Generator"] = s.generator.existing_kw
474474
update_cost_curve!(s.generator, "Generator", s.financial,

src/core/urdb.jl

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -525,25 +525,30 @@ function parse_urdb_fixed_charges(d::Dict)
525525
min_monthly = 0.0
526526

527527
# first try $/month, then check if $/day exists, as of 1/28/2020 there were only $/day and $month entries in the URDB
528-
if get(d, "fixedchargeunits", "") == "\$/month"
529-
fixed_monthly = Float64(get(d, "fixedchargefirstmeter", 0.0))
530-
end
531-
if get(d, "fixedchargeunits", "") == "\$/day"
532-
fixed_monthly = Float64(get(d, "fixedchargefirstmeter", 0.0) * 30.4375)
533-
# scalar intended to approximate annual charges over 12 month period, derived from 365.25/12
528+
fixed_monthly = Float64(get(d, "fixedmonthlycharge", 0.0))
529+
if fixed_monthly == 0.0
530+
if get(d, "fixedchargeunits", "") == "\$/month"
531+
fixed_monthly = Float64(get(d, "fixedchargefirstmeter", 0.0))
532+
elseif get(d, "fixedchargeunits", "") == "\$/day"
533+
fixed_monthly = Float64(get(d, "fixedchargefirstmeter", 0.0) * 30.4375)
534+
# scalar intended to approximate annual charges over 12 month period, derived from 365.25/12
535+
elseif get(d, "fixedchargeunits", "") == "\$/year"
536+
fixed_monthly = Float64(get(d, "fixedchargefirstmeter", 0.0) / 12)
537+
elseif !isnothing(get(d, "fixedchargefirstmeter", nothing))
538+
@warn "A valid value for fixedchargeunits (\$/month, \$/day, or \$/year) was not provided in urdb_response so the value provided for fixedchargefirstmeter will be ignored."
539+
end
534540
end
535541

536542
if get(d, "minchargeunits", "") == "\$/month"
537543
min_monthly = Float64(get(d, "mincharge", 0.0))
538544
# first try $/month, then check if $/day or $/year exists, as of 1/28/2020 these were the only unit types in the urdb
539-
end
540-
if get(d, "minchargeunits", "") == "\$/day"
545+
elseif get(d, "minchargeunits", "") == "\$/day"
541546
min_monthly = Float64(get(d, "mincharge", 0.0) * 30.4375 )
542547
# scalar intended to approximate annual charges over 12 month period, derived from 365.25/12
543-
end
544-
545-
if get(d, "minchargeunits", "") == "\$/year"
548+
elseif get(d, "minchargeunits", "") == "\$/year"
546549
annual_min = Float64(get(d, "mincharge", 0.0))
550+
elseif !isnothing(get(d, "minchargeunits", nothing))
551+
@warn "A valid value for minchargeunits (\$/month, \$/day, or \$/year) was not provided in urdb_response so the value provided for mincharge will be ignored."
547552
end
548553

549554
return fixed_monthly, annual_min, min_monthly

src/core/wind.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ struct with inner constructor:
3535
function Wind(;
3636
min_kw = 0.0,
3737
max_kw = 1.0e9,
38-
installed_cost_per_kw = 0.0,
38+
installed_cost_per_kw = missing,
3939
om_cost_per_kw = 35.0,
4040
prod_factor_series = missing,
4141
size_class = "",
@@ -46,7 +46,7 @@ function Wind(;
4646
macrs_option_years = 5,
4747
macrs_bonus_pct = 0.0,
4848
macrs_itc_reduction = 0.5,
49-
federal_itc_pct = 0.26,
49+
federal_itc_pct = missing,
5050
federal_rebate_per_kw = 0.0,
5151
state_ibi_pct = 0.0,
5252
state_ibi_max = 1.0e10,
@@ -68,7 +68,7 @@ function Wind(;
6868
6969
`size_class` must be one of ["residential", "commercial", "medium", "large"]. If `size_class` is not provided then it is determined based on the average electric load.
7070
71-
If no `installed_cost_per_kw` is provided (or it is 0.0) then it is determined from:
71+
If no `installed_cost_per_kw` is provided then it is determined from:
7272
```julia
7373
size_class_to_installed_cost = Dict(
7474
"residential"=> 11950.0,
@@ -101,7 +101,7 @@ These values are passed to SAM to get the turbine production factor.
101101
struct Wind <: AbstractTech
102102
min_kw::Float64
103103
max_kw::Float64
104-
installed_cost_per_kw::Float64
104+
installed_cost_per_kw::Union{Missing, Float64}
105105
om_cost_per_kw::Float64
106106
prod_factor_series::Union{Missing, Array{Real,1}}
107107
size_class::String
@@ -113,7 +113,7 @@ struct Wind <: AbstractTech
113113
macrs_option_years::Int
114114
macrs_bonus_pct::Float64
115115
macrs_itc_reduction::Float64
116-
federal_itc_pct::Float64
116+
federal_itc_pct::Union{Missing, Float64}
117117
federal_rebate_per_kw::Float64
118118
state_ibi_pct::Float64
119119
state_ibi_max::Float64
@@ -135,7 +135,7 @@ struct Wind <: AbstractTech
135135
function Wind(;
136136
min_kw = 0.0,
137137
max_kw = 1.0e9,
138-
installed_cost_per_kw = 0.0,
138+
installed_cost_per_kw = missing,
139139
om_cost_per_kw = 35.0,
140140
prod_factor_series = missing,
141141
size_class = "",
@@ -146,7 +146,7 @@ struct Wind <: AbstractTech
146146
macrs_option_years = 5,
147147
macrs_bonus_pct = 0.0,
148148
macrs_itc_reduction = 0.5,
149-
federal_itc_pct = 0.26,
149+
federal_itc_pct = missing,
150150
federal_rebate_per_kw = 0.0,
151151
state_ibi_pct = 0.0,
152152
state_ibi_max = 1.0e10,
@@ -200,11 +200,11 @@ struct Wind <: AbstractTech
200200
@error "Wind.size_class must be one of $(keys(size_class_to_hub_height))"
201201
end
202202

203-
if installed_cost_per_kw == 0.0
203+
if ismissing(installed_cost_per_kw)
204204
installed_cost_per_kw = size_class_to_installed_cost[size_class]
205205
end
206206

207-
if federal_itc_pct == 0.3
207+
if ismissing(federal_itc_pct)
208208
federal_itc_pct = size_class_to_itc_incentives[size_class]
209209
end
210210

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ else # run HiGHS tests
138138
"output_flag" => false, "log_to_console" => false)
139139
)
140140
results = run_reopt(model, "./scenarios/incentives.json")
141-
@test results["Financial"]["lcc"] 1.094596365e7 atol=1e4
141+
@test results["Financial"]["lcc"] 1.096852612e7 atol=1e4
142142
end
143143

144144
@testset "Fifteen minute load" begin

0 commit comments

Comments
 (0)