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

Appendix G dev swh single building #1692

Merged
merged 33 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
d6b87f3
Add check_swh_single_building_type() in prm_check.rb
lzwang26 Feb 20, 2024
1136187
Add test_swh_single_building_type in test_appendix_g_prm.rb
lzwang26 Feb 20, 2024
0789749
Add swh_single_building_type data to prototype_list.json
lzwang26 Feb 20, 2024
49a70a0
Modify the model_apply_baseline_swh_loops() in Standards.Model.rb
lzwang26 Feb 20, 2024
d1c39f1
Modify ashrae_90_1_prm_2019.Model.rb
lzwang26 Feb 20, 2024
4373118
Add ashrae_90_1_prm_2019_WaterHeaterMixed.rb
lzwang26 Feb 20, 2024
7a2b8ab
Modify openstudio-standards.rb
lzwang26 Feb 20, 2024
47fdc19
Update water heater data
lzwang26 Feb 20, 2024
5a96948
Modified the comment.
lzwang26 Feb 22, 2024
0b13eb8
Use get_additional_property_as_string to retrieve a string additional…
lzwang26 Feb 22, 2024
70b087b
Delete puts. Comment out if-else statement.
lzwang26 Feb 22, 2024
8b20f11
Use get_additional_property_as_integer() to retrieve water heater com…
lzwang26 Feb 22, 2024
8048cc3
Update the Warn to Error.
lzwang26 Feb 22, 2024
7a3aff4
Update the Warn to Error.
lzwang26 Feb 22, 2024
a9fa54d
Delete the checks for efficiency and surface loss coefficient.
lzwang26 Feb 22, 2024
52bb35d
Merge branch 'AppendixG_Dev' of https://github.com/NREL/openstudio-st…
lzwang26 Mar 7, 2024
3e82d1f
Solve conflicts and merge
lzwang26 Mar 14, 2024
b60765e
Modify single swh model_apply_water_heater_prm_parameter()
lzwang26 Mar 18, 2024
4f9de06
Add the function water_heater_mixed_apply_prm_baseline_fuel_type()
lzwang26 Mar 18, 2024
8e76845
Remove model_find_object() in prm_2019.
lzwang26 Mar 18, 2024
3e5dd2f
Fix an issue.
lzwang26 Mar 21, 2024
70ba3bb
Merge branch 'AppendixG_Dev' of https://github.com/NREL/openstudio-st…
lzwang26 Mar 26, 2024
d3c5c99
Update fuel type function.
lzwang26 Mar 26, 2024
93e47dd
Update fuel type function.
lzwang26 Mar 26, 2024
08ca98a
Merge branch 'master' of https://github.com/NREL/openstudio-standards…
lzwang26 Apr 12, 2024
134e463
Modify single building type swh
lzwang26 Apr 30, 2024
9848c1c
Modify single building type swh
lzwang26 Apr 30, 2024
1a14429
Merge branch 'AppendixG_Dev' into AppendixG_Dev_swh_single_building
weilixu May 7, 2024
7f801c9
Merge branch 'AppendixG_Dev' of https://github.com/NREL/openstudio-st…
lzwang26 May 7, 2024
dfdc686
Pull AppendixG_Dev and update single building type swh
lzwang26 May 7, 2024
6fab85f
Merge branch 'AppendixG_Dev_swh_single_building' of https://github.co…
lzwang26 May 7, 2024
8e451f5
Modify comments
lzwang26 May 7, 2024
a346a74
Update single building type swh
lzwang26 May 9, 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
1 change: 1 addition & 0 deletions lib/openstudio-standards.rb
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ module OpenstudioStandards
# 90.1-PRM-2019
require_relative "#{stds}/ashrae_90_1_prm/ashrae_90_1_prm_2019/ashrae_90_1_prm_2019"
require_relative "#{stds}/ashrae_90_1_prm/ashrae_90_1_prm_2019/ashrae_90_1_prm_2019.Model"
require_relative "#{stds}/ashrae_90_1_prm/ashrae_90_1_prm_2019/ashrae_90_1_prm_2019_WaterHeaterMixed"
# DOE 1980-2004
require_relative "#{stds}/ashrae_90_1/doe_ref_1980_2004/doe_ref_1980_2004.AirLoopHVAC"
require_relative "#{stds}/ashrae_90_1/doe_ref_1980_2004/doe_ref_1980_2004.Model"
Expand Down
6 changes: 4 additions & 2 deletions lib/openstudio-standards/standards/Standards.Model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def model_create_prm_any_baseline_building(user_model, building_type, climate_zo

# Modify the service water heating loops per the baseline rules
OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.Model', '*** Cleaning up Service Water Heating Loops ***')
model_apply_baseline_swh_loops(model, building_type)
model_apply_baseline_swh_loops(model, building_type, swh_building_type)

# Determine the baseline HVAC system type for each of the groups of zones and add that system type.
OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.Model', '*** Adding Baseline HVAC Systems ***')
Expand Down Expand Up @@ -5556,7 +5556,9 @@ def model_add_vals_to_sch(model, day_sch, sch_type, values)
# @param building_type [String] the building type
# @return [Boolean] returns true if successful, false if not
# @author Julien Marrec
def model_apply_baseline_swh_loops(model, building_type)
def model_apply_baseline_swh_loops(model,
building_type,
swh_building_type = 'All others')
model.getPlantLoops.sort.each do |plant_loop|
# Skip non service water heating loops
next unless plant_loop_swh_loop?(plant_loop)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,92 @@ def model_get_percent_of_surface_range(model, wwr_parameter)
end
return wwr_range
end

# Modify the existing service water heating loops to match the baseline required heating type.
# @param model [OpenStudio::Model::Model] OpenStudio model object
# @param building_type [String] the building type (For consistency with the standard class, not used in the method)
# @param swh_building_type [String] the swh building are type
# @return [Boolean] returns true if successful, false if not

def model_apply_baseline_swh_loops(model,
building_type,
swh_building_type = 'All others')

building_type_list = []
# Get the uniq building area type numbers.
model.getWaterUseEquipments.each do |wateruse_equipment|
building_type_list << get_additional_property_as_string(wateruse_equipment, 'building_type_swh')
end

# Apply baseline swh loops
if building_type_list.uniq.size <= 1
if building_type_list
swh_building_type = building_type_list.uniq[0]
end
model.getPlantLoops.each do |plant_loop|
# Skip non service water heating loops
next unless plant_loop_swh_loop?(plant_loop)

# Rename the loop to avoid accidentally hooking up the HVAC systems to this loop later.
plant_loop.setName('Service Water Heating Loop')

htg_fuels, combination_system, storage_capacity, total_heating_capacity = plant_loop_swh_system_type(plant_loop)

electric = true
if htg_fuels.include?('NaturalGas') ||
htg_fuels.include?('PropaneGas') ||
htg_fuels.include?('FuelOilNo1') ||
htg_fuels.include?('FuelOilNo2') ||
htg_fuels.include?('Coal') ||
htg_fuels.include?('Diesel') ||
htg_fuels.include?('Gasoline')
electric = false
end

# Per Table G3.1 11.e, if the baseline system was a combination of heating and service water heating,
# delete all heating equipment and recreate a WaterHeater:Mixed.
if combination_system
a = plant_loop.supplyComponents
b = plant_loop.demandComponents
plantloop_components = a += b
plantloop_components.each do |component|
# Get the object type
obj_type = component.iddObjectType.valueName.to_s
next if ['OS_Node', 'OS_Pump_ConstantSpeed', 'OS_Pump_VariableSpeed', 'OS_Connector_Splitter', 'OS_Connector_Mixer', 'OS_Pipe_Adiabatic'].include?(obj_type)

component.remove
end

water_heater = OpenStudio::Model::WaterHeaterMixed.new(model)
water_heater.setName('Baseline Water Heater')
water_heater.setHeaterMaximumCapacity(total_heating_capacity)
water_heater.setTankVolume(storage_capacity)
model_apply_water_heater_prm_parameter(water_heater,
swh_building_type)
plant_loop.addSupplyBranchForComponent(water_heater)

# If it's not a combination heating and service water heating system
# just change the fuel type of all water heaters on the system
# to electric resistance if it's electric
else
# Per Table G3.1 11.i, piping losses was deleted
plant_loop_adiabatic_pipes_only(plant_loop)

if electric
plant_loop.supplyComponents.each do |component|
next unless component.to_WaterHeaterMixed.is_initialized

water_heater = component.to_WaterHeaterMixed.get
model_apply_water_heater_prm_parameter(water_heater,
swh_building_type)
end
end
end
end
else
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggest commenting out the else for now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

# Todo: Multiple building type
end

return true
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
class ASHRAE901PRM2019 < ASHRAE901PRM

# Apply the prm parameter to a water heater based on the
# building area type.
# @param water_heater_mixed [OpenStudio::Model::WaterHeaterMixed] water heater mixed object
# @param building_type_swh [String] the swh building are type
# @return [Boolean] returns true if successful, false if not
def model_apply_water_heater_prm_parameter(water_heater_mixed, building_type_swh)
new_fuel = water_heater_mixed_apply_prm_baseline_fuel_type(building_type_swh)
water_heater_mixed_apply_efficiency(water_heater_mixed)
# Change the fuel type if necessary
old_fuel = water_heater_mixed.heaterFuelType
unless new_fuel == old_fuel
water_heater_mixed.setHeaterFuelType(new_fuel)
OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.WaterHeaterMixed', "For #{water_heater_mixed.name}, changed baseline water heater fuel from #{old_fuel} to #{new_fuel}.")
end
return true
end
# Apply the prm fuel type to a water heater based on the
# building area type.
# @param building_type [String] the building type (For consistency with the standard class, not used in the method)
# @return [string] returns the new fuel
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use enum
@return [OpenStudio::FuelType] returns fuel type

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep using string as discussed.

def water_heater_mixed_apply_prm_baseline_fuel_type(building_type)
# Get the fuel type data
heater_prop = model_find_object(standards_data['prm_swh_bldg_type'], {'swh_building_type' => building_type})
new_fuel_data = heater_prop['baseline_heating_method']
# There are only two water heater fuel type in the prm database:
# ("Gas Storage" and "Electric Resistance Storage")
# Change the prm fuel type to openstudio fuel type
if new_fuel_data == "Gas Storage"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to start using enums instead of strings.
Do this:
new_fuel = OpenStudio::FuelType::new('NaturalGas')

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep using string as discussed.

new_fuel = "NaturalGas"
else
new_fuel = "Electricity"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use single quote for strings 'Electricity'

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified.

end
return new_fuel
end
end

Loading