Skip to content

Commit

Permalink
Merge pull request #592 from NREL/develop
Browse files Browse the repository at this point in the history
Big M Updates, thermal efficiency for /chp_defaults
  • Loading branch information
Bill-Becker authored Jul 9, 2024
2 parents d736bb2 + 0d43a4f commit 5c402c7
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ Classify the change according to the following categories:
##### Removed
### Patches

## v3.9.2
#### Added
- Added attribute `thermal_efficiency` to the arguments of http endpoint `chp_defaults`
#### Fixed
- See fixes and changes here: https://github.com/NREL/REopt.jl/releases/tag/v0.47.2

## v3.9.1
### Minor Updates
#### Added
Expand Down
4 changes: 2 additions & 2 deletions julia_src/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -917,9 +917,9 @@ uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"

[[deps.REopt]]
deps = ["ArchGDAL", "CSV", "CoolProp", "DataFrames", "Dates", "DelimitedFiles", "HTTP", "JLD", "JSON", "JuMP", "LinDistFlow", "LinearAlgebra", "Logging", "MathOptInterface", "Requires", "Roots", "Statistics", "TestEnv"]
git-tree-sha1 = "b51d56a6398f302100004184b64bbe3d1e137277"
git-tree-sha1 = "c02ff7c0b60352164b89f39789424422083ae4eb"
uuid = "d36ad4e8-d74a-4f7a-ace1-eaea049febf6"
version = "0.47.1"
version = "0.47.2"

[[deps.Random]]
deps = ["SHA"]
Expand Down
7 changes: 5 additions & 2 deletions julia_src/http.jl
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,17 @@ function chp_defaults(req::HTTP.Request)
float_vals = ["avg_boiler_fuel_load_mmbtu_per_hour",
"boiler_efficiency",
"avg_electric_load_kw",
"max_electric_load_kw"]
"max_electric_load_kw",
"thermal_efficiency"]
int_vals = ["size_class"]
bool_vals = ["is_electric_only"]
all_vals = vcat(string_vals, float_vals, int_vals, bool_vals)
# Process .json inputs and convert to correct type if needed
for k in all_vals
if !haskey(d, k)
d[k] = nothing
if !(k == "thermal_efficiency") # thermal_efficiency is of type Float64 (incl NaN), so it can't be "nothing"
d[k] = nothing
end
elseif !isnothing(d[k])
if k in float_vals && typeof(d[k]) == String
d[k] = parse(Float64, d[k])
Expand Down
2 changes: 1 addition & 1 deletion reoptjl/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def obj_create(self, bundle, **kwargs):
meta = {
"run_uuid": run_uuid,
"api_version": 3,
"reopt_version": "0.47.1",
"reopt_version": "0.47.2",
"status": "Validating..."
}
bundle.data.update({"APIMeta": meta})
Expand Down
9 changes: 7 additions & 2 deletions reoptjl/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,13 @@ def chp_defaults(request):
"max_electric_load_kw": request.GET.get("max_electric_load_kw"),
"is_electric_only": request.GET.get("is_electric_only")
}
if (request.GET.get("size_class")):
inputs["size_class"] = int(request.GET.get("size_class"))

if request.GET.get("size_class"):
inputs["size_class"] = int(request.GET.get("size_class")) # Not sure if this is necessary because we convert to int in http.jl

if request.GET.get("thermal_efficiency"):
inputs["thermal_efficiency"] = request.GET.get("thermal_efficiency") # Conversion to correct type happens in http.jl

try:
julia_host = os.environ.get('JULIA_HOST', "julia")
http_jl_response = requests.get("http://" + julia_host + ":8081/chp_defaults/", json=inputs)
Expand Down

0 comments on commit 5c402c7

Please sign in to comment.