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

Big M Updates, thermal efficiency for /chp_defaults #592

Merged
merged 8 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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