From bb6956c14293503f0eed64b53985cd262645f4ca Mon Sep 17 00:00:00 2001 From: hdunham <70401017+hdunham@users.noreply.github.com> Date: Mon, 3 Jul 2023 13:25:32 -0700 Subject: [PATCH 01/17] update generator capx default --- src/core/generator.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/generator.jl b/src/core/generator.jl index 31a9b7969..c07c783f8 100644 --- a/src/core/generator.jl +++ b/src/core/generator.jl @@ -33,7 +33,7 @@ existing_kw::Real = 0, min_kw::Real = 0, max_kw::Real = 1.0e6, - installed_cost_per_kw::Real = 500.0, + installed_cost_per_kw::Real = 650.0, om_cost_per_kw::Real = off_grid_flag ? 20.0 : 10.0, om_cost_per_kwh::Real = 0.0, fuel_cost_per_gallon::Real = 3.0, @@ -128,7 +128,7 @@ struct Generator <: AbstractGenerator existing_kw::Real = 0, min_kw::Real = 0, max_kw::Real = 1.0e6, - installed_cost_per_kw::Real = 500.0, + installed_cost_per_kw::Real = 650.0, om_cost_per_kw::Real= off_grid_flag ? 20.0 : 10.0, om_cost_per_kwh::Real = 0.0, fuel_cost_per_gallon::Real = 3.0, From 29ac5d33e33fe0307d5c81fa73fd685740c225bc Mon Sep 17 00:00:00 2001 From: hdunham <70401017+hdunham@users.noreply.github.com> Date: Fri, 7 Jul 2023 13:45:58 -0700 Subject: [PATCH 02/17] depend gen installed_cost_per_kw on only_runs_during_grid_outage --- src/core/generator.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/generator.jl b/src/core/generator.jl index c07c783f8..13ca98f99 100644 --- a/src/core/generator.jl +++ b/src/core/generator.jl @@ -30,10 +30,11 @@ """ `Generator` is an optional REopt input with the following keys and default values: ```julia + only_runs_during_grid_outage::Bool = true, existing_kw::Real = 0, min_kw::Real = 0, max_kw::Real = 1.0e6, - installed_cost_per_kw::Real = 650.0, + installed_cost_per_kw::Real = only_runs_during_grid_outage ? 650.0 : 800.0, om_cost_per_kw::Real = off_grid_flag ? 20.0 : 10.0, om_cost_per_kwh::Real = 0.0, fuel_cost_per_gallon::Real = 3.0, @@ -42,7 +43,6 @@ fuel_avail_gal::Real = off_grid_flag ? 1.0e9 : 660.0, fuel_higher_heating_value_kwh_per_gal::Real = 40.7, min_turn_down_fraction::Real = off_grid_flag ? 0.15 : 0.0, - only_runs_during_grid_outage::Bool = true, sells_energy_back_to_grid::Bool = false, can_net_meter::Bool = false, can_wholesale::Bool = false, @@ -125,10 +125,11 @@ struct Generator <: AbstractGenerator function Generator(; off_grid_flag::Bool = false, analysis_years::Int = 25, + only_runs_during_grid_outage::Bool = true, existing_kw::Real = 0, min_kw::Real = 0, max_kw::Real = 1.0e6, - installed_cost_per_kw::Real = 650.0, + installed_cost_per_kw::Real = only_runs_during_grid_outage ? 650.0 : 800.0, om_cost_per_kw::Real= off_grid_flag ? 20.0 : 10.0, om_cost_per_kwh::Real = 0.0, fuel_cost_per_gallon::Real = 3.0, @@ -137,7 +138,6 @@ struct Generator <: AbstractGenerator fuel_avail_gal::Real = off_grid_flag ? 1.0e9 : 660.0, fuel_higher_heating_value_kwh_per_gal::Real = KWH_PER_GAL_DIESEL, min_turn_down_fraction::Real = off_grid_flag ? 0.15 : 0.0, - only_runs_during_grid_outage::Bool = true, sells_energy_back_to_grid::Bool = false, can_net_meter::Bool = false, can_wholesale::Bool = false, From 961874412777e6c09d18c456cabc3bed12b2f9ac Mon Sep 17 00:00:00 2001 From: hdunham <70401017+hdunham@users.noreply.github.com> Date: Tue, 11 Jul 2023 10:56:33 -0700 Subject: [PATCH 03/17] provide installed_cost_per_kw in tests b/c default changed --- test/scenarios/backup_reliability_reopt_inputs.json | 1 + test/scenarios/emissions.json | 1 + test/scenarios/generator.json | 1 + test/scenarios/mpc.json | 1 + test/scenarios/nogridcost_minresilhours.json | 1 + test/scenarios/nogridcost_multiscenario.json | 1 + test/scenarios/outage.json | 1 + 7 files changed, 7 insertions(+) diff --git a/test/scenarios/backup_reliability_reopt_inputs.json b/test/scenarios/backup_reliability_reopt_inputs.json index 8184026b6..5e761afb3 100644 --- a/test/scenarios/backup_reliability_reopt_inputs.json +++ b/test/scenarios/backup_reliability_reopt_inputs.json @@ -21,6 +21,7 @@ "federal_rebate_per_kw": 350.0 }, "Generator": { + "installed_cost_per_kw": 500.0, "min_kw": 200, "max_kw": 200 }, diff --git a/test/scenarios/emissions.json b/test/scenarios/emissions.json index ff85084ce..8534728ca 100644 --- a/test/scenarios/emissions.json +++ b/test/scenarios/emissions.json @@ -41,6 +41,7 @@ "outage_durations": [10] }, "Generator": { + "installed_cost_per_kw": 500.0, "max_kw": 500.0, "fuel_avail_gal": 125.0, "min_turn_down_fraction": 0.0, diff --git a/test/scenarios/generator.json b/test/scenarios/generator.json index fe658e749..b6de9eddf 100644 --- a/test/scenarios/generator.json +++ b/test/scenarios/generator.json @@ -10,6 +10,7 @@ "outage_end_time_step": 12 }, "Generator": { + "installed_cost_per_kw": 500.0, "max_kw": 500.0, "fuel_avail_gal": 125.0, "min_turn_down_fraction": 0.0, diff --git a/test/scenarios/mpc.json b/test/scenarios/mpc.json index 2a69e5988..89b775759 100644 --- a/test/scenarios/mpc.json +++ b/test/scenarios/mpc.json @@ -101,6 +101,7 @@ 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05] }, "Generator": { + "installed_cost_per_kw": 500.0, "size_kw": 30, "only_runs_during_grid_outage": false }, diff --git a/test/scenarios/nogridcost_minresilhours.json b/test/scenarios/nogridcost_minresilhours.json index 34b2feb50..dde3851f9 100644 --- a/test/scenarios/nogridcost_minresilhours.json +++ b/test/scenarios/nogridcost_minresilhours.json @@ -60,6 +60,7 @@ "critical_load_fraction": 1 }, "Generator": { + "installed_cost_per_kw": 500.0 }, "Financial": { "value_of_lost_load_per_kwh": 0.001, diff --git a/test/scenarios/nogridcost_multiscenario.json b/test/scenarios/nogridcost_multiscenario.json index 90d312b05..e6ee92ca8 100644 --- a/test/scenarios/nogridcost_multiscenario.json +++ b/test/scenarios/nogridcost_multiscenario.json @@ -53,6 +53,7 @@ "critical_load_fraction": 0.1 }, "Generator": { + "installed_cost_per_kw": 500.0, "max_kw": 0.0 }, "Financial": { diff --git a/test/scenarios/outage.json b/test/scenarios/outage.json index 64adb56de..1cd720372 100644 --- a/test/scenarios/outage.json +++ b/test/scenarios/outage.json @@ -8,6 +8,7 @@ "outage_durations": [10] }, "Generator": { + "installed_cost_per_kw": 500.0, "existing_kw": 0.0, "min_turn_down_fraction": 0.0, "only_runs_during_grid_outage": true, From 7cf85b45edf65198cfad2cb445b1cac893dc9719 Mon Sep 17 00:00:00 2001 From: hdunham <70401017+hdunham@users.noreply.github.com> Date: Tue, 11 Jul 2023 11:07:03 -0700 Subject: [PATCH 04/17] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea047ce89..c0fb780aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ Classify the change according to the following categories: - Made PV struct mutable: This allows for assigning pv.production_factor_series when calling PVWatts for GHP, to avoid a extra PVWatts calls later. ### Fixed - Issue with using a leap year with a URDB rate - the URDB rate was creating energy_rate of length 8784 instead of intended 8760 +- Corrected `Generator` **installed_cost_per_kw** from 500 to 650 if **only_runs_during_grid_outage** is _true_ or 800 if _false_ ## v0.32.3 ### Fixed From 1869b41c67b8402c9c042796fb3d8bdc9e884d1c Mon Sep 17 00:00:00 2001 From: hdunham <70401017+hdunham@users.noreply.github.com> Date: Tue, 11 Jul 2023 11:31:14 -0700 Subject: [PATCH 05/17] remove installed_cost_per_kw from MPC test post --- test/scenarios/mpc.json | 1 - 1 file changed, 1 deletion(-) diff --git a/test/scenarios/mpc.json b/test/scenarios/mpc.json index 89b775759..2a69e5988 100644 --- a/test/scenarios/mpc.json +++ b/test/scenarios/mpc.json @@ -101,7 +101,6 @@ 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05] }, "Generator": { - "installed_cost_per_kw": 500.0, "size_kw": 30, "only_runs_during_grid_outage": false }, From 88fcdb98e8c81256ff8319a96bc9792c47624704 Mon Sep 17 00:00:00 2001 From: hdunham <70401017+hdunham@users.noreply.github.com> Date: Fri, 21 Jul 2023 12:28:27 -0600 Subject: [PATCH 06/17] update fuel_avail_gal default to always 1e9 --- src/core/generator.jl | 4 ++-- src/mpc/structs.jl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/generator.jl b/src/core/generator.jl index 13ca98f99..228febf06 100644 --- a/src/core/generator.jl +++ b/src/core/generator.jl @@ -40,7 +40,7 @@ fuel_cost_per_gallon::Real = 3.0, electric_efficiency_full_load::Real = 0.3233, electric_efficiency_half_load::Real = electric_efficiency_full_load, - fuel_avail_gal::Real = off_grid_flag ? 1.0e9 : 660.0, + fuel_avail_gal::Real = 1.0e9, fuel_higher_heating_value_kwh_per_gal::Real = 40.7, min_turn_down_fraction::Real = off_grid_flag ? 0.15 : 0.0, sells_energy_back_to_grid::Bool = false, @@ -135,7 +135,7 @@ struct Generator <: AbstractGenerator fuel_cost_per_gallon::Real = 3.0, electric_efficiency_full_load::Real = 0.3233, electric_efficiency_half_load::Real = electric_efficiency_full_load, - fuel_avail_gal::Real = off_grid_flag ? 1.0e9 : 660.0, + fuel_avail_gal::Real = 1.0e9, fuel_higher_heating_value_kwh_per_gal::Real = KWH_PER_GAL_DIESEL, min_turn_down_fraction::Real = off_grid_flag ? 0.15 : 0.0, sells_energy_back_to_grid::Bool = false, diff --git a/src/mpc/structs.jl b/src/mpc/structs.jl index c2a66e087..86450478e 100644 --- a/src/mpc/structs.jl +++ b/src/mpc/structs.jl @@ -283,7 +283,7 @@ function MPCGenerator(; fuel_cost_per_gallon::Real = 3.0, electric_efficiency_full_load::Real = 0.3233, electric_efficiency_half_load::Real = electric_efficiency_full_load, - fuel_avail_gal::Real = 660.0, + fuel_avail_gal::Real = 1.0e9, fuel_higher_heating_value_kwh_per_gal::Real = KWH_PER_GAL_DIESEL, min_turn_down_fraction::Real = 0.0, # TODO change this to non-zero value only_runs_during_grid_outage::Bool = true, @@ -310,7 +310,7 @@ struct MPCGenerator <: AbstractGenerator fuel_cost_per_gallon::Real = 3.0, electric_efficiency_full_load::Real = 0.3233, electric_efficiency_half_load::Real = electric_efficiency_full_load, - fuel_avail_gal::Real = 660.0, + fuel_avail_gal::Real = 1.0e9, fuel_higher_heating_value_kwh_per_gal::Real = KWH_PER_GAL_DIESEL, min_turn_down_fraction::Real = 0.0, # TODO change this to non-zero value only_runs_during_grid_outage::Bool = true, From 58b1060c69c88fad5e3517aea4bf96d43d43652f Mon Sep 17 00:00:00 2001 From: hdunham <70401017+hdunham@users.noreply.github.com> Date: Fri, 21 Jul 2023 12:31:30 -0600 Subject: [PATCH 07/17] fix fuel_avail_gal in tests --- test/scenarios/backup_reliability_reopt_inputs.json | 1 + test/scenarios/mpc.json | 1 + test/scenarios/nogridcost_minresilhours.json | 1 + test/scenarios/nogridcost_multiscenario.json | 1 + test/scenarios/outage.json | 1 + 5 files changed, 5 insertions(+) diff --git a/test/scenarios/backup_reliability_reopt_inputs.json b/test/scenarios/backup_reliability_reopt_inputs.json index 5e761afb3..2b1739d40 100644 --- a/test/scenarios/backup_reliability_reopt_inputs.json +++ b/test/scenarios/backup_reliability_reopt_inputs.json @@ -22,6 +22,7 @@ }, "Generator": { "installed_cost_per_kw": 500.0, + "fuel_avail_gal": 660, "min_kw": 200, "max_kw": 200 }, diff --git a/test/scenarios/mpc.json b/test/scenarios/mpc.json index 2a69e5988..988a3d9b8 100644 --- a/test/scenarios/mpc.json +++ b/test/scenarios/mpc.json @@ -101,6 +101,7 @@ 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05] }, "Generator": { + "fuel_avail_gal": 660, "size_kw": 30, "only_runs_during_grid_outage": false }, diff --git a/test/scenarios/nogridcost_minresilhours.json b/test/scenarios/nogridcost_minresilhours.json index dde3851f9..ba787ebaf 100644 --- a/test/scenarios/nogridcost_minresilhours.json +++ b/test/scenarios/nogridcost_minresilhours.json @@ -60,6 +60,7 @@ "critical_load_fraction": 1 }, "Generator": { + "fuel_avail_gal": 660, "installed_cost_per_kw": 500.0 }, "Financial": { diff --git a/test/scenarios/nogridcost_multiscenario.json b/test/scenarios/nogridcost_multiscenario.json index e6ee92ca8..01ec7ccad 100644 --- a/test/scenarios/nogridcost_multiscenario.json +++ b/test/scenarios/nogridcost_multiscenario.json @@ -53,6 +53,7 @@ "critical_load_fraction": 0.1 }, "Generator": { + "fuel_avail_gal": 660, "installed_cost_per_kw": 500.0, "max_kw": 0.0 }, diff --git a/test/scenarios/outage.json b/test/scenarios/outage.json index 1cd720372..9e655c1bf 100644 --- a/test/scenarios/outage.json +++ b/test/scenarios/outage.json @@ -8,6 +8,7 @@ "outage_durations": [10] }, "Generator": { + "fuel_avail_gal": 660, "installed_cost_per_kw": 500.0, "existing_kw": 0.0, "min_turn_down_fraction": 0.0, From d8b4f47d7fe40ba19f79a35b30e633e6f6688a99 Mon Sep 17 00:00:00 2001 From: hdunham <70401017+hdunham@users.noreply.github.com> Date: Wed, 26 Jul 2023 12:12:09 -0600 Subject: [PATCH 08/17] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b274611f..1d3458933 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ Classify the change according to the following categories: ## Develop ### Changed - Changed unit test expected values due to update to PVWatts v8, which slightly changed expected PV production factors. +- Changed **fuel_avail_gal** default to 1e9 for on-grid scenarios (same as off-grid) ### Fixed - Corrected `Generator` **installed_cost_per_kw** from 500 to 650 if **only_runs_during_grid_outage** is _true_ or 800 if _false_ From 8cd7974e191307b8da1dfbf3a661e7e17677ab55 Mon Sep 17 00:00:00 2001 From: hdunham <70401017+hdunham@users.noreply.github.com> Date: Wed, 26 Jul 2023 16:44:50 -0600 Subject: [PATCH 09/17] Update CHANGELOG.md --- CHANGELOG.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d3458933..ebcda882c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,22 +23,18 @@ Classify the change according to the following categories: ### Deprecated ### Removed -## Develop -### Changed -- Changed unit test expected values due to update to PVWatts v8, which slightly changed expected PV production factors. -- Changed **fuel_avail_gal** default to 1e9 for on-grid scenarios (same as off-grid) -### Fixed -- Corrected `Generator` **installed_cost_per_kw** from 500 to 650 if **only_runs_during_grid_outage** is _true_ or 800 if _false_ - ## v0.32.4 ### Changed - Consolidated PVWatts API calls to 1 call (previously 3 separate calls existed). API call occurs in `src/core/utils.jl/call_pvwatts_api()`. This function is called for PV in `src/core/production_factor.jl/get_production_factor(PV)` and for GHP in `src/core/scenario.jl`. If GHP and PV are evaluated together, the GHP PVWatts call for ambient temperature is also used to assign the pv.production_factor_series in Scenario.jl so that the PVWatts API does not get called again downstream in `get_production_factor(PV)`. - In `src/core/utils.jl/call_pvwatts_api()`, updated NSRDB bounds used in PVWatts query (now includes southern New Zealand) - Updated PV Watts version from v6 to v8. PVWatts V8 updates the weather data to 2020 TMY data from the NREL NSRDB for locations covered by the database. (The NSRDB weather data used in PVWatts V6 is from around 2015.) See other differences at https://developer.nrel.gov/docs/solar/pvwatts/. - Made PV struct mutable: This allows for assigning pv.production_factor_series when calling PVWatts for GHP, to avoid a extra PVWatts calls later. +- Changed unit test expected values due to update to PVWatts v8, which slightly changed expected PV production factors. +- Changed **fuel_avail_gal** default to 1e9 for on-grid scenarios (same as off-grid) ### Fixed - Issue with using a leap year with a URDB rate - the URDB rate was creating energy_rate of length 8784 instead of intended 8760 -- Don't double add adjustments to urdb rates with non-standard units +- Don't double add adjustments to urdb rates with non-standard units +- Corrected `Generator` **installed_cost_per_kw** from 500 to 650 if **only_runs_during_grid_outage** is _true_ or 800 if _false_ ## v0.32.3 ### Fixed From f82349a2757b2a84a59a36e4ff8483b376380532 Mon Sep 17 00:00:00 2001 From: hdunham <70401017+hdunham@users.noreply.github.com> Date: Wed, 26 Jul 2023 16:51:04 -0600 Subject: [PATCH 10/17] readability --- src/core/urdb.jl | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/core/urdb.jl b/src/core/urdb.jl index 9f3bae6cd..4c7c2a724 100644 --- a/src/core/urdb.jl +++ b/src/core/urdb.jl @@ -293,14 +293,10 @@ function parse_urdb_energy_costs(d::Dict, year::Int; time_steps_per_hour=1, bigM else tier_use = tier end - if non_kwh_units - rate = rate_average - total_rate = rate - else - rate = get(d["energyratestructure"][period][tier_use], "rate", 0) - total_rate = rate + get(d["energyratestructure"][period][tier_use], "adj", 0) - end - + total_rate = non_kwh_units ? + rate_average : + (get(d["energyratestructure"][period][tier_use], "rate", 0) + + get(d["energyratestructure"][period][tier_use], "adj", 0)) sell = get(d["energyratestructure"][period][tier_use], "sell", 0) for step in range(1, stop=time_steps_per_hour) # repeat hourly rates intrahour From c93d541e8087267c0da92776b137ad77bd546785 Mon Sep 17 00:00:00 2001 From: zolanaj Date: Tue, 8 Aug 2023 11:22:56 -0600 Subject: [PATCH 11/17] add get_existing_chiller_default_cop to exported functions --- src/REopt.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/REopt.jl b/src/REopt.jl index 05a7d7a84..8b6a1136e 100644 --- a/src/REopt.jl +++ b/src/REopt.jl @@ -50,7 +50,8 @@ export simulated_load, get_absorption_chiller_defaults, emissions_profiles, - easiur_data + easiur_data, + get_existing_chiller_default_cop import HTTP import JSON From 70ae2261d72288e8ac7dfb7d4fb8ac5ba112c00b Mon Sep 17 00:00:00 2001 From: zolanaj Date: Tue, 8 Aug 2023 11:46:18 -0600 Subject: [PATCH 12/17] convert load vectors to max loads in arguments to get_existing_chiller_default_cop --- src/core/heating_cooling_loads.jl | 22 +++++++++++----------- src/core/scenario.jl | 8 ++++---- test/test_with_xpress.jl | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/core/heating_cooling_loads.jl b/src/core/heating_cooling_loads.jl index bb50a944a..aabea0b52 100644 --- a/src/core/heating_cooling_loads.jl +++ b/src/core/heating_cooling_loads.jl @@ -209,23 +209,23 @@ end """ function get_existing_chiller_default_cop(; existing_chiller_max_thermal_factor_on_peak_load=nothing, - loads_kw=nothing, - loads_kw_thermal=nothing) + max_load_kw=nothing, + max_load_kw_thermal=nothing) This function returns the default value for ExistingChiller.cop based on: 1. No information about load, returns average of lower and higher cop default values (`cop_unknown_thermal`) - 2. If the cooling electric `loads_kw` is known, we first guess the thermal load profile using `cop_unknown_thermal`, + 2. If the cooling electric `max_load_kw` is known, we first guess the thermal load profile using `cop_unknown_thermal`, and then we use the default logic to determine the `existing_chiller_cop` based on the peak thermal load with a thermal factor multiplier. - 3. If the cooling thermal `loads_kw_thermal` is known, same as 2. but we don't have to guess the cop to convert electric to thermal load first. + 3. If the cooling thermal `max_load_kw_thermal` is known, same as 2. but we don't have to guess the cop to convert electric to thermal load first. """ -function get_existing_chiller_default_cop(; existing_chiller_max_thermal_factor_on_peak_load=nothing, loads_kw=nothing, loads_kw_thermal=nothing) +function get_existing_chiller_default_cop(; existing_chiller_max_thermal_factor_on_peak_load=nothing, max_load_kw=nothing, max_load_kw_thermal=nothing) cop_less_than_100_ton = 4.40 cop_more_than_100_ton = 4.69 cop_unknown_thermal = (cop_less_than_100_ton + cop_more_than_100_ton) / 2.0 max_cooling_load_ton = nothing - if !isnothing(loads_kw_thermal) - max_cooling_load_ton = maximum(loads_kw_thermal) / KWH_THERMAL_PER_TONHOUR - elseif !isnothing(loads_kw) - max_cooling_load_ton = maximum(loads_kw) / KWH_THERMAL_PER_TONHOUR * cop_unknown_thermal + if !isnothing(max_load_kw_thermal) + max_cooling_load_ton = max_load_kw_thermal / KWH_THERMAL_PER_TONHOUR + elseif !isnothing(max_load_kw) + max_cooling_load_ton = max_load_kw / KWH_THERMAL_PER_TONHOUR * cop_unknown_thermal end if isnothing(max_cooling_load_ton) || isnothing(existing_chiller_max_thermal_factor_on_peak_load) return cop_unknown_thermal @@ -366,7 +366,7 @@ struct CoolingLoad elseif (!isempty(doe_reference_name) || !isempty(blended_doe_reference_names)) || isnothing(existing_chiller_cop) # Generated loads_kw (electric) above based on the building's default fraction of electric profile chiller_cop = get_existing_chiller_default_cop(;existing_chiller_max_thermal_factor_on_peak_load=existing_chiller_max_thermal_factor_on_peak_load, - loads_kw=loads_kw) + max_load_kw=maximum(loads_kw)) else chiller_cop = existing_chiller_cop end @@ -376,7 +376,7 @@ struct CoolingLoad # Now that cooling thermal loads_kw_thermal is known, update existing_chiller_cop if it was not input if isnothing(existing_chiller_cop) existing_chiller_cop = get_existing_chiller_default_cop(;existing_chiller_max_thermal_factor_on_peak_load=existing_chiller_max_thermal_factor_on_peak_load, - loads_kw_thermal=loads_kw_thermal) + max_load_kw_thermal=maximum(loads_kw_thermal)) end if length(loads_kw_thermal) < 8760*time_steps_per_hour diff --git a/src/core/scenario.jl b/src/core/scenario.jl index 904e07855..1048a42d6 100644 --- a/src/core/scenario.jl +++ b/src/core/scenario.jl @@ -288,14 +288,14 @@ function Scenario(d::Dict; flex_hvac_from_json=false) if haskey(d, "ExistingChiller") if !haskey(d["ExistingChiller"], "cop") d["ExistingChiller"]["cop"] = get_existing_chiller_default_cop(; existing_chiller_max_thermal_factor_on_peak_load=1.25, - loads_kw=nothing, - loads_kw_thermal=chiller_inputs[:loads_kw_thermal]) + max_load_kw=nothing, + max_load_kw_thermal=maximum(chiller_inputs[:loads_kw_thermal])) end chiller_inputs = merge(chiller_inputs, dictkeys_tosymbols(d["ExistingChiller"])) else chiller_inputs[:cop] = get_existing_chiller_default_cop(; existing_chiller_max_thermal_factor_on_peak_load=1.25, - loads_kw=nothing, - loads_kw_thermal=chiller_inputs[:loads_kw_thermal]) + max_load_kw=nothing, + max_load_kw_thermal=maximum(chiller_inputs[:loads_kw_thermal])) end existing_chiller = ExistingChiller(; chiller_inputs...) end diff --git a/test/test_with_xpress.jl b/test/test_with_xpress.jl index 7aaf7b9ad..13647f40a 100644 --- a/test/test_with_xpress.jl +++ b/test/test_with_xpress.jl @@ -799,7 +799,7 @@ end # When the user specifies inputs["ExistingChiller"]["cop"], this changes the **electric** consumption of the chiller to meet that cooling thermal load crb_cop = REopt.get_existing_chiller_default_cop(; existing_chiller_max_thermal_factor_on_peak_load=s.existing_chiller.max_thermal_factor_on_peak_load, - loads_kw_thermal=s.cooling_load.loads_kw_thermal) + max_load_kw_thermal=maximum(s.cooling_load.loads_kw_thermal)) cooling_thermal_load_tonhour_total = 1427329.0 * crb_cop / REopt.KWH_THERMAL_PER_TONHOUR # From CRB models, in heating_cooling_loads.jl, BuiltInCoolingLoad data for location (SanFrancisco Hospital) cooling_electric_load_total_mod_cop_kwh = cooling_thermal_load_tonhour_total / inputs.s.existing_chiller.cop * REopt.KWH_THERMAL_PER_TONHOUR From 8b2296809bbb20a70d148b5906018738b31c306b Mon Sep 17 00:00:00 2001 From: Alex Zolan Date: Tue, 8 Aug 2023 12:25:14 -0600 Subject: [PATCH 13/17] Update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ebcda882c..f8323ed0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,9 @@ Classify the change according to the following categories: ### Deprecated ### Removed +## Develop 2023-08-08 +### Changed +- Updated `get_existing_chiller_cop` function to accept scalar values instead of vectors to allow for faster API transactions. ## v0.32.4 ### Changed - Consolidated PVWatts API calls to 1 call (previously 3 separate calls existed). API call occurs in `src/core/utils.jl/call_pvwatts_api()`. This function is called for PV in `src/core/production_factor.jl/get_production_factor(PV)` and for GHP in `src/core/scenario.jl`. If GHP and PV are evaluated together, the GHP PVWatts call for ambient temperature is also used to assign the pv.production_factor_series in Scenario.jl so that the PVWatts API does not get called again downstream in `get_production_factor(PV)`. From 9581476e358797642c6c438ac17439df6d80e605 Mon Sep 17 00:00:00 2001 From: "Rathod, Bhavesh" Date: Tue, 8 Aug 2023 20:23:12 -0400 Subject: [PATCH 14/17] Update steam_turbine.jl fix `defaults` population bug --- src/core/steam_turbine.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/steam_turbine.jl b/src/core/steam_turbine.jl index e8c488c37..7359afe1c 100644 --- a/src/core/steam_turbine.jl +++ b/src/core/steam_turbine.jl @@ -104,8 +104,10 @@ function SteamTurbine(d::Dict; avg_boiler_fuel_load_mmbtu_per_hour::Union{Float6 ) # set all missing default values in custom_chp_inputs - defaults = get_steam_turbine_defaults_size_class(;avg_boiler_fuel_load_mmbtu_per_hour=avg_boiler_fuel_load_mmbtu_per_hour, + stm_defaults_response = get_steam_turbine_defaults_size_class(;avg_boiler_fuel_load_mmbtu_per_hour=avg_boiler_fuel_load_mmbtu_per_hour, size_class=st.size_class) + + defaults = stm_defaults_response["default_inputs"] for (k, v) in custom_st_inputs if isnan(v) if !(k == :inlet_steam_temperature_degF && !isnan(st.inlet_steam_superheat_degF)) From c61e8ac8f12c771516373c13353b3eeabf7d759a Mon Sep 17 00:00:00 2001 From: "Rathod, Bhavesh" Date: Wed, 9 Aug 2023 22:52:58 -0400 Subject: [PATCH 15/17] Update CHANGELOG.md --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8323ed0e..85ff08dd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,7 @@ Classify the change according to the following categories: ### Deprecated ### Removed -## Develop 2023-08-08 +## Develop 2023-08-09 ### Changed - Updated `get_existing_chiller_cop` function to accept scalar values instead of vectors to allow for faster API transactions. ## v0.32.4 @@ -38,6 +38,7 @@ Classify the change according to the following categories: - Issue with using a leap year with a URDB rate - the URDB rate was creating energy_rate of length 8784 instead of intended 8760 - Don't double add adjustments to urdb rates with non-standard units - Corrected `Generator` **installed_cost_per_kw** from 500 to 650 if **only_runs_during_grid_outage** is _true_ or 800 if _false_ +- Corrected `SteamTurbine` defaults population from `get_steam_turbine_defaults_size_class()` ## v0.32.3 ### Fixed From 470d853391fa351322143c594366c2656f7a2cd6 Mon Sep 17 00:00:00 2001 From: Bill Becker Date: Thu, 10 Aug 2023 14:01:25 -0600 Subject: [PATCH 16/17] Fix syntax error for length conditional --- src/core/simulated_load.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/simulated_load.jl b/src/core/simulated_load.jl index 5b85a49d0..c8879e6be 100644 --- a/src/core/simulated_load.jl +++ b/src/core/simulated_load.jl @@ -117,9 +117,9 @@ function simulated_load(d::Dict) # Monthly loads (default is empty list) monthly_totals_kwh = get(d, "monthly_totals_kwh", Real[]) if !isempty(monthly_totals_kwh) - if length(monthly_totals_kwh != 12) + if length(monthly_totals_kwh) != 12 throw(@error("monthly_totals_kwh must contain a value for each of the 12 months")) - end + end bad_index = [] for (i, kwh) in enumerate(monthly_totals_kwh) if isnothing(kwh) @@ -398,7 +398,7 @@ function simulated_load(d::Dict) # Monthly loads (default is empty list) monthly_tonhour = get(d, "monthly_tonhour", Real[]) if !isempty(monthly_tonhour) - if length(monthly_tonhour != 12) + if length(monthly_tonhour) != 12 throw(@error("monthly_tonhour must contain a value for each of the 12 months")) end bad_index = [] From 80c9fc74b58c98db7a6a90d0c98f05e937316414 Mon Sep 17 00:00:00 2001 From: Bill Becker <42586683+Bill-Becker@users.noreply.github.com> Date: Thu, 10 Aug 2023 14:07:58 -0600 Subject: [PATCH 17/17] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85ff08dd9..7c12e7d65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,10 @@ Classify the change according to the following categories: ## Develop 2023-08-09 ### Changed - Updated `get_existing_chiller_cop` function to accept scalar values instead of vectors to allow for faster API transactions. +### Fixed +- Steamturbine defaults processing +- simulated_load monthly values processing + ## v0.32.4 ### Changed - Consolidated PVWatts API calls to 1 call (previously 3 separate calls existed). API call occurs in `src/core/utils.jl/call_pvwatts_api()`. This function is called for PV in `src/core/production_factor.jl/get_production_factor(PV)` and for GHP in `src/core/scenario.jl`. If GHP and PV are evaluated together, the GHP PVWatts call for ambient temperature is also used to assign the pv.production_factor_series in Scenario.jl so that the PVWatts API does not get called again downstream in `get_production_factor(PV)`.