NREL / REopt.jl

Apache License 2.0
25 stars 21 forks source link

Error when combining URDB sell rate with tiers and periods with net metering #237

Open brtietz opened 1 year ago

brtietz commented 1 year ago

When running the attached JSON: dgen_data.txt in REopt, it produces the error:

DimensionMismatch(\"dimensions must match: a has dims (Base.OneTo(8760), Base.OneTo(2)), b has dims (Base.OneTo(17520),), mismatch at 1\")", ["promote_shape at indices.jl:178 [inlined]", "promote_shape at indices.jl:174 [inlined]", "promote_shape(a::Vector{Int64}, b::Matrix{Float64}) at indices.jl:169", "+(A::Vector{Int64}, Bs::Matrix{Float64}) at arraymath.jl:14", "REopt.ElectricTariff(; urdb_label::String, urdb_response::Dict{String, Any}, urdb_utility_name::String, urdb_rate_name::String, year::Int64, time_steps_per_hour::Int64, NEM::Bool, wholesale_rate::Nothing, export_rate_beyond_net_metering_limit::Nothing, monthly_energy_rates::Vector{Any}, monthly_demand_rates::Vector{Any}, blended_annual_energy_rate::Nothing, blended_annual_demand_rate::Nothing, add_monthly_rates_to_urdb_rate::Bool, tou_energy_rates_per_kwh::Vector{Any}, add_tou_energy_rates_to_urdb_rate::Bool, remove_tiers::Bool, demand_lookback_months::Vector{Int64}, demand_lookback_percent::Float64, demand_lookback_range::Int64, coincident_peak_load_active_time_steps::Vector{Vector{Int64}}, coincident_peak_load_charge_per_kw::Vector{Real}) at electric_tariff.jl:327", "(::Core.var\"#Type##kw\")(::NamedTuple{(:urdb_response, :year, :NEM, :time_steps_per_hour), Tuple{Dict{String, Any}, Int64, Bool, Int64}}, ::Type{REopt.ElectricTariff}) at electric_tariff.jl:119", "Scenario(d::Dict{String, Any}; flex_hvac_from_json::Bool) at scenario.jl:190", "Scenario(d::Dict{String, Any}) at scenario.jl:86", "run_reopt(m::Model, fp::String) at reopt.jl:59",

The following snippet can be used to reproduce the error:

`using JuMP, HiGHS, JSON, REopt

function main() path = joinpath(@DIR, "dgen_data.json")

model = Model(HiGHS.Optimizer)
results = run_reopt(model, path)
print(results)

end `

Deleting "sell" from the lines in the utility rate structure is an effective workaround, but I would expect REopt to either:

  1. Process the data (not clear to me how this applies when dgrules = "Net Metering")
  2. Ignore this component of the rate data (SAM does this)
  3. Throw an exception with how to correct the data
adfarth commented 1 year ago

In general and in addition to the above, we need to identify and document how how the URDB sell rate field is being applied