Skip to content

Commit dee8109

Browse files
committed
Update /get_load_metrics endpoint to be consistent with /simulated_load for electric load_type
1 parent dec8745 commit dee8109

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ Classify the change according to the following categories:
2626
##### Removed
2727
### Patches
2828

29+
## v3.17.1
30+
### Minor Updates
31+
##### Changed
32+
- For the `/get_load_metrics` endpoint, update response field names to be consistent with `/simulated_load` for `load_type=electric`: `annual_kwh`, `max_kw` (annual peak load), `monthly_totals_kwh`, and `monthly_peaks_kw`. In a future update, this endpoint will take `load_type` as an input and return the load metrics with consistent units as `/simulated_load` for heating and cooling `load_type`s, such as `monthly_mmbtu` for the heating load types.
33+
2934
## v3.17.0
3035
### Minor Updates
3136
##### Added

julia_src/http.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,16 @@ function get_load_metrics(req::HTTP.Request)
600600
load_profile = pop!(d, "load_profile")
601601
other_kwargs = reoptjl.dictkeys_tosymbols(d)
602602
data = reoptjl.get_load_metrics(load_profile; other_kwargs...)
603+
rename_map = Dict("annual_peak" => "max_kw",
604+
"annual_energy" => "annual_kwh",
605+
"monthly_energy" => "monthly_totals_kwh",
606+
"monthly_peaks" => "monthly_peaks_kw")
607+
for (old_key, new_key) in rename_map
608+
if haskey(data, old_key)
609+
data[new_key] = data[old_key]
610+
delete!(data, old_key)
611+
end
612+
end
603613
catch e
604614
@error "Something went wrong in the get_load_metrics" exception=(e, catch_backtrace())
605615
error_response["error"] = sprint(showerror, e)

reoptjl/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1674,7 +1674,7 @@ def get_load_metrics(request):
16741674
try:
16751675
if request.method == "POST":
16761676
post_body = json.loads(request.body)
1677-
load_profile = list(post_body.get("load_profile"))
1677+
load_profile = list(post_body["load_profile"])
16781678

16791679
inputs = {
16801680
"load_profile": load_profile

0 commit comments

Comments
 (0)