Skip to content

Commit

Permalink
convert load vectors to max loads in arguments to get_existing_chille…
Browse files Browse the repository at this point in the history
…r_default_cop
  • Loading branch information
zolanaj committed Aug 8, 2023
1 parent c93d541 commit 70ae226
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
22 changes: 11 additions & 11 deletions src/core/heating_cooling_loads.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/core/scenario.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/test_with_xpress.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 70ae226

Please sign in to comment.