Skip to content
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

v0.47.2 #419

Merged
merged 37 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
d1a682f
update bounds on wholesale, net metering benefits benefits
zolanaj May 22, 2024
5fd6399
Merge branch 'develop' into fix-net-metering-and-demand-charges
zolanaj May 22, 2024
f8ea5e6
obtain tier limits before scrubbing demand rate structures
zolanaj May 22, 2024
bd6acbc
new testset Multi-tier demand rates
zolanaj May 22, 2024
3a80c9c
update NM test value
zolanaj May 22, 2024
8637d62
Update CHANGELOG.md
zolanaj May 23, 2024
abc269d
reduce very large hand-entered numbers for maxes to bigM
zolanaj May 23, 2024
209ba63
Update CHANGELOG.md
zolanaj May 24, 2024
a42073a
Merge branch 'develop' into fix-net-metering-and-demand-charges
zolanaj May 31, 2024
3d623f0
use minimums for individual tier limits when more than one set of tie…
zolanaj May 31, 2024
0c5207f
increase energy tier limit
zolanaj May 31, 2024
fff3597
go back to general parse_urdb_demand_tiers using an array instead of …
zolanaj May 31, 2024
a91872a
simplify parse_urdb_demand_tiers
zolanaj May 31, 2024
25c5c51
get limits directly from demand parsers
zolanaj May 31, 2024
32dfaaa
ren parse_urdb_demand_tiers get_num_demand_tiers
zolanaj May 31, 2024
447f9ab
make monthly_demand_tier_limits, tou_demand_tier_limits 2-dimensional…
zolanaj May 31, 2024
60ed541
update indexing of p.s.electric_tariff.tou_demand_tier_limits, p.s.el…
zolanaj May 31, 2024
3091f0e
index tier limits on month or TOU period
zolanaj Jun 3, 2024
56ff653
ren scrub_urdb_demand_tiers scrub_urdb_tiers
zolanaj Jun 3, 2024
238b951
ren get_num_demand_tiers get_num_tiers
zolanaj Jun 3, 2024
2398e8b
update warning for scrub_urdb_tiers
zolanaj Jun 3, 2024
8502b1c
make energy limits 2-dimensional array instead of vector
zolanaj Jun 3, 2024
28d8917
expand mulitple tier testing
zolanaj Jun 3, 2024
202145c
Merge branch 'develop' into fix-net-metering-and-demand-charges
adfarth Jun 5, 2024
b53f9e4
changelog, add notes
adfarth Jun 6, 2024
e8c285b
Add thermal efficiency as input to chp defaults function
Bill-Becker Jun 7, 2024
226cd67
rm comment on URDB Dict modification from parsing function docstrings
zolanaj Jun 11, 2024
5fbc355
refactoring to remove get_num_tiers()
zolanaj Jun 11, 2024
f1301b2
add notes for dimension of tier limits
zolanaj Jun 11, 2024
ccfcb51
Update CHANGELOG.md
zolanaj Jun 11, 2024
ea92b7c
Merge pull request #401 from NREL/fix-net-metering-and-demand-charges
zolanaj Jun 11, 2024
43b01a1
Improve error message for 0 thermal effic
Bill-Becker Jun 26, 2024
67701e7
Merge branch 'master' into develop
adfarth Jul 3, 2024
3a0410d
Update CHANGELOG.md
zolanaj Jul 3, 2024
33ec7df
Update Project.toml
zolanaj Jul 3, 2024
53b92bf
Merge pull request #415 from NREL/mt-therm-effic
zolanaj Jul 5, 2024
4ba2d47
Update CHANGELOG.md
zolanaj Jul 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ Classify the change according to the following categories:
### Deprecated
### Removed

## v0.47.2
### Fixed
- Increased the big-M bound on maximum net metering benefit to prevent artificially low export benefits.
- Fixed a bug in which tier limits did not load correctly when the number of tiers vary by period in the inputs.
- Set a limit for demand and energy tier maxes to avoid errors returned by HiGHS due to numerical limits.
- Index utility rate demand and energy tier limits on month and/or ratchet in addition to tier. This allows for the inclusion of multi-tiered energy and demand rates in which the rates may vary by month or ratchet, whereas previously only the maximum tier limit was used.

## v0.47.1
### Fixed
- Type issue with `CoolingLoad` monthly energy input
Expand Down Expand Up @@ -178,7 +185,7 @@ Classify the change according to the following categories:
## v0.37.5
### Fixed
- Fixed AVERT emissions profiles for NOx. Were previously the same as the SO2 profiles. AVERT emissions profiles are currently generated from AVERT v3.2 https://www.epa.gov/avert/download-avert. See REopt User Manual for more information.
- Fix setting of equal demand tiers in scrub_urdb_demand_tiers!, which was previously causing an error.
- Fix setting of equal demand tiers in `scrub_urdb_demand_tiers`, now renamed `scrub_urdb_tiers`.
- When calling REopt.jl from a python environment using PyJulia and PyCall, some urdb_response fields get converted from a list-of-lists to a matrix type, when REopt.jl expects an array type. This fix adds checks on the type for two urdb_response fields and converts them to an array if needed.
- Update the outages dispatch results to align with CHP availability during outages

Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "REopt"
uuid = "d36ad4e8-d74a-4f7a-ace1-eaea049febf6"
authors = ["Nick Laws", "Hallie Dunham <[email protected]>", "Bill Becker <[email protected]>", "Bhavesh Rathod <[email protected]>", "Alex Zolan <[email protected]>", "Amanda Farthing <[email protected]>"]
version = "0.47.1"
version = "0.47.2"

[deps]
ArchGDAL = "c9ce4bd3-c3d5-55b8-8973-c0e20141b8c3"
Expand Down
16 changes: 8 additions & 8 deletions src/constraints/electric_utility_constraints.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function add_export_constraints(m, p; _n="")
@warn "Adding binary variable for net metering choice. Some solvers are slow with binaries."

# Good to bound the benefit - we use max_bene as a lower bound because the benefit is treated as a negative cost
max_bene = sum([ld*rate for (ld,rate) in zip(p.s.electric_load.loads_kw, p.s.electric_tariff.export_rates[:NEM])])*10
max_bene = sum([ld*rate for (ld,rate) in zip(p.s.electric_load.loads_kw, p.s.electric_tariff.export_rates[:NEM])])*p.pwf_e*p.hours_per_time_step*10
NEM_benefit = @variable(m, lower_bound = max_bene)


Expand Down Expand Up @@ -135,7 +135,7 @@ function add_export_constraints(m, p; _n="")
else
binWHL = @variable(m, binary = true)
@warn "Adding binary variable for wholesale export choice. Some solvers are slow with binaries."
max_bene = sum([ld*rate for (ld,rate) in zip(p.s.electric_load.loads_kw, p.s.electric_tariff.export_rates[:WHL])])*10
max_bene = sum([ld*rate for (ld,rate) in zip(p.s.electric_load.loads_kw, p.s.electric_tariff.export_rates[:WHL])])*p.pwf_e*p.hours_per_time_step*100
WHL_benefit = @variable(m, lower_bound = max_bene)

@constraint(m, binNEM + binWHL == 1) # can either NEM or WHL export, not both
Expand Down Expand Up @@ -200,7 +200,7 @@ function add_monthly_peak_constraint(m, p; _n="")
b = m[Symbol(dv)]
# Upper bound on peak electrical power demand by month, tier; if tier is selected (0 o.w.)
@constraint(m, [mth in p.months, tier in 1:ntiers],
m[Symbol("dvPeakDemandMonth"*_n)][mth, tier] <= p.s.electric_tariff.monthly_demand_tier_limits[tier] *
m[Symbol("dvPeakDemandMonth"*_n)][mth, tier] <= p.s.electric_tariff.monthly_demand_tier_limits[mth, tier] *
b[mth, tier]
)

Expand All @@ -209,7 +209,7 @@ function add_monthly_peak_constraint(m, p; _n="")

# One monthly peak electrical power demand tier must be full before next one is active
@constraint(m, [mth in p.months, tier in 2:ntiers],
b[mth, tier] * p.s.electric_tariff.monthly_demand_tier_limits[tier-1] <=
b[mth, tier] * p.s.electric_tariff.monthly_demand_tier_limits[mth, tier-1] <=
m[Symbol("dvPeakDemandMonth"*_n)][mth, tier-1]
)
# TODO implement NewMaxDemandMonthsInTier, which adds mth index to monthly_demand_tier_limits
Expand All @@ -233,7 +233,7 @@ function add_tou_peak_constraint(m, p; _n="")

# Upper bound on peak electrical power demand by tier, by ratchet, if tier is selected (0 o.w.)
@constraint(m, [r in p.ratchets, tier in 1:ntiers],
m[Symbol("dvPeakDemandTOU"*_n)][r, tier] <= p.s.electric_tariff.tou_demand_tier_limits[tier] * b[r, tier]
m[Symbol("dvPeakDemandTOU"*_n)][r, tier] <= p.s.electric_tariff.tou_demand_tier_limits[r, tier] * b[r, tier]
)

# Ratchet peak electrical power ratchet tier ordering
Expand All @@ -243,7 +243,7 @@ function add_tou_peak_constraint(m, p; _n="")

# One ratchet peak electrical power demand tier must be full before next one is active
@constraint(m, [r in p.ratchets, tier in 2:ntiers],
b[r, tier] * p.s.electric_tariff.tou_demand_tier_limits[tier-1]
b[r, tier] * p.s.electric_tariff.tou_demand_tier_limits[r, tier-1]
<= m[Symbol("dvPeakDemandTOU"*_n)][r, tier-1]
)
end
Expand Down Expand Up @@ -299,15 +299,15 @@ function add_energy_tier_constraints(m, p; _n="")
##Constraint (10a): Usage limits by pricing tier, by month
@constraint(m, [mth in p.months, tier in 1:p.s.electric_tariff.n_energy_tiers],
p.hours_per_time_step * sum( m[Symbol("dvGridPurchase"*_n)][ts, tier] for ts in p.s.electric_tariff.time_steps_monthly[mth] )
<= b[mth, tier] * p.s.electric_tariff.energy_tier_limits[tier]
<= b[mth, tier] * p.s.electric_tariff.energy_tier_limits[mth, tier]
)
##Constraint (10b): Ordering of pricing tiers
@constraint(m, [mth in p.months, tier in 2:p.s.electric_tariff.n_energy_tiers],
b[mth, tier] - b[mth, tier-1] <= 0
)
## Constraint (10c): One tier must be full before any usage in next tier
@constraint(m, [mth in p.months, tier in 2:p.s.electric_tariff.n_energy_tiers],
b[mth, tier] * p.s.electric_tariff.energy_tier_limits[tier-1] -
b[mth, tier] * p.s.electric_tariff.energy_tier_limits[mth, tier-1] -
sum( m[Symbol("dvGridPurchase"*_n)][ts, tier-1] for ts in p.s.electric_tariff.time_steps_monthly[mth])
<= 0
)
Expand Down
16 changes: 8 additions & 8 deletions src/core/electric_tariff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
"""
struct ElectricTariff
energy_rates::AbstractArray{Float64, 2} # gets a second dim with tiers
energy_tier_limits::AbstractArray{Float64,1}
energy_tier_limits::AbstractArray{Float64,2} # month X tier
n_energy_tiers::Int

monthly_demand_rates::AbstractArray{Float64, 2} # gets a second dim with tiers
time_steps_monthly::AbstractArray{AbstractArray{Int64,1},1} # length = 0 or 12
monthly_demand_tier_limits::AbstractArray{Float64,1}
monthly_demand_tier_limits::AbstractArray{Float64,2} # month X tier
n_monthly_demand_tiers::Int

tou_demand_rates::AbstractArray{Float64, 2} # gets a second dim with tiers
tou_demand_ratchet_time_steps::AbstractArray{AbstractArray{Int64,1},1} # length = n_tou_demand_ratchets
tou_demand_tier_limits::AbstractArray{Float64,1}
tou_demand_tier_limits::AbstractArray{Float64,2} # ratchet X tier
n_tou_demand_tiers::Int

demand_lookback_months::AbstractArray{Int,1}
Expand All @@ -42,7 +42,7 @@ end
`ElectricTariff` is a required REopt input for on-grid scenarios only (it cannot be supplied when `Settings.off_grid_flag` is true) with the following keys and default values:
```julia
urdb_label::String="",
urdb_response::Dict=Dict(),
urdb_response::Dict=Dict(), # Response JSON for URDB rates. Note: if creating your own urdb_response, ensure periods are zero-indexed.
urdb_utility_name::String="",
urdb_rate_name::String="",
wholesale_rate::T1=nothing, # Price of electricity sold back to the grid in absence of net metering. Can be a scalar value, which applies for all-time, or an array with time-sensitive values. If an array is input then it must have a length of 8760, 17520, or 35040. The inputed array values are up/down-sampled using mean values to match the Settings.time_steps_per_hour.
Expand Down Expand Up @@ -120,11 +120,11 @@ function ElectricTariff(;
# TODO remove_tiers for multinode models
nem_rate = Float64[]

energy_tier_limits = Float64[]
energy_tier_limits = Array{Float64,2}(undef, 0, 0)
n_energy_tiers = 1
monthly_demand_tier_limits = Float64[]
monthly_demand_tier_limits = Array{Float64,2}(undef, 0, 0)
n_monthly_demand_tiers = 1
tou_demand_tier_limits = Float64[]
tou_demand_tier_limits = Array{Float64,2}(undef, 0, 0)
n_tou_demand_tiers = 1
time_steps_monthly = get_monthly_time_steps(year, time_steps_per_hour=time_steps_per_hour)

Expand Down Expand Up @@ -241,7 +241,7 @@ function ElectricTariff(;
if remove_tiers
energy_rates, monthly_demand_rates, tou_demand_rates = remove_tiers_from_urdb_rate(u)
energy_tier_limits, monthly_demand_tier_limits, tou_demand_tier_limits =
Float64[], Float64[], Float64[]
Array{Float64,2}(undef, 0, 0), Array{Float64,2}(undef, 0, 0), Array{Float64,2}(undef, 0, 0)
n_energy_tiers, n_monthly_demand_tiers, n_tou_demand_tiers = 1, 1, 1
end

Expand Down
Loading
Loading