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

ASHP and summary endpoint updates #602

Merged
merged 89 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
aa44663
link manifest to feature branch
zolanaj Jun 27, 2024
b96d30a
add retire_in_optimal to ExistingChillerInputs
zolanaj Jun 27, 2024
2527f99
new models for ElectricHeater, ASHPSpaceHeater, ASHPWaterHeater I/O
zolanaj Jun 27, 2024
720dc6e
add ElectricHeater, ASHP systems to validators and views
zolanaj Jun 27, 2024
d9a7ba8
rm extra inputs, update migrations
zolanaj Jun 27, 2024
53a983c
Merge branch 'develop' into add-ashp
zolanaj Jul 2, 2024
85751b3
add defaults for electric heater, update get_input_dict_from_run_uuid
zolanaj Jul 2, 2024
abe787c
update migrations
zolanaj Jul 2, 2024
5c0046c
Update all_inputs_test.json
zolanaj Jul 2, 2024
fefc270
fix ProcessHeatLoad input within all inputs test
zolanaj Jul 2, 2024
91a70d7
update all inputs test value due to new techs added
zolanaj Jul 2, 2024
4ab8588
Update CHANGELOG.md
zolanaj Jul 2, 2024
6789fda
workaround fix for SSL issue
rathod-b Aug 19, 2024
6737962
Merge branch 'develop' into add-ashp
zolanaj Aug 20, 2024
ccf34a2
replace heating and cooling cop, cf time series with reference curves
zolanaj Aug 29, 2024
366b931
add endpoints for electric_heater and ashp defaults
zolanaj Aug 29, 2024
155141a
update inputs to ASHP systems
zolanaj Aug 29, 2024
72cb3e9
refactor ASHP to Pascal Case
zolanaj Aug 29, 2024
249abfc
add "_degF" to reference temps inputs
zolanaj Aug 30, 2024
ae7b811
update migrations
zolanaj Aug 30, 2024
0ec57b0
Update Manifest.toml
zolanaj Aug 30, 2024
ecdd006
update peak capacity fraction name, defaults and docstrings for ASHP …
zolanaj Aug 31, 2024
d68fbee
update migrations
zolanaj Aug 31, 2024
39c2fb7
add new fields to all-inputs test
zolanaj Aug 31, 2024
1c49b70
Update Manifest.toml
zolanaj Sep 3, 2024
4fa2ce9
Update Manifest.toml
zolanaj Sep 3, 2024
285340d
update for new type definitions in ASHP inputs
zolanaj Sep 4, 2024
c595941
add function get_ashp_defaults to http.jl
zolanaj Sep 4, 2024
42d58a6
update ASHP defaults endpoint, rm. electric heater defaults
zolanaj Sep 4, 2024
4a68e8f
register ASHP defaults endpoint
zolanaj Sep 4, 2024
64a1841
Merge branch 'likely-cert-issue-fix' into add-ashp
Bill-Becker Sep 4, 2024
29a8ffe
Merge remote-tracking branch 'origin/likely-cert-issue-fix' into add-…
zolanaj Sep 4, 2024
4650f46
update help text
zolanaj Sep 4, 2024
1a732d1
Delete 0002_erpmeta_resiliencemodel_avg_critical_load_and_more.py
zolanaj Sep 4, 2024
55bc64f
Revert "update help text"
zolanaj Sep 4, 2024
cd7fbc3
process results for ASHP systems and electric heater
zolanaj Sep 4, 2024
54eaf31
Update all_inputs_test.json
zolanaj Sep 4, 2024
4ddbe52
update get_ashp_defaults endpoint
zolanaj Sep 4, 2024
c8fc3a3
add test_get_ashp_defaults to HTTP endpoint test suite
zolanaj Sep 4, 2024
b6f48ec
update test value for smaller heating sizes
zolanaj Sep 4, 2024
0c6667b
ensure new techs are in the all_inputs_test response
zolanaj Sep 4, 2024
22084a8
update ASHPSpaceHeater inputs
zolanaj Sep 4, 2024
65ab8e9
add clean functions
zolanaj Sep 4, 2024
bdd3dd5
Create 0062_ashpspaceheateroutputs_annual_electric_consumption_for_co…
zolanaj Sep 4, 2024
61400a0
Create 0016_alter_erpmeta_reopt_version.py
zolanaj Sep 4, 2024
703da5a
fix clean functions
zolanaj Sep 4, 2024
1cf054e
Merge branch 'add-ashp' of https://github.com/NREL/REopt_API into add…
Bill-Becker Sep 4, 2024
0bca0d2
bugfix in summary dict
zolanaj Sep 4, 2024
1559e60
minor cleanup in ASHP models
zolanaj Sep 5, 2024
1ae3cbe
Update Manifest.toml
zolanaj Sep 5, 2024
78138bd
Merge branch 'add-ashp' of https://github.com/NREL/REopt_API into add…
Bill-Becker Sep 5, 2024
6d1788d
remove default values for min_allowable inputs of ASHP systems
zolanaj Sep 5, 2024
70697a7
set self.min_allowable_peak_capacity_fraction = 0.5 if no min allowab…
zolanaj Sep 5, 2024
88857c4
Add GHP outputs for thermal load served
Bill-Becker Sep 10, 2024
ef83599
Add outdoor air temp input to Site Inputs
Bill-Becker Sep 10, 2024
5f5923c
Merge branch 'add-ashp' of https://github.com/NREL/REopt_API into add…
Bill-Becker Sep 10, 2024
4770a90
Merge migrations ASHP-GHP-Site
Bill-Becker Sep 10, 2024
49ec5d1
Get Site outdoor air temperature "input" from REopt.jl
Bill-Becker Sep 10, 2024
f8b5b63
Allow null for Site input outdoor air temp
Bill-Becker Sep 10, 2024
3276d77
Avoid updating Site outdoor air input with nothing/null
Bill-Becker Sep 10, 2024
0dbf055
Update REopt.jl#add-ASHP to latest commit SHA
Bill-Becker Sep 10, 2024
2596208
Update REopt.jl to latest add-ashp branch
Bill-Becker Sep 15, 2024
3c110ae
Fix ASHPWaterHeater default sizing_factor to 1.0
Bill-Becker Sep 16, 2024
f881886
Add new ExistingBoiler output of size_mmbtu_per_hour
Bill-Becker Sep 16, 2024
ecf6daa
Avoid Site db update if not needed
Bill-Becker Sep 16, 2024
fe6dd44
remove ASHP API defaults when they are present in REopt.jl defaults
zolanaj Sep 17, 2024
679ed8b
update manifest
zolanaj Sep 17, 2024
ccec5b6
Update Manifest.toml
zolanaj Sep 18, 2024
635aa68
update manifest for waste heat fix
zolanaj Sep 18, 2024
93b9ea9
Add new REopt.jl outputs of CapEx w/o MACRS and unaddressable heating…
Bill-Becker Sep 23, 2024
f22d06c
Update views.py
rathod-b Sep 24, 2024
56379e6
Update views.py
rathod-b Sep 24, 2024
80c9559
Merge branch 'develop' into add-ashp
zolanaj Sep 25, 2024
8a1a448
Update Manifest.toml
zolanaj Sep 25, 2024
06092e1
add force_into_system to inputs of get_ashp_defaults
zolanaj Sep 25, 2024
6655897
update DB with ASHP defaults from Julia
zolanaj Sep 25, 2024
2a2da3d
Create 0070_merge_20240925_0600.py
zolanaj Sep 25, 2024
77458ee
add parsing of force_into_system to bool in get_ashp_defaults
zolanaj Sep 25, 2024
d427d19
update testset test_get_ashp_defaults
zolanaj Sep 25, 2024
a215e10
Update Manifest.toml
zolanaj Sep 25, 2024
718fff7
update manifest for ASHP default imports
zolanaj Sep 25, 2024
1c7c2b0
Merge branch 'develop' into summary-endpoint-updates
rathod-b Sep 25, 2024
b6dee5b
add checks for mismatched length and new ASHP validator tests
zolanaj Sep 25, 2024
0927396
Merge pull request #601 from NREL/summary-endpoint-updates
rathod-b Sep 25, 2024
9ca78e9
add error response if not all inputs provided to get_ashp_defaults en…
zolanaj Sep 26, 2024
9d8561f
update Manifest to REopt.jl v0.48.0
zolanaj Sep 26, 2024
3398529
Merge pull request #590 from NREL/add-ashp
zolanaj Sep 26, 2024
8bb0394
Update CHANGELOG.md
rathod-b Sep 26, 2024
6539cc2
Update CHANGELOG.md
Bill-Becker Sep 26, 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
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ Classify the change according to the following categories:
##### Removed
### Patches

## v3.10.0
### Minor Updates
#### Added
- Added new model **ElectricHeaterInputs**
- Added new model **ElectricHeaterOutputs**
- Added new model **ASHPWaterHeaterInputs**
- Added new model **ASHPWaterHeaterOutputs**
- Added new model **ASHPSpaceHeaterInputs**
- Added new model **ASHPSpaceHeaterOutputs**

## v3.9.4
### Minor Updates
#### Added
Expand Down
4 changes: 4 additions & 0 deletions julia_src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ ARG NREL_ROOT_CERT_URL_ROOT=""
RUN set -x && if [ -n "$NREL_ROOT_CERT_URL_ROOT" ]; then curl -fsSLk -o /usr/local/share/ca-certificates/nrel_root.crt "${NREL_ROOT_CERT_URL_ROOT}/nrel_root.pem" && curl -fsSLk -o /usr/local/share/ca-certificates/nrel_xca1.crt "${NREL_ROOT_CERT_URL_ROOT}/nrel_xca1.pem" && update-ca-certificates; fi
ENV REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt

# Use git cli instead of Julia's libgit2, since we're facing SSL issues with it.
RUN apt-get update && apt-get -y install git && rm -rf /var/lib/apt/lists/* /var/lib/dpkg/*-old /var/cache/* /var/log/*
ENV JULIA_PKG_USE_CLI_GIT=true

# Install Julia packages
ENV JULIA_NUM_THREADS=2
ENV XPRESS_JL_SKIP_LIB_CHECK=True
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 = "c02ff7c0b60352164b89f39789424422083ae4eb"
git-tree-sha1 = "32499f329265d270e9f77c8831892772b5fbf28f"
uuid = "d36ad4e8-d74a-4f7a-ace1-eaea049febf6"
version = "0.47.2"
version = "0.48.0"

[[deps.Random]]
deps = ["SHA"]
Expand Down
75 changes: 72 additions & 3 deletions julia_src/http.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,55 @@ function reopt(req::HTTP.Request)
else
ghp_dict = Dict()
end
if haskey(d, "ASHPSpaceHeater")
inputs_with_defaults_from_ashp = [
:max_ton, :installed_cost_per_ton, :om_cost_per_ton,
:macrs_option_years, :macrs_bonus_fraction, :can_supply_steam_turbine,
:can_serve_process_heat, :can_serve_dhw, :can_serve_space_heating, :can_serve_cooling,
:back_up_temp_threshold_degF, :sizing_factor, :heating_cop_reference, :heating_cf_reference,
:heating_reference_temps_degF, :cooling_cop_reference, :cooling_cf_reference,
:cooling_reference_temps_degF
]
ashp_dict = Dict(key=>getfield(model_inputs.s.ashp, key) for key in inputs_with_defaults_from_ashp)
else
ashp_dict = Dict()
end
if haskey(d, "ASHPWaterHeater")
inputs_with_defaults_from_ashp_wh = [
:max_ton, :installed_cost_per_ton, :om_cost_per_ton,
:macrs_option_years, :macrs_bonus_fraction, :can_supply_steam_turbine,
:can_serve_process_heat, :can_serve_dhw, :can_serve_space_heating, :can_serve_cooling,
:back_up_temp_threshold_degF, :sizing_factor, :heating_cop_reference, :heating_cf_reference,
:heating_reference_temps_degF
]
ashp_wh_dict = Dict(key=>getfield(model_inputs.s.ashp_wh, key) for key in inputs_with_defaults_from_ashp_wh)
else
ashp_wh_dict = Dict()
end
if haskey(d, "CoolingLoad")
inputs_with_defaults_from_chiller = [
:cop
]
chiller_dict = Dict(key=>getfield(model_inputs.s.existing_chiller, key) for key in inputs_with_defaults_from_chiller)
else
chiller_dict = Dict()
end
end
if !isnothing(model_inputs.s.site.outdoor_air_temperature_degF)
site_dict = Dict(:outdoor_air_temperature_degF => model_inputs.s.site.outdoor_air_temperature_degF)
else
site_dict = Dict()
end
inputs_with_defaults_set_in_julia = Dict(
"Financial" => Dict(key=>getfield(model_inputs.s.financial, key) for key in inputs_with_defaults_from_easiur),
"ElectricUtility" => Dict(key=>getfield(model_inputs.s.electric_utility, key) for key in inputs_with_defaults_from_avert_or_cambium),
"Site" => site_dict,
"CHP" => chp_dict,
"SteamTurbine" => steamturbine_dict,
"GHP" => ghp_dict,
"ExistingChiller" => chiller_dict
)
"ExistingChiller" => chiller_dict,
"ASHPSpaceHeater" => ashp_dict,
"ASHPWaterHeater" => ashp_wh_dict
)
catch e
@error "Something went wrong in REopt optimization!" exception=(e, catch_backtrace())
error_response["error"] = sprint(showerror, e) # append instead of rewrite?
Expand Down Expand Up @@ -511,6 +544,41 @@ function get_existing_chiller_default_cop(req::HTTP.Request)
end
end

function get_ashp_defaults(req::HTTP.Request)
d = JSON.parse(String(req.body))
defaults = nothing

if !("load_served" in keys(d))
@info("ASHP load served not provided. Using default of SpaceHeating.")
d["load_served"] = "SpaceHeating"
end
if !("force_into_system" in keys(d))
@info("ASHP force_into_system not provided. Using default of false.")
d["force_into_system"] = false
elseif typeof(d["force_into_system"]) == String
d["force_into_system"] = parse(Bool, d["force_into_system"])
end

@info "Getting default ASHP attributes..."
error_response = Dict()
try
# Have to specify "REopt.get_existing..." because http function has the same name
defaults = reoptjl.get_ashp_defaults(d["load_served"],d["force_into_system"])
catch e
@error "Something went wrong in the get_ashp_defaults endpoint" exception=(e, catch_backtrace())
error_response["error"] = sprint(showerror, e)
end
if isempty(error_response)
@info("ASHP defaults obtained.")
response = defaults
return HTTP.Response(200, JSON.json(response))
else
@info "An error occured in the get_ashp_defaults endpoint"
return HTTP.Response(500, JSON.json(error_response))
end
end


function job_no_xpress(req::HTTP.Request)
error_response = Dict("error" => "V1 and V2 not available without Xpress installation.")
return HTTP.Response(500, JSON.json(error_response))
Expand All @@ -537,4 +605,5 @@ HTTP.register!(ROUTER, "GET", "/ghp_efficiency_thermal_factors", ghp_efficiency_
HTTP.register!(ROUTER, "GET", "/ground_conductivity", ground_conductivity)
HTTP.register!(ROUTER, "GET", "/health", health)
HTTP.register!(ROUTER, "GET", "/get_existing_chiller_default_cop", get_existing_chiller_default_cop)
HTTP.register!(ROUTER, "GET", "/get_ashp_defaults", get_ashp_defaults)
HTTP.serve(ROUTER, "0.0.0.0", 8081, reuseaddr=true)
Loading