From e95fda7d5a92e7557dfd35e9ba481f0677169ccf Mon Sep 17 00:00:00 2001 From: JieXiong9119 <69597597+JieXiong9119@users.noreply.github.com> Date: Wed, 25 Nov 2026 00:51:55 -0700 Subject: [PATCH 1/3] add ptac+furnace for NYC property 2 example --- README.md | 14 + lib/BOSS/baseline_hvac_planner.rb | 11 +- lib/BOSS/boss.rb | 26 +- lib/BOSS/hvac_topology_selector.rb | 70 +- lib/boss_cli.rb | 4 +- ...ergy_Efficiency_Report_Property_2_l200.xml | 3046 +++++++++++++++++ spec/tests/unit/boss_spec.rb | 7 +- .../heating_with_terminal_cooling_spec.rb | 91 + 8 files changed, 3256 insertions(+), 13 deletions(-) create mode 100644 spec/files/v2.7.0/Example_NYC_Energy_Efficiency_Report_Property_2_l200.xml create mode 100644 spec/tests/unit/heating_with_terminal_cooling_spec.rb diff --git a/README.md b/README.md index 4b29c95..fafe1cb 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,20 @@ BOSS also falls back when: On fallback, BOSS uses the `system_type` mapping below with `add_hvac` set to `true`, and logs a warning explaining why. +#### Central furnace with cooling-only PTACs + +An HVACSystem whose heating and cooling are delivered separately maps to the gem's `hvac_heating_with_terminal_cooling` measure (`heating_source` `central_gas_furnace`). This is read from standard BuildingSync elements only: + +- one Delivery with `CentralAirDistribution` that references only a gas `Furnace` HeatingSource (`HeatingMedium` `Air`); +- one Delivery with `ZoneEquipment` that references only a CoolingSource whose `DXSystemType` is `Packaged terminal air conditioner (PTAC)`; +- both serve the same premises. A `MechanicalVentilation` record without a `VentilationType` linked only to these deliveries is treated as an annotation. + +See `Example_NYC_Energy_Efficiency_Report_Property_2_l200.xml`, which restates the user-defined fields of `Example_NYC_Energy_Efficiency_Report_Property_2.xml` as standard elements. BOSS writes `baseline/hvac_mapping_report.json` with the plan status, the HVAC steps, and the messages. Add `--require_l200` (`require_l200: true`) to raise an error instead of falling back. + +```bash +bundle exec boss write_baseline_osw my_buildingsync.xml -o ./output_dir --require_l200 +``` + Integration simulations currently cover the packaged rooftop heat pump, with and without recovery (`Example_ASHRAE_L2_Report_l200_erv.xml`, an edited derivative of `Example_ASHRAE_L2_Report.xml`); the other configurations are covered by unit specs. ## OpenStudio Compatibility Version diff --git a/lib/BOSS/baseline_hvac_planner.rb b/lib/BOSS/baseline_hvac_planner.rb index b10544d..46cea7f 100644 --- a/lib/BOSS/baseline_hvac_planner.rb +++ b/lib/BOSS/baseline_hvac_planner.rb @@ -89,7 +89,7 @@ def plan(hvac_systems, standards_template, operation: 'create', include_system_i steps << { measure_dir_name: RECOVERY_MEASURE, arguments: {} } if !recovery.empty? # ComStock picks HRV or ERV by climate zone; an audited ERV gets ComStock's ERV values. steps << ERV_STEP if recovery.any? { |r| r.measure_arguments['ventilation_type'] == ERV_TYPE } - Plan.new(status: :topology, steps:, messages: []) + Plan.new(status: :topology, steps:, messages: (results + recovery).flat_map(&:messages).uniq) end # @return [Array] HVACSystem IDs that measures name as alternatives or modified systems @@ -111,6 +111,15 @@ def self._system_ids(hvac_systems) # @return [Array] premises, or one Building premise when Section links cover the building def self.normalize_premises(premises, document) + linked_buildings = premises.select { |premise| premise[:type] == 'Building' } + if linked_buildings.length == 1 && premises.length > 1 + # A Building link already covers that building's Sections. + building_id = linked_buildings.first[:id] + section_ids = REXML::XPath.match(document, "//*[local-name()='Building'][@ID='#{building_id}']" \ + "/*[local-name()='Sections']/*[local-name()='Section']/@ID").map(&:value) + others = premises - linked_buildings + return linked_buildings if others.all? { |premise| premise[:type] == 'Section' && section_ids.include?(premise[:id]) } + end building_id = covered_building_id(premises, document) building_id ? [{ type: 'Building', id: building_id }] : premises end diff --git a/lib/BOSS/boss.rb b/lib/BOSS/boss.rb index 69a1085..95ec6af 100644 --- a/lib/BOSS/boss.rb +++ b/lib/BOSS/boss.rb @@ -22,8 +22,9 @@ class Boss # @param output_dir [String] # @param epw_file_path [String] if provided, full/path/to/my.epw # @param standard_to_be_used [String] + # @param require_l200 [Boolean] raise instead of falling back to create_typical HVAC class << self - def write_baseline_osw(xml_file_path, output_dir, epw_file_path, standard_to_be_used) + def write_baseline_osw(xml_file_path, output_dir, epw_file_path, standard_to_be_used, require_l200: false) # check file exists if !File.exist?(xml_file_path) message = "File '#{xml_file_path}' does not exist" @@ -36,7 +37,13 @@ def write_baseline_osw(xml_file_path, output_dir, epw_file_path, standard_to_be_ bsync_doc = REXML::Document.new(xml_data, ignore_whitespace_nodes: :all) bsync_reader = BOSS::BuildingSyncReader.new(bsync_doc, epw_file_path, standard_to_be_used) - baseline_osw = build_baseline_osw(bsync_reader) + hvac_plan = plan_baseline_hvac(bsync_reader) + if require_l200 && !hvac_plan.topology? + message = "L200 HVAC topology required but the baseline would fall back: #{hvac_plan.messages.join(' ')}" + OpenStudio.logFree(OpenStudio::Error, 'BOSS.write_baseline_osw', message) + raise message + end + baseline_osw = build_baseline_osw(bsync_reader, hvac_plan:) # write to file workflow_dir = File.join(output_dir, 'baseline') @@ -45,6 +52,9 @@ def write_baseline_osw(xml_file_path, output_dir, epw_file_path, standard_to_be_ File.open(osw_path, 'w') do |file| file << JSON.pretty_generate(baseline_osw) end + report = { status: hvac_plan.status, hvac_steps: hvac_plan.steps.map { |step| step[:measure_dir_name] }, + messages: hvac_plan.messages } + File.write(File.join(workflow_dir, 'hvac_mapping_report.json'), JSON.pretty_generate(report)) osw_path end @@ -71,8 +81,15 @@ def run_baseline_osw(osw_dir) private + def plan_baseline_hvac(bsync_reader) + hvac_systems = bsync_reader.get_hvac_systems_xml + BaselineHvacPlanner.new + .plan(hvac_systems, bsync_reader.get_standard_template, + exclude_system_ids: BaselineHvacPlanner.proposed_system_ids(hvac_systems)) + end + # Returns a new, unsaved baseline OSW hash for the given reader. - def build_baseline_osw(bsync_reader) + def build_baseline_osw(bsync_reader, hvac_plan: plan_baseline_hvac(bsync_reader)) # start with an empty baseline workflow file = File.read(EMPTY_BASELINE_OSW_PATH) baseline_osw = JSON.parse(file, symbolize_names: true) @@ -82,9 +99,6 @@ def build_baseline_osw(bsync_reader) OSWArgPopulator::populate_change_building_location_args(baseline_osw, bsync_reader) OSWArgPopulator::populate_create_bar_from_building_type_ratios_args(baseline_osw, bsync_reader) - hvac_systems = bsync_reader.get_hvac_systems_xml - hvac_plan = BaselineHvacPlanner.new.plan(hvac_systems, bsync_reader.get_standard_template, - exclude_system_ids: BaselineHvacPlanner.proposed_system_ids(hvac_systems)) OSWArgPopulator::populate_create_typical_building_from_model_args(baseline_osw, bsync_reader, add_hvac: !hvac_plan.topology?) if hvac_plan.topology? diff --git a/lib/BOSS/hvac_topology_selector.rb b/lib/BOSS/hvac_topology_selector.rb index 566b10d..9a8d511 100644 --- a/lib/BOSS/hvac_topology_selector.rb +++ b/lib/BOSS/hvac_topology_selector.rb @@ -483,6 +483,9 @@ def self.central_air_absent(x) failed end + TERMINAL_COOLING_CONFIGURATION = 'Central furnace with cooling-only PTAC' + TERMINAL_COOLING_MEASURE = 'hvac_heating_with_terminal_cooling' + # @param hvac_systems [REXML::Element] an HVACSystems element (or any parent of HVACSystem elements) # @return [Array] def select(hvac_systems) @@ -521,9 +524,70 @@ def _select_system(sys) end folded = _economizer_folds(deliveries) - results = deliveries.reject { |d| ventilation_links.key?(d.attributes['ID']) || folded.key?(d.attributes['ID']) } - .map { |delivery| _select_delivery(sys, delivery, index) } - results + others.map { |other| _select_other(sys, other, index, ventilation_links, folded) } + open = deliveries.reject { |d| ventilation_links.key?(d.attributes['ID']) || folded.key?(d.attributes['ID']) } + pair, paired_ids = _heating_with_terminal_cooling(sys, open, index) + paired_ids ||= [] + annotations, others = others.partition do |other| + links = Context.nodes(other, 'LinkedDeliveryIDs/LinkedDeliveryID').map { |l| l.attributes['IDref'] } + !paired_ids.empty? && _ventilation_annotation?(other) && !links.empty? && (links - paired_ids).empty? + end + unless annotations.empty? + pair.record_ids |= annotations.map { |o| o.attributes['ID'] } + pair.messages << 'MechanicalVentilation without a VentilationType names no separate ventilation equipment.' + end + results = open.reject { |d| paired_ids.include?(d.attributes['ID']) } + .map { |delivery| _select_delivery(sys, delivery, index) } + [pair].compact + results + others.map { |other| _select_other(sys, other, index, ventilation_links, folded) } + end + + # A heating-only central-air delivery from a gas furnace plus a cooling-only zone-equipment + # delivery from PTACs, in the same HVACSystem and premises, is one central-heating, + # terminal-cooling configuration. + # @return [Array(Result, Array), nil] the result and the delivery IDs it covers + def _heating_with_terminal_cooling(sys, deliveries, index) + contexts = deliveries.map { |d| Context.new(sys, d, index) } + return nil unless contexts.all? { |x| x.conflicts.empty? } + + heating = contexts.select do |x| + !x.hs.nil? && x.ref_ids(x.d, 'CoolingSourceID').empty? && !x.a.nil? && x.gas_air_furnace + end + cooling = contexts.select do |x| + !x.cs.nil? && x.ref_ids(x.d, 'HeatingSourceID').empty? && x.zone_equipment_only && + x.eq(x.dx, 'DXSystemType', 'Packaged terminal air conditioner (PTAC)') && x.packaged_air_cooled_dx + end + return nil unless heating.length == 1 && cooling.length == 1 + + hx = heating.first + cx = cooling.first + delivery_ids = [hx.d, cx.d].map { |el| el.attributes['ID'] } + ids = delivery_ids + [hx.hs, cx.cs].map { |el| el.attributes['ID'] } + premises = _premises(hx.d, sys) + order = ->(list) { list.sort_by { |p| [p[:type], p[:id]] } } + failures = [] + failures << 'Missing LinkedPremises on Delivery or HVACSystem' if premises.empty? + failures << 'Heating and cooling deliveries must serve the same premises' if order.call(premises) != order.call(_premises(cx.d, sys)) + failures += self.class.central_air_absent(hx).map { |p| "#{p} must be absent" } + failures << 'Z/FanBased/FanBasedDistributionType must be absent' if cx.fan_based_distribution(cx.z) + [ + ['A/AirDeliveryType', hx.guard(hx.a, 'AirDeliveryType', 'Central fan')], + ['A/ReheatSource', hx.guard(hx.a, 'ReheatSource', 'None')], + ['H/Furnace/FurnaceType', hx.guard(hx.h, 'Furnace/FurnaceType', FURNACE_TYPES)], + ['CS/PrimaryFuel', cx.guard(cx.cs, 'PrimaryFuel', ELECTRIC)], + ['CS/CoolingMedium', cx.guard(cx.cs, 'CoolingMedium', AIR_REFRIGERANT)] + ].each { |name, ok| failures << "Guard failed: #{name}" unless ok } + sys_id = sys.attributes['ID'] + unless failures.empty? + return [_result(:conflicting_input, sys_id, ids, premises, nil, failures, configuration: TERMINAL_COOLING_CONFIGURATION), + delivery_ids] + end + + quantity = ->(record) { Context.texts(record, 'Quantity').first || '1' } + messages = ["Source inventory kept as recorded: #{hx.hs.attributes['ID']} quantity #{quantity.call(hx.hs)}, " \ + "#{cx.cs.attributes['ID']} quantity #{quantity.call(cx.cs)}. Generated: one PTAC per model zone in scope."] + [_result(:match, sys_id, ids, premises, [:delivery_pair, *delivery_ids], messages, + configuration: TERMINAL_COOLING_CONFIGURATION, measure: TERMINAL_COOLING_MEASURE, + measure_arguments: { 'heating_source' => 'central_gas_furnace' }), + delivery_ids] end ECONOMIZER_ONLY_CHILDREN = ['AirSideEconomizer', 'SupplyAirTemperatureResetControl', 'StaticPressureResetControl'].freeze diff --git a/lib/boss_cli.rb b/lib/boss_cli.rb index 560b860..cb8fb98 100755 --- a/lib/boss_cli.rb +++ b/lib/boss_cli.rb @@ -16,9 +16,11 @@ class CLI < Thor option :epw_path, :aliases => "-w", :desc => "path to weather file. If not given, one is derived from the BUILDINGSYNC_FILE." option :standard_version, :aliases => "-v", :desc => "building standard to use (eg ASHRAE90.1 or CaliforniaTitle24). Defaults to ASHRAE90.1" option :run, :aliases => "-r", :desc => "if set, will also run the baseline" + option :require_l200, :type => :boolean, :default => false, :desc => "fail instead of falling back to create_typical_building_from_model HVAC" def write_baseline_osw(buildingsync_file) standard_version = options[:standard_version] || ASHRAE90_1 - osw_path = BOSS::Boss.write_baseline_osw(buildingsync_file, options[:output_path], options[:epw_path], standard_version) + osw_path = BOSS::Boss.write_baseline_osw(buildingsync_file, options[:output_path], options[:epw_path], standard_version, + require_l200: options[:require_l200]) puts "Baseline OSW written to: #{osw_path}" if options[:run] puts "running!" diff --git a/spec/files/v2.7.0/Example_NYC_Energy_Efficiency_Report_Property_2_l200.xml b/spec/files/v2.7.0/Example_NYC_Energy_Efficiency_Report_Property_2_l200.xml new file mode 100644 index 0000000..41996a2 --- /dev/null +++ b/spec/files/v2.7.0/Example_NYC_Energy_Efficiency_Report_Property_2_l200.xml @@ -0,0 +1,3046 @@ + + + + + + + + + + Custom + Borough + Manhattan + + + Custom + Tax Block + 12345 + + + Custom + Tax Lot + 6789 + + + Example NYC Energy Efficiency Report Property + + New York + NY + + + + Example NYC Energy Efficiency Report Building 2 + Example NYC building for import/export. Multiple input fields have + been marked as 'n/a' for this building to demonstrate this capability. + Input data entered may not necessarily be considered reflective of a typical + building. This example is configured to import and export with BuildingSync version + 2.3.0. The building will also successfully convert to an Asset Score building for + modeling. + + + Custom + Atlanta Building ID + + + + Custom + BIN + 2222222 + + + Custom + EER + A + + + Custom + Portfolio Manager Building ID + 1234 + + + Custom + Audit Template Building ID + 23857 + + + + + + 456 Example Street + + + New York + NY + 10118 + + + NYCW + + Office + false + 15 + 0 + true + true + + + Cooled only + 0.0 + + + Gross + 200000.0 + + + Heated and Cooled + 200000.0 + + + Heated only + 0.0 + + + 18000.0 + 0.0 + 1500.0 + 0.5 + 1950 + 20.0 + 80.0 + 2 + + + Whole building + L-Shape + + + + + + + + + + + + + + + Good + + + + + + + + + + + + + + Space function + Office + Office + + + Peak total occupants + 1500 + + + + + 40.0 + Hours per week + + + 50.0 + Weeks per year + + + + + Gross + 200000.0 + + + Conditioned + 200000.0 + + + Common + 0.0 + + + Tenant + 200000.0 + + + + + Floor Area For Gross Is Not Applicable + false + + + Miscellaneous Electric Load + 1.5 + + + Miscellaneous Electric Load Is Not Applicable + false + + + Occupancy Classification Is Not Applicable + false + + + Percentage Dwellings Occupied Is Not Applicable + true + + + Principal HVAC System Type + Packaged Rooftop Air Conditioner + + + Principal Lighting System Type + T8 + + + Quantity Of Dwellings Is Not Applicable + true + + + Section Notes For Not Applicable + + + + + + + + + 72 + 78 + + + + + + + Alternative Roof Surface Construction Method + false + + + Alternative Roof Surface Construction Method Is Not Applicable + true + + + Calculate Annual Energy Use Summary + true + + + Commercial Tenant Metering Configuration For Electricity Is Direct + metering + false + + + Commercial Tenant Metering Configuration For Electricity Is Direct + metering Is Not Applicable + true + + + Commercial Tenant Metering Configuration For Electricity Is Master + meter with sub metering + false + + + Commercial Tenant Metering Configuration For Electricity Is Master + meter with sub metering Is Not Applicable + true + + + Commercial Tenant Metering Configuration For Electricity Is Master + meter without sub metering + true + + + Commercial Tenant Metering Configuration For Electricity Is Master + meter without sub metering Is Not Applicable + false + + + Commercial Tenant Metering Configuration For Natural gas Is Direct + metering + false + + + Commercial Tenant Metering Configuration For Natural gas Is Direct + metering Is Not Applicable + true + + + Commercial Tenant Metering Configuration For Natural gas Is Master + meter with sub metering + false + + + Commercial Tenant Metering Configuration For Natural gas Is Master + meter with sub metering Is Not Applicable + true + + + Commercial Tenant Metering Configuration For Natural gas Is Master + meter without sub metering + true + + + Commercial Tenant Metering Configuration For Natural gas Is Master + meter without sub metering Is Not Applicable + false + + + Conditioned Floors Above Grade Is Not Applicable + false + + + Conditioned Floors Below Grade Is Not Applicable + false + + + Floor Area For Cooled only Is Not Applicable + false + + + Floor Area For Gross Is Not Applicable + false + + + Floor Area For Heated only Is Not Applicable + false + + + Floor Area For Heated and Cooled Is Not Applicable + false + + + Metering Year Start Dates + 2016-01-01 + + + Multi Tenant Is Not Applicable + false + + + Number Of Facilities On Site Is Not Applicable + false + + + Onsite Generation System + false + + + Onsite Generation System For Fuel cell Is Not Applicable + false + + + Onsite Generation System For Microturbine Is Not Applicable + false + + + Onsite Generation System For PV Is Not Applicable + false + + + Onsite Generation System For Reciprocating engine Is Not Applicable + false + + + Onsite Generation System For Turbine Is Not Applicable + false + + + Onsite Generation System For Wind Is Not Applicable + false + + + Onsite Generation System Is Not Applicable + false + + + Onsite Renewable Peak Generating Capacity Is Not Applicable + true + + + Onsite Renewable System + false + + + Onsite Renewable System For Solar Is Not Applicable + false + + + Onsite Renewable System Is Not Applicable + false + + + Other Energy Generation Technology + no backup system present + + + Other Energy Generation Technology Is Not Applicable + false + + + Percentage Onsite Generation Peak Generating Capacity Is Not + Applicable + false + + + Premises Identifier For Atlanta Building ID Is Not Applicable + true + + + Premises Identifier For City Custom Building ID Is Not Applicable + false + + + Premises Identifier For Portfolio Manager Building ID Is Not + Applicable + false + + + Premises Notes For Not Applicable + + + + Premises Notes For Shared Metering Not Applicable + + + + Premises Notes For Space functions For Not Applicable + + + + Premises Notes For Tenant Metering Configuration For Not Applicable + + + + Premises Notes Is Not Applicable + false + + + Residential Tenant Metering Configuration For Electricity Is Direct + metering + false + + + Residential Tenant Metering Configuration For Electricity Is Direct + metering Is Not Applicable + true + + + Residential Tenant Metering Configuration For Electricity Is Master + meter with sub metering + false + + + Residential Tenant Metering Configuration For Electricity Is Master + meter with sub metering Is Not Applicable + true + + + Residential Tenant Metering Configuration For Electricity Is Master + meter without sub metering + false + + + Residential Tenant Metering Configuration For Electricity Is Master + meter without sub metering Is Not Applicable + true + + + Residential Tenant Metering Configuration For Natural gas Is Direct + metering + false + + + Residential Tenant Metering Configuration For Natural gas Is Direct + metering Is Not Applicable + true + + + Residential Tenant Metering Configuration For Natural gas Is Master + meter with sub metering + false + + + Residential Tenant Metering Configuration For Natural gas Is Master + meter with sub metering Is Not Applicable + true + + + Residential Tenant Metering Configuration For Natural gas Is Master + meter without sub metering + false + + + Residential Tenant Metering Configuration For Natural gas Is Master + meter without sub metering Is Not Applicable + true + + + Retrocommissioning Date Is Not Applicable + true + + + Shared Chilled water + false + + + Shared Chilled water Is Not Applicable + false + + + Shared Fuel oil + false + + + Shared Fuel oil Is Not Applicable + false + + + Shared Heating + false + + + Shared Heating Is Not Applicable + false + + + Shared Meter For District steam + false + + + Shared Meter For District steam Is Not Applicable + false + + + Shared Meter For Electricity + false + + + Shared Meter For Electricity Is Not Applicable + false + + + Shared Meters For Multiple buildings on a single lot + false + + + Shared Meters For Multiple buildings on a single lot Is Not + Applicable + false + + + Shared Meters For Multiple buildings on multiple lots + false + + + Shared Meters For Multiple buildings on multiple lots Is Not + Applicable + false + + + Shared Meter For Natural gas + false + + + Shared Meter For Natural gas Is Not Applicable + false + + + Spaces Excluded From Gross Floor Area + none + + + Spaces Excluded From Gross Floor Area Is Not Applicable + false + + + Terrace R Value Is Not Applicable + true + + + Validate 100% Lighting Status + false + + + Validate 100% Lighting Status Is Not Applicable + true + + + Year Of Last Energy Audit Is Not Applicable + true + + + Year Of Last Major Remodel Is Not Applicable + true + + + + + + + + + + + Single zone + + + + + High Low + 1 + 1990 + Natural + + + Air + 66.0 + Thermal Efficiency + 100000.0 + kBtu/hr + Natural gas + Poor + + + + None + + + + Mechanical Room + 1990 + + + Annual Heating Efficiency Units Is Not Applicable + false + + + Annual Heating Efficiency Value Is Not Applicable + false + + + Burner Control Type Is Not Applicable + false + + + Burner Quantity Is Not Applicable + false + + + Burner Year Installed Is Not Applicable + false + + + Draft Type Is Not Applicable + false + + + Heat Pump Sink Source Type Is Not Applicable + true + + + Heating Source Condition Is Not Applicable + false + + + Heating Source Notes + + + + Heating Source Notes Is Not Applicable + true + + + Location Is Not Applicable + false + + + Output Capacity Is Not Applicable + false + + + Primary Fuel Is Not Applicable + false + + + Quantity Is Not Applicable + false + + + Source Heating Plant ID Is Not Applicable + true + + + Year Installed Is Not Applicable + false + + + 1 + + + + + + + Packaged terminal air conditioner (PTAC) + + + 3.200000047683716 + COP + 200000.0 + kBtu/hr + Electricity + Average + + + + None + + + + Mechanical Room + 2000 + + + Annual Cooling Efficiency Units Is Not Applicable + false + + + Annual Cooling Efficiency Value Is Not Applicable + false + + + Capacity Is Not Applicable + false + + + Cooling Plant ID Is Not Applicable + true + + + Cooling Source Condition Is Not Applicable + false + + + Cooling Source Notes + + + + Cooling Source Notes Is Not Applicable + true + + + Location Is Not Applicable + false + + + Primary Fuel Is Not Applicable + false + + + Quantity Is Not Applicable + false + + + Year Installed Is Not Applicable + false + + + 4 + + + + + + + Central fan + + + + + + + + + false + false + + + + + + + + + + + + false + + + + + + + + + + + + + + + + + Common + 0 + + + Tenant + 100 + + + + + + + + Demand Control Ventilation Is Not Applicable + true + + + Exhaust Ventilation For Corridor + false + + + Exhaust Ventilation For Corridor Is Not Applicable + true + + + Exhaust Ventilation For Kitchen + false + + + Exhaust Ventilation For Kitchen Is Not Applicable + true + + + Exhaust Ventilation For Other + false + + + Exhaust Ventilation For Other Is Not Applicable + true + + + Exhaust Ventilation For Parking + false + + + Exhaust Ventilation For Parking Is Not Applicable + true + + + Exhaust Ventilation For Restroom + false + + + Exhaust Ventilation For Restroom Is Not Applicable + true + + + Minimum Air Flow Fraction Is Not Applicable + true + + + Other Central Distribution Type + + + + Other Central Distribution Type Is Not Applicable + true + + + Other Distribution Equipment Type + + + + Other Distribution Equipment Type Is Not Applicable + true + + + Outdoor Air Type Is Not Applicable + true + + + Packaged Terminal Equipment Type Is Not Applicable + false + + + Static Pressure Reset Control Is Not Applicable + true + + + Supply Air Temperature Reset Control Is Not Applicable + true + + + Supply Ventilation For Common area + false + + + Supply Ventilation For Common area Is Not Applicable + true + + + Supply Ventilation For Corridor + false + + + Supply Ventilation For Corridor Is Not Applicable + true + + + Supply Ventilation For Other + false + + + Supply Ventilation For Other Is Not Applicable + true + + + Supply Ventilation For Tenant Spaces + false + + + Supply Ventilation For Tenant Spaces Is Not Applicable + true + + + Terminal Unit Is Not Applicable + true + + + Ventilation System > 5 hp + false + + + Ventilation Type Is Not Applicable + true + + + + + + + + + T8 + Unknown + + + Standard Electronic + false + + + + Manual On/Off + + + + + + + + + + + + Common + 0.0 + + + Tenant + 100.0 + + + + + + + + Lighting System Name + Fixture 1 + + + LED Application Type Is Not Applicable + true + + + Lighting Power Density For Section-44987460 + + + + Common Areas Lighting Power Density For Section-44987460 + + + + Tenant Areas Lighting Power Density For Section-44987460 + + + + Quantity Of Luminaires For Section-44987460 + + + + Common Areas Quantity Of Luminaires For Section-44987460 + 0 + + + Tenant Areas Quantity Of Luminaires For Section-44987460 + 2000 + + + + + + + + + + + + + + 20.0 + 2.0 + + + AFUE + 75.0 + + + + Chronological + + + + 1995 + Fuel oil no 1 + Mechanical Floor + + + + + + + + + Common + 0 + + + Tenant + 100 + + + + + + + + Draft Type Is Not Applicable + true + + + Heating Plant ID Is Not Applicable + true + + + Hot Water Distribution Type Is Not Applicable + true + + + Hot Water Setpoint Temperature Is Not Applicable + false + + + Location Is Not Applicable + false + + + Model Number Is Not Applicable + false + + + Primary Fuel Is Not Applicable + false + + + Storage Tank Insulation R Value Is Not Applicable + false + + + Storage Tank Insulation Thickness Is Not Applicable + false + + + Tank Volume Is Not Applicable + true + + + Water Heater Efficiency Is Not Applicable + false + + + Water Heater Efficiency Type Is Not Applicable + false + + + Year Installed Is Not Applicable + false + + + + + + + 65.0 + Constant Volume + + + + + + + + 76.0 + + + + + + + + Wood frame + Other + + + 15.0 + + + + + + + Built up + false + false + false + + + 10.0 + + + Wood + Flat + + + Blue Roof Is Not Applicable + false + + + Cool Roof Is Not Applicable + false + + + Green Roof Is Not Applicable + false + + + Year Installed Is Not Applicable + false + + + + + + + + + Solid wood + + + + + Other Exterior Door Type + + + + + + + + + Vinyl + false + Leaky + Clear uncoated + Single pane + 0.7 + 0.6 + 0.8 + + + Year Installed Is Not Applicable + false + + + + + + + + + + 4.0 + 25.0 + + + + + + Other Foundation Type + + + + Slab Insulation Thickness Is Not Applicable + false + + + + + + + Foundation Wall R Value Is Not Applicable + false + + + Linked Wall ID + WallSystemType-44988020 + + + + + + + Server + 1.2000000476837158 + + + + + + + + Occupancy Classification + Data center + + + Gross Floor Area + 1000.0 + + + Gross Floor Area Is Not Applicable + false + + + IT Peak Power Is Not Applicable + false + + + Metering + false + + + Metering Is Not Applicable + false + + + Power Usage Effectiveness + 5.0 + + + Power Usage Effectiveness Is Not Applicable + false + + + + + Other + + + + + + + + Occupancy Classification + Trading floor + + + Gross Floor Area Is Not Applicable + true + + + IT Peak Power Is Not Applicable + true + + + + + Other + + + + + + + + Occupancy Classification + TV studio + + + Gross Floor Area Is Not Applicable + true + + + IT Peak Power Is Not Applicable + true + + + + + UPS + 2.299999952316284 + + + + + + + + Occupancy Classification + Data center + + + IT Peak Power Is Not Applicable + false + + + + + + + Broadcast Antenna + 1.399999976158142 + + + + + + + + Plug Load Peak Power Is Not Applicable + false + + + + + Kitchen Equipment + + + + + + + + Gross Floor Area Is Not Applicable + true + + + Plug Load Peak Power Is Not Applicable + true + + + + + Other + + + + + + + + Plug Load Peak Power Is Not Applicable + true + + + Plug Load Total Power Is Not Applicable + true + + + + + Signage Display + + + + + + + + Plug Load Peak Power Is Not Applicable + true + + + + + + + Miscellaneous Gas Load + 0.28 + + + + + + + + + + Elevator + 2 + 1960 + + + + + + + + + + + Elevator Type + Traction + + + + + + + + + + + Other + + + + + true + false + kBtu/hr + + + + + + + + Capacity Is Not Applicable + true + + + Demand Reduction Is Not Applicable + true + + + Output Resource Type Is Not Applicable + true + + + Other Energy Generation Technology Is Not Applicable + false + + + Year Installed Is Not Applicable + true + + + + + false + false + kBtu/hr + + + + + + + + Average Annual Operating Hours Is Not Applicable + false + + + Capacity Is Not Applicable + true + + + Demand Reduction Is Not Applicable + true + + + Output Resource Type Is Not Applicable + true + + + Year Installed Is Not Applicable + true + + + + + + + Very Leaky + + + + + + + + + + + + + Weekday + 06:00:00 + 18:00:00 + + + + + + + Roof + + + + + + + + + Increase roof insulation + + + + Entire building + Measure Identifier 150799 + add insulation + + + + + 300.0 + 1000.0 + + 10 + 4800.0 + true + + + Reduces Scope 1 Emissions + false + + + Shared Resource Affected + false + + + Is 179D + false + + + Rebate Available + false + + + Equipment Is Not Applicable + false + + + + + Roof + + + + + + + + + Clean and/or repair + + + + Entire building + Measure Identifier 150800 + fix leaks + + + + + 150.0 + 0.0 + + 10 + 1200.0 + true + + + Reduces Scope 1 Emissions + false + + + Shared Resource Affected + false + + + Is 179D + false + + + Rebate Available + false + + + Equipment Is Not Applicable + false + + + + + + + + + Audit Template Available Energy + Current + + + + + + Electricity + Site + kWh + All end uses + + + Diesel + Site + Gallons + All end uses + + + Fuel oil no 1 + Site + Gallons + All end uses + + + + + + + + + + Other Scenario Type + Audit Template Available Energy + + + + + + + + + + + + Contributor Contact ID + ContactType-44988100 + + + Contributor Contact Role + Contributor + + + + + + + benchmark + + Current + + + + + + 2015 + 80.0 + + + + + All end uses + Site + 75.0 + 60.0 + + + Weather Normalized Pre-retrofit Site Energy Use Intensity Is + Not Applicable + false + + + Weather Normalized Post-retrofit Site Energy Use Intensity Is + Not Applicable + false + + + Site Energy Use Intensity Is Not Applicable + false + + + + + + + + + + + + Benchmark Value Is Not Applicable + false + + + Benchmark Year Is Not Applicable + false + + + Scenario Notes For Not Applicable + + + + + + current_building + Current + + + + + + Unknown + + + Net + CO2e + 100000.0 + + + + + GHG Emissions Is Not Applicable + false + + + + + + + All end uses + Site + 20000.0 + + + + + + + + + + current_building_with_normalization + Current + Weather normalized + + + + + + All end uses + Source + 65.0 + + + Source Energy Use Intensity Is Not Applicable + false + + + + + + + + + + + + target + Target + + + + + + All end uses + Site + 72.0 + 58.0 + + + + + + + + + + Audit Template Energy Deliveries - Fuel oil no 1 + Current + + + + + + Fuel oil no 1 + Site + Gallons + Not shared + + + + + Point + Energy + 2016-10-01T00:00:00+00:00 + 2016-10-02T00:00:00+00:00 + Day + 120.0 + + + + + + All end uses + Site + 3000.0 + 1.22598 + + + Linked Time Series ID + TimeSeriesType-44988480 + + + + + + + + + + + + Other Scenario Type + Audit Template Energy Deliveries + + + + + Audit Template Energy Meter Readings - Electricity + Current + + + + + + Electricity + Site + kWh + Not shared + + + + + Peak + Voltage + 2016-01-01T00:00:00+00:00 + 2016-02-01T00:00:00+00:00 + Other + 100.0 + + + + Peak + Voltage + 2016-02-01T00:00:00+00:00 + 2016-03-01T00:00:00+00:00 + Other + 70.0 + + + + Peak + Voltage + 2016-03-01T00:00:00+00:00 + 2016-04-01T00:00:00+00:00 + Other + 100.0 + + + + Peak + Voltage + 2016-04-01T00:00:00+00:00 + 2016-05-01T00:00:00+00:00 + Other + 70.0 + + + + Peak + Voltage + 2016-05-01T00:00:00+00:00 + 2016-06-01T00:00:00+00:00 + Other + 100.0 + + + + Peak + Voltage + 2016-06-01T00:00:00+00:00 + 2016-07-01T00:00:00+00:00 + Other + 70.0 + + + + Peak + Voltage + 2016-07-01T00:00:00+00:00 + 2016-08-01T00:00:00+00:00 + Other + 100.0 + + + + Peak + Voltage + 2016-08-01T00:00:00+00:00 + 2016-09-01T00:00:00+00:00 + Other + 70.0 + + + + Peak + Voltage + 2016-09-01T00:00:00+00:00 + 2016-10-01T00:00:00+00:00 + Other + 100.0 + + + + Peak + Voltage + 2016-10-01T00:00:00+00:00 + 2016-11-01T00:00:00+00:00 + Other + 70.0 + + + + Peak + Voltage + 2016-11-01T00:00:00+00:00 + 2016-12-01T00:00:00+00:00 + Other + 100.0 + + + + Peak + Voltage + 2016-12-01T00:00:00+00:00 + 2017-01-01T00:00:00+00:00 + Other + 70.0 + + + + + + All end uses + Site + 366.35406494140625 + 1000.0 + 0.14722311438337757 + + + Linked Time Series ID + TimeSeriesType-44988580 + + + + + All end uses + Site + 381.0082092285156 + 800.0 + 0.15311203160043282 + + + Linked Time Series ID + TimeSeriesType-44988620 + + + + + All end uses + Site + 322.3915710449219 + 1000.0 + 0.12955633820461232 + + + Linked Time Series ID + TimeSeriesType-44988660 + + + + + All end uses + Site + 263.77490234375 + 800.0 + 0.10600063254499205 + + + Linked Time Series ID + TimeSeriesType-44988700 + + + + + All end uses + Site + 249.12075805664062 + 1000.0 + 0.1001117153279368 + + + Linked Time Series ID + TimeSeriesType-44988740 + + + + + All end uses + Site + 205.15826416015625 + 800.0 + 0.08244493914917154 + + + Linked Time Series ID + TimeSeriesType-44988780 + + + + + All end uses + Site + 212.4853515625 + 1000.0 + 0.08538940388959905 + + + Linked Time Series ID + TimeSeriesType-44988820 + + + + + All end uses + Site + 225.67410278320312 + 800.0 + 0.0906894379696086 + + + Linked Time Series ID + TimeSeriesType-44988860 + + + + + All end uses + Site + 175.84994506835938 + 1000.0 + 0.07066709245126128 + + + Linked Time Series ID + TimeSeriesType-44988900 + + + + + All end uses + Site + 199.29660034179688 + 800.0 + 0.08008936980958949 + + + Linked Time Series ID + TimeSeriesType-44988940 + + + + + All end uses + Site + 271.10198974609375 + 1000.0 + 0.10894509728541955 + + + Linked Time Series ID + TimeSeriesType-44988980 + + + + + All end uses + Site + 293.083251953125 + 800.0 + 0.11777849150670207 + + + Linked Time Series ID + TimeSeriesType-44989020 + + + + + + + + + + + + Other Scenario Type + Audit Template Energy Meter Readings + + + + + Audit Template Energy Supply Sources + Current + + + + + + Electricity + Site + kWh + Not shared + + + + + + + + + + + + + Other Scenario Type + Audit Template Energy Supply Sources + + + + + Audit Template Energy Uses + Current + + + + + + Electricity + Site + kWh + Not shared + Cooling + 2000.0 + + + Net + CO2e + 0.8037203813033934 + + + + + Fuel oil no 1 + Site + Gallons + Not shared + Domestic hot water + 100.0 + + + Net + CO2e + 1.02165 + + + + + Electricity + Site + kWh + Not shared + All end uses + 2000.0 + + + Net + CO2e + 0.8037203813033934 + + + + + Fuel oil no 1 + Site + Gallons + Not shared + All end uses + 100.0 + + + Net + CO2e + 1.02165 + + + + + + + + + + + + Other Scenario Type + Audit Template Energy Uses + + + + + Roof repair and insulation + Current + + + + + + + 1000 + + + Electricity + kWh + 2000.0 + + + Natural gas + therms + + + District chilled water + Ton-hour + + + District hot water + therms + + + District steam + Mlbs + + + Fuel oil no 1 + Gallons + 30.0 + + + Fuel oil no 2 + Gallons + + + Fuel oil + Gallons + + + Fuel oil no 4 + Gallons + + + Fuel oil no 5 (light) + Gallons + + + Fuel oil no 5 (heavy) + Gallons + + + Fuel oil no 6 + Gallons + + + Diesel + Gallons + 20.0 + + + Gasoline + Gallons + + + Kerosene + Gallons + + + Liquid propane + Gallons + + + Propane + kcf + + + Dual fuel + kBtu + + + Other + kBtu + + + Thermal-Onsite generated + kBtu + + + Electricity-Onsite generated + kWh + + + Thermal-Exported + kBtu + + + Electricity-Exported + kWh + + + Other delivered-Onsite generated + kBtu + + + Other delivered-Exported + kBtu + + + Other metered-Exported + kBtu + + + Other metered-Onsite generated + kBtu + + + Biofuel B5 + Gallons + + + Biofuel B10 + Gallons + + + Biofuel B20 + Gallons + + + 1500.0 + + + USGBC Package Category + Alternative + + + + + + + + + + + + Recommended Resource Savings Category + Low Cost and No Cost Recommendations + + + + + + + 2016-07-01 + Custom + Level 1: Walk-through + + + 2017-07-01 + Custom + Level 2: Energy Survey and Analysis + + + Initial filing + false + + + Association of Energy Engineers Certified Energy Manager (CEM) + 12345 + NY + 2030-10-01 + + + + 12345 + NY + 2030-10-01 + + Building Performance Institute (BPI) Certification + + + 123456 + NY + 2030-10-01 + + Professional Engineer (PE) + + + + + + + monthly + + + Master meter without sub metering + 1234 + + + + + + + + + + + 50121 Program Pathway + Modeled Energy Savings + + + Audit Date For Level 1: Walk-through Is Not Applicable + false + + + Audit Date For Level 2: Energy Survey and Analysis Is Not Applicable + false + + + Audit Date For Level 3: Detailed Survey and Analysis Is Not Applicable + true + + + Audit Date For Final Installation Placed in Service Is Not Applicable + false + + + Audit Date For Completion of Pre-retrofit Audit Is Not Applicable + false + + + Audit Date For Completion of Post-retrofit Audit Is Not Applicable + false + + + Audit Date For Building Originally Placed in Service Is Not Applicable + false + + + Audit Date For Qualified Retrofit Plan Established Is Not Applicable + false + + + Audit Date For Qualified Retrofit Property Placed in Service Is Not + Applicable + false + + + Audit Filing Status Is Not Applicable + true + + + Audit Notes + + + + Audit Notes For Not Applicable + + + + Audit Notes Is Not Applicable + false + + + Audit Team Notes + + + + Audit Team Notes Is Not Applicable + false + + + Audit Template Report Type + New York City Energy Efficiency Report + + + Auditor Years Of Experience + 5 + + + Early Compliance + false + + + Early Compliance Is Not Applicable + true + + + GGRF Grantee - Appalachian Community Capital Corporation (ACC) + false + + + GGRF Grantee - Climate United Fund (CUF) + false + + + GGRF Grantee - Coalition for Green Capital (CGC) + false + + + GGRF Grantee - Inclusiv (INC) + false + + + GGRF Grantee - Justice Climate Fund (JCF) + false + + + GGRF Grantee - Native CDFI Network (NCN) + false + + + GGRF Grantee - Opportunity Finance Network (OFN) + false + + + GGRF Grantee - Power Forward Communities (PFC) + false + + + Required Audit Year Is Not Applicable + true + + + + + + + + Contributor + + A. Example Submitter + Submitter Company Example + + + + 123 Example Street + + + New York + NY + 10118 + + + + 111-111-1111 + + + + + a.example.submitter@aol.com + + + + + City Is Not Applicable + false + + + Contact Company Is Not Applicable + false + + + Contact Email Address Is Not Applicable + false + + + Contact Name Is Not Applicable + false + + + Contact Telephone Number Is Not Applicable + false + + + Postal Code Is Not Applicable + false + + + State Is Not Applicable + false + + + Street Address Is Not Applicable + false + + + Title Is Not Applicable + false + + + Contact Role For ReportType-44988080 + Contributor + + + + + + Energy Auditor + + A. Example Auditor + Auditor Company Example + + + + 123 Example Street + + + New York + NY + 10118 + + + + 111-111-1111 + + + + + a.example.auditor@aol.com + + + + + City Is Not Applicable + false + + + Contact Company Is Not Applicable + false + + + Contact Email Address Is Not Applicable + false + + + Contact Name Is Not Applicable + false + + + Contact Telephone Number Is Not Applicable + false + + + Postal Code Is Not Applicable + false + + + State Is Not Applicable + false + + + Street Address Is Not Applicable + false + + + Title Is Not Applicable + false + + + Contact Role For ReportType-44988080 + Energy Auditor + + + Contact Role For Qualification-44988140 + Energy Auditor + + + Contributor Contact ID For Qualification-44988140 + ContactType-44988120 + + + Contributor Contact Role For Qualification-44988140 + Energy Auditor + + + Other Qualification Type For Qualification-44988140 + + + + + + + Operator + Owner + + A. Example Building Operator + Building Operator Company Example + + + + 123 Example Street + + + New York + NY + 10118 + + + + 111-111-1111 + + + + + a.example.operator@aol.com + + + + + City Is Not Applicable + false + + + Contact Company Is Not Applicable + false + + + Contact Email Address Is Not Applicable + false + + + Contact Name Is Not Applicable + false + + + Contact Telephone Number Is Not Applicable + false + + + Postal Code Is Not Applicable + false + + + State Is Not Applicable + false + + + Street Address Is Not Applicable + false + + + Title Is Not Applicable + false + + + Contact Role For ReportType-44988080 + Operator + + + Contact Role For Qualification-44988180 + Operator + + + Contributor Contact ID For Qualification-44988180 + ContactType-44988160 + + + Contributor Contact Role For Qualification-44988180 + Operator + + + Other Qualification Type For Qualification-44988180 + + + + Contact Role For ReportType-44988080 + Owner + + + + + + Qualified Assessor + + A. Example Licensed Pro + Licensed Pro Company Example + + + + 123 Example Street + + + New York + NY + 10118 + + + + 111-111-1111 + + + + + a.example.pro@aol.com + + + + + City Is Not Applicable + false + + + Contact Company Is Not Applicable + false + + + Contact Email Address Is Not Applicable + false + + + Contact Name Is Not Applicable + false + + + Contact Telephone Number Is Not Applicable + false + + + Postal Code Is Not Applicable + false + + + State Is Not Applicable + false + + + Street Address Is Not Applicable + false + + + Title Is Not Applicable + false + + + Contact Role For ReportType-44988080 + Qualified Assessor + + + Contact Role For Qualification-44988220 + Qualified Assessor + + + Contributor Contact ID For Qualification-44988220 + ContactType-44988200 + + + Contributor Contact Role For Qualification-44988220 + Qualified Assessor + + + Other Qualification Type For Qualification-44988220 + + + + + + + Property Management Company + + A. Example Property Manager + Property Manager Company Example + + + + 123 Example Street + + + New York + NY + 10118 + + + + 111-111-1111 + + + + + a.example.manager@aol.com + + + + + City Is Not Applicable + false + + + Contact Company Is Not Applicable + false + + + Contact Email Address Is Not Applicable + false + + + Contact Name Is Not Applicable + false + + + Contact Telephone Number Is Not Applicable + false + + + Postal Code Is Not Applicable + false + + + State Is Not Applicable + false + + + Street Address Is Not Applicable + false + + + Title Is Not Applicable + false + + + Contact Role For ReportType-44988080 + Property Management Company + + + + + + + \ No newline at end of file diff --git a/spec/tests/unit/boss_spec.rb b/spec/tests/unit/boss_spec.rb index 0a55741..cf97d40 100644 --- a/spec/tests/unit/boss_spec.rb +++ b/spec/tests/unit/boss_spec.rb @@ -129,7 +129,7 @@ def common_steps(climate_zone) expect(osw_path).to eq File.join(output_dir, 'baseline', 'in.osw') expect(Dir.children(output_dir)).to eq ['baseline'] - expect(Dir.children(File.join(output_dir, 'baseline'))).to eq ['in.osw'] + expect(Dir.children(File.join(output_dir, 'baseline')).sort).to eq ['hvac_mapping_report.json', 'in.osw'] osw = JSON.parse(File.read(osw_path), symbolize_names: true) expect(osw[:steps]).to eq send(expected_steps) @@ -175,7 +175,10 @@ def common_steps(climate_zone) it 'is private while the public API stays public' do expect(described_class.private_methods).to include(:build_baseline_osw) expect(described_class.public_methods).to include(:write_baseline_osw, :run_baseline_osw) - expect(described_class.method(:write_baseline_osw).arity).to eq 4 + expect(described_class.method(:write_baseline_osw).parameters).to eq [ + [:req, :xml_file_path], [:req, :output_dir], [:req, :epw_file_path], [:req, :standard_to_be_used], + [:key, :require_l200] + ] expect(described_class.method(:run_baseline_osw).arity).to eq 1 end diff --git a/spec/tests/unit/heating_with_terminal_cooling_spec.rb b/spec/tests/unit/heating_with_terminal_cooling_spec.rb new file mode 100644 index 0000000..e705ca5 --- /dev/null +++ b/spec/tests/unit/heating_with_terminal_cooling_spec.rb @@ -0,0 +1,91 @@ +# frozen_string_literal: true + +# ******************************************************************************* +# OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC. +# BuildingSync(R), Copyright (c) Alliance for Energy Innovation, LLC. +# See also https://github.com/BuildingSync/BOSS/blob/develop/LICENSE.md +# ******************************************************************************* + +require 'json' +require 'tmpdir' +require 'rexml/document' +require 'BOSS/boss' +require 'BOSS/constants' + +RSpec.describe 'Central furnace with cooling-only PTAC' do + files_dir = File.expand_path('../../files/v2.7.0', __dir__) + l200_path = File.join(files_dir, 'Example_NYC_Energy_Efficiency_Report_Property_2_l200.xml') + original_path = File.join(files_dir, 'Example_NYC_Energy_Efficiency_Report_Property_2.xml') + + def hvac_systems(path) + doc = REXML::Document.new(File.read(path), ignore_whitespace_nodes: :all) + REXML::XPath.first(doc, "//*[local-name()='HVACSystems']") + end + + def select(systems) = BOSS::HvacTopologySelector.new.select(systems) + + def element(systems, id) = REXML::XPath.first(systems, ".//*[@ID='#{id}']") + + it 'selects one result from standard elements' do + results = select(hvac_systems(l200_path)) + expect(results.length).to eq 1 + result = results.first + expect(result.status).to eq :match + expect(result.measure).to eq 'hvac_heating_with_terminal_cooling' + expect(result.measure_arguments).to eq('heating_source' => 'central_gas_furnace') + expect(result.record_ids).to include('Delivery-44989380', 'Delivery-44989400', 'HeatingSource-44989520', + 'CoolingSource-44989500', 'OtherHVACSystemType-44989440') + expect(result.messages.join(' ')).to include('CoolingSource-44989500 quantity 4') + end + + it 'does not match the original XML, whose sources are shared and DX type is unstated' do + expect(select(hvac_systems(original_path)).map(&:status)).not_to include(:match) + end + + it 'does not match when the cooling source is not a PTAC' do + systems = hvac_systems(l200_path) + element(systems, 'CoolingSource-44989500').elements['.//*[local-name()="DXSystemType"]'].text = 'Split DX air conditioner' + expect(select(systems).map(&:configuration)).not_to include('Central furnace with cooling-only PTAC') + end + + it 'does not match when the heating delivery also references the cooling source' do + systems = hvac_systems(l200_path) + delivery = element(systems, 'Delivery-44989380') + ref = REXML::Element.new('auc:CoolingSourceID') + ref.add_attribute('IDref', 'CoolingSource-44989500') + delivery.add_element(ref) + expect(select(systems).map(&:status)).not_to include(:match) + end + + it 'fails a guard on a local-fan heating delivery' do + systems = hvac_systems(l200_path) + element(systems, 'Delivery-44989380').elements['.//*[local-name()="AirDeliveryType"]'].text = 'Local fan' + result = select(systems).first + expect(result.status).to eq :conflicting_input + expect(result.messages).to include('Guard failed: A/AirDeliveryType') + end + + describe 'BOSS::Boss.write_baseline_osw' do + it 'writes the topology steps and a mapping report' do + Dir.mktmpdir do |dir| + osw_path = BOSS::Boss.write_baseline_osw(l200_path, dir, nil, ASHRAE90_1, require_l200: true) + osw = JSON.parse(File.read(osw_path)) + step = osw['steps'].find { |s| s['measure_dir_name'] == 'apply_hvac_topology_to_zone_scope' } + expect(JSON.parse(step['arguments']['topology_arguments_json'])).to eq('heating_source' => 'central_gas_furnace') + typical = osw['steps'].find { |s| s['measure_dir_name'] == 'create_typical_building_from_model' } + expect(typical['arguments']['add_hvac']).to be false + report = JSON.parse(File.read(File.join(dir, 'baseline', 'hvac_mapping_report.json'))) + expect(report['status']).to eq 'topology' + expect(report['hvac_steps']).to eq ['apply_hvac_topology_to_zone_scope', 'apply_standard_hvac_sizing_and_efficiency'] + end + end + + it 'raises in strict mode for the original XML' do + Dir.mktmpdir do |dir| + expect { BOSS::Boss.write_baseline_osw(original_path, dir, nil, ASHRAE90_1, require_l200: true) } + .to raise_error(RuntimeError, /L200 HVAC topology required/) + expect(Dir.children(dir)).to be_empty + end + end + end +end From 054b154b873c079bc2b9f23e2526dbccbdb08c18 Mon Sep 17 00:00:00 2001 From: JieXiong9119 <69597597+JieXiong9119@users.noreply.github.com> Date: Wed, 25 Nov 2026 01:07:54 -0700 Subject: [PATCH 2/3] add ptac + boiler/baseboards mapping --- README.md | 2 + lib/BOSS/hvac_topology_selector.rb | 93 ++++++++++++++----- .../heating_with_terminal_cooling_spec.rb | 68 ++++++++++++++ 3 files changed, 142 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index fafe1cb..621d069 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,8 @@ An HVACSystem whose heating and cooling are delivered separately maps to the gem - one Delivery with `ZoneEquipment` that references only a CoolingSource whose `DXSystemType` is `Packaged terminal air conditioner (PTAC)`; - both serve the same premises. A `MechanicalVentilation` record without a `VentilationType` linked only to these deliveries is treated as an annotation. +The heating-only Delivery may instead be `ZoneEquipment/Convection` with `ConvectionType` `Perimeter baseboard`, heated by `ElectricResistance` (`electric_baseboard`) or by a `SourceHeatingPlantID` whose plant has `Boiler/BoilerType` `Hot water` (`hot_water_baseboard`, `boiler_fuel` from the plant `PrimaryFuel`). A single `ZoneEquipment` Delivery that references both the PTAC CoolingSource and such a hot-water HeatingSource maps to `hot_water_ptac_coil`. + See `Example_NYC_Energy_Efficiency_Report_Property_2_l200.xml`, which restates the user-defined fields of `Example_NYC_Energy_Efficiency_Report_Property_2.xml` as standard elements. BOSS writes `baseline/hvac_mapping_report.json` with the plan status, the HVAC steps, and the messages. Add `--require_l200` (`require_l200: true`) to raise an error instead of falling back. ```bash diff --git a/lib/BOSS/hvac_topology_selector.rb b/lib/BOSS/hvac_topology_selector.rb index 9a8d511..8727a12 100644 --- a/lib/BOSS/hvac_topology_selector.rb +++ b/lib/BOSS/hvac_topology_selector.rb @@ -169,6 +169,18 @@ def fan_based_distribution(el) nodes(el, 'FanBased/FanBasedDistributionType').any? { |n| !n.elements.to_a.empty? } end + # @return [String, nil] boiler_fuel argument when the source is fed by a hot-water boiler plant + def hot_water_boiler_fuel + return nil if hp.nil? || !eq(hp, 'Boiler/BoilerType', 'Hot water') || !guard(hs, 'HeatingMedium', 'Hot water') + + fuels = self.class.texts(hp, 'PrimaryFuel') + fuels.length == 1 ? BOILER_FUELS[fuels.first] : nil + end + + def ptac_cooling + eq(dx, 'DXSystemType', 'Packaged terminal air conditioner (PTAC)') && packaged_air_cooled_dx + end + def gas_air_furnace exists(h, 'Furnace') && eq(hs, 'PrimaryFuel', 'Natural gas') && eq(hs, 'HeatingMedium', 'Air') end @@ -190,6 +202,9 @@ def conditioned end ELECTRIC = 'Electricity' + # BuildingSync PrimaryFuel => hvac_heating_with_terminal_cooling boiler_fuel + BOILER_FUELS = { 'Natural gas' => 'NaturalGas', 'Electricity' => 'Electricity', + 'Fuel oil no 2' => 'FuelOilNo2', 'Propane' => 'Propane' }.freeze AIR_REFRIGERANT = ['Air', 'Refrigerant'].freeze FURNACE_TYPES = ['Warm air', 'Other'].freeze # HeatPumpBackupSystemFuel => hvac_packaged_rooftop_heat_pump supplemental_heating_fuel @@ -214,6 +229,20 @@ def conditioned ] } }, + { + configuration: 'PTAC with hot water coil', measure: 'hvac_heating_with_terminal_cooling', status: :match, + group: :delivery, + required: ->(x) { x.zone_equipment_only && x.ptac_cooling && !x.hot_water_boiler_fuel.nil? }, + arguments: ->(x) { { 'heating_source' => 'hot_water_ptac_coil', 'boiler_fuel' => x.hot_water_boiler_fuel } }, + absent: ->(x) { x.fan_based_distribution(x.z) ? ['Z/FanBased/FanBasedDistributionType'] : [] }, + guards: lambda { |x| + [ + ['CS/PrimaryFuel', x.guard(x.cs, 'PrimaryFuel', ELECTRIC)], + ['CS/CoolingMedium', x.guard(x.cs, 'CoolingMedium', AIR_REFRIGERANT)], + ['plant quantities', x.plant_quantities_one(x.hp)] + ] + } + }, { configuration: 'Four Pipe Fan Coil Unit', measure: 'hvac_four_pipe_fan_coil', status: :match, group: :plants, required: lambda { |x| @@ -483,8 +512,12 @@ def self.central_air_absent(x) failed end - TERMINAL_COOLING_CONFIGURATION = 'Central furnace with cooling-only PTAC' TERMINAL_COOLING_MEASURE = 'hvac_heating_with_terminal_cooling' + TERMINAL_COOLING_CONFIGURATIONS = { + 'central_gas_furnace' => 'Central furnace with cooling-only PTAC', + 'hot_water_baseboard' => 'Hot water baseboard with cooling-only PTAC', + 'electric_baseboard' => 'Electric baseboard with cooling-only PTAC' + }.freeze # @param hvac_systems [REXML::Element] an HVACSystems element (or any parent of HVACSystem elements) # @return [Array] @@ -540,53 +573,71 @@ def _select_system(sys) [pair].compact + results + others.map { |other| _select_other(sys, other, index, ventilation_links, folded) } end - # A heating-only central-air delivery from a gas furnace plus a cooling-only zone-equipment - # delivery from PTACs, in the same HVACSystem and premises, is one central-heating, - # terminal-cooling configuration. + # The heating_with_terminal_cooling variant of a heating-only delivery, or nil. + def _separate_heating_variant(x) + return nil if x.hs.nil? || !x.ref_ids(x.d, 'CoolingSourceID').empty? + return 'central_gas_furnace' if !x.a.nil? && x.gas_air_furnace + return nil unless x.eq(x.z, 'Convection/ConvectionType', 'Perimeter baseboard') + return 'electric_baseboard' if x.exists(x.h, 'ElectricResistance') + + 'hot_water_baseboard' unless x.hot_water_boiler_fuel.nil? + end + + # A heating-only delivery (central gas furnace, or hot-water or electric perimeter baseboard) + # plus a cooling-only zone-equipment delivery from PTACs, in the same HVACSystem and premises, + # is one heating_with_terminal_cooling configuration. # @return [Array(Result, Array), nil] the result and the delivery IDs it covers def _heating_with_terminal_cooling(sys, deliveries, index) contexts = deliveries.map { |d| Context.new(sys, d, index) } return nil unless contexts.all? { |x| x.conflicts.empty? } - heating = contexts.select do |x| - !x.hs.nil? && x.ref_ids(x.d, 'CoolingSourceID').empty? && !x.a.nil? && x.gas_air_furnace - end + heating = contexts.filter_map { |x| (variant = _separate_heating_variant(x)) && [x, variant] } cooling = contexts.select do |x| - !x.cs.nil? && x.ref_ids(x.d, 'HeatingSourceID').empty? && x.zone_equipment_only && - x.eq(x.dx, 'DXSystemType', 'Packaged terminal air conditioner (PTAC)') && x.packaged_air_cooled_dx + !x.cs.nil? && x.ref_ids(x.d, 'HeatingSourceID').empty? && x.zone_equipment_only && x.ptac_cooling end return nil unless heating.length == 1 && cooling.length == 1 - hx = heating.first + hx, variant = heating.first cx = cooling.first + configuration = TERMINAL_COOLING_CONFIGURATIONS[variant] delivery_ids = [hx.d, cx.d].map { |el| el.attributes['ID'] } - ids = delivery_ids + [hx.hs, cx.cs].map { |el| el.attributes['ID'] } + ids = delivery_ids + [hx.hs, cx.cs, hx.hp].compact.map { |el| el.attributes['ID'] } premises = _premises(hx.d, sys) order = ->(list) { list.sort_by { |p| [p[:type], p[:id]] } } failures = [] failures << 'Missing LinkedPremises on Delivery or HVACSystem' if premises.empty? failures << 'Heating and cooling deliveries must serve the same premises' if order.call(premises) != order.call(_premises(cx.d, sys)) - failures += self.class.central_air_absent(hx).map { |p| "#{p} must be absent" } failures << 'Z/FanBased/FanBasedDistributionType must be absent' if cx.fan_based_distribution(cx.z) - [ - ['A/AirDeliveryType', hx.guard(hx.a, 'AirDeliveryType', 'Central fan')], - ['A/ReheatSource', hx.guard(hx.a, 'ReheatSource', 'None')], - ['H/Furnace/FurnaceType', hx.guard(hx.h, 'Furnace/FurnaceType', FURNACE_TYPES)], + guards = [ ['CS/PrimaryFuel', cx.guard(cx.cs, 'PrimaryFuel', ELECTRIC)], ['CS/CoolingMedium', cx.guard(cx.cs, 'CoolingMedium', AIR_REFRIGERANT)] - ].each { |name, ok| failures << "Guard failed: #{name}" unless ok } + ] + case variant + when 'central_gas_furnace' + failures += self.class.central_air_absent(hx).map { |p| "#{p} must be absent" } + guards += [ + ['A/AirDeliveryType', hx.guard(hx.a, 'AirDeliveryType', 'Central fan')], + ['A/ReheatSource', hx.guard(hx.a, 'ReheatSource', 'None')], + ['H/Furnace/FurnaceType', hx.guard(hx.h, 'Furnace/FurnaceType', FURNACE_TYPES)] + ] + when 'electric_baseboard' + guards << ['HS/PrimaryFuel', hx.guard(hx.hs, 'PrimaryFuel', ELECTRIC)] + when 'hot_water_baseboard' + guards << ['plant quantities', hx.plant_quantities_one(hx.hp)] + end + guards.each { |name, ok| failures << "Guard failed: #{name}" unless ok } sys_id = sys.attributes['ID'] unless failures.empty? - return [_result(:conflicting_input, sys_id, ids, premises, nil, failures, configuration: TERMINAL_COOLING_CONFIGURATION), - delivery_ids] + return [_result(:conflicting_input, sys_id, ids, premises, nil, failures, configuration:), delivery_ids] end + arguments = { 'heating_source' => variant } + arguments['boiler_fuel'] = hx.hot_water_boiler_fuel if variant == 'hot_water_baseboard' quantity = ->(record) { Context.texts(record, 'Quantity').first || '1' } messages = ["Source inventory kept as recorded: #{hx.hs.attributes['ID']} quantity #{quantity.call(hx.hs)}, " \ "#{cx.cs.attributes['ID']} quantity #{quantity.call(cx.cs)}. Generated: one PTAC per model zone in scope."] [_result(:match, sys_id, ids, premises, [:delivery_pair, *delivery_ids], messages, - configuration: TERMINAL_COOLING_CONFIGURATION, measure: TERMINAL_COOLING_MEASURE, - measure_arguments: { 'heating_source' => 'central_gas_furnace' }), + configuration:, measure: TERMINAL_COOLING_MEASURE, measure_arguments: arguments), delivery_ids] end diff --git a/spec/tests/unit/heating_with_terminal_cooling_spec.rb b/spec/tests/unit/heating_with_terminal_cooling_spec.rb index e705ca5..5f09adb 100644 --- a/spec/tests/unit/heating_with_terminal_cooling_spec.rb +++ b/spec/tests/unit/heating_with_terminal_cooling_spec.rb @@ -65,6 +65,74 @@ def element(systems, id) = REXML::XPath.first(systems, ".//*[@ID='#{id}']") expect(result.messages).to include('Guard failed: A/AirDeliveryType') end + describe 'baseboard and hot-water coil variants' do + def child(parent, name, text = nil, attrs = {}) + el = parent.add_element("auc:#{name}", attrs) + el.text = text if text + el + end + + # Replaces the furnace with a hot-water boiler plant (fuel given) or electric resistance (fuel nil). + def swap_heating(systems, fuel) + source = element(systems, 'HeatingSource-44989520') + type = source.elements['*[local-name()="HeatingSourceType"]'] + type.elements.delete_all('*') + medium = source.elements['*[local-name()="HeatingMedium"]'] + if fuel + child(type, 'SourceHeatingPlantID', nil, 'IDref' => 'HeatingPlant-1') + medium.text = 'Hot water' + source.elements['*[local-name()="PrimaryFuel"]'].text = fuel + sys = element(systems, 'HVACSystemType-44989360') + plant = child(child(child(REXML::Element.new('auc:Plants'), 'HeatingPlants'), 'HeatingPlant', nil, 'ID' => 'HeatingPlant-1'), 'Boiler') + child(plant, 'BoilerType', 'Hot water') + child(plant.parent, 'PrimaryFuel', fuel) + sys.insert_before(sys.elements['*[local-name()="HeatingAndCoolingSystems"]'], plant.parent.parent.parent) + else + child(type, 'ElectricResistance') + source.elements['*[local-name()="PrimaryFuel"]'].text = 'Electricity' + end + end + + def baseboard_delivery(systems) + type = element(systems, 'Delivery-44989380').elements['*[local-name()="DeliveryType"]'] + type.elements.delete_all('*') + child(child(child(type, 'ZoneEquipment'), 'Convection'), 'ConvectionType', 'Perimeter baseboard') + end + + it 'maps hot water baseboard with cooling-only PTAC' do + systems = hvac_systems(l200_path) + swap_heating(systems, 'Fuel oil no 2') + baseboard_delivery(systems) + result = select(systems).first + expect([result.status, result.configuration]).to eq [:match, 'Hot water baseboard with cooling-only PTAC'] + expect(result.measure_arguments).to eq('heating_source' => 'hot_water_baseboard', 'boiler_fuel' => 'FuelOilNo2') + expect(result.record_ids).to include('HeatingPlant-1') + end + + it 'maps electric baseboard with cooling-only PTAC' do + systems = hvac_systems(l200_path) + swap_heating(systems, nil) + baseboard_delivery(systems) + result = select(systems).first + expect([result.status, result.configuration]).to eq [:match, 'Electric baseboard with cooling-only PTAC'] + expect(result.measure_arguments).to eq('heating_source' => 'electric_baseboard') + end + + it 'maps a PTAC with a hot water coil' do + systems = hvac_systems(l200_path) + swap_heating(systems, 'Natural gas') + element(systems, 'Delivery-44989380').parent.delete_element(element(systems, 'Delivery-44989380')) + cooling = element(systems, 'Delivery-44989400') + cooling.insert_before(cooling.elements['*[local-name()="CoolingSourceID"]'], + REXML::Element.new('auc:HeatingSourceID').tap { |e| e.add_attribute('IDref', 'HeatingSource-44989520') }) + links = element(systems, 'OtherHVACSystemType-44989440').elements['*[local-name()="LinkedDeliveryIDs"]'] + links.delete_element(links.elements['*[@IDref="Delivery-44989380"]']) + results = select(systems).select { |r| r.status == :match } + expect(results.map(&:configuration)).to eq ['PTAC with hot water coil'] + expect(results.first.measure_arguments).to eq('heating_source' => 'hot_water_ptac_coil', 'boiler_fuel' => 'NaturalGas') + end + end + describe 'BOSS::Boss.write_baseline_osw' do it 'writes the topology steps and a mapping report' do Dir.mktmpdir do |dir| From 5203ae604ace1e7e07ba90a3cebd80a1f626d9d8 Mon Sep 17 00:00:00 2001 From: JieXiong9119 <69597597+JieXiong9119@users.noreply.github.com> Date: Wed, 25 Nov 2026 01:56:39 -0700 Subject: [PATCH 3/3] update ci --- .github/workflows/ci.yml | 2 +- README.md | 2 +- .../Example_NYC_Energy_Efficiency_Report_Property_2_l200.xml | 0 spec/tests/integration/write_and_run_osws_spec.rb | 3 ++- spec/tests/unit/heating_with_terminal_cooling_spec.rb | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) rename spec/files/v2.7.0/{ => l200_hvac}/Example_NYC_Energy_Efficiency_Report_Property_2_l200.xml (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f518f42..63785aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ concurrency: env: # Pinned commit (buildingsync-measures-gem add-comstock-erv-preset, adds comstock_erv) of the # sibling checkout that config/external_measure_repos.yml loads via local_path. - BSYNC_MEASURES_REF: 483efc02b5a6c2f1386afd9cae45b72ab4b0a37d + BSYNC_MEASURES_REF: 6ee630f71d5da01df79a2c0dab40b1e978c51556 jobs: unit: diff --git a/README.md b/README.md index 621d069..2d68b79 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ An HVACSystem whose heating and cooling are delivered separately maps to the gem The heating-only Delivery may instead be `ZoneEquipment/Convection` with `ConvectionType` `Perimeter baseboard`, heated by `ElectricResistance` (`electric_baseboard`) or by a `SourceHeatingPlantID` whose plant has `Boiler/BoilerType` `Hot water` (`hot_water_baseboard`, `boiler_fuel` from the plant `PrimaryFuel`). A single `ZoneEquipment` Delivery that references both the PTAC CoolingSource and such a hot-water HeatingSource maps to `hot_water_ptac_coil`. -See `Example_NYC_Energy_Efficiency_Report_Property_2_l200.xml`, which restates the user-defined fields of `Example_NYC_Energy_Efficiency_Report_Property_2.xml` as standard elements. BOSS writes `baseline/hvac_mapping_report.json` with the plan status, the HVAC steps, and the messages. Add `--require_l200` (`require_l200: true`) to raise an error instead of falling back. +See `spec/files/v2.7.0/l200_hvac/Example_NYC_Energy_Efficiency_Report_Property_2_l200.xml`, which restates the user-defined fields of `spec/files/v2.7.0/Example_NYC_Energy_Efficiency_Report_Property_2.xml` as standard elements. BOSS writes `baseline/hvac_mapping_report.json` with the plan status, the HVAC steps, and the messages. Add `--require_l200` (`require_l200: true`) to raise an error instead of falling back. ```bash bundle exec boss write_baseline_osw my_buildingsync.xml -o ./output_dir --require_l200 diff --git a/spec/files/v2.7.0/Example_NYC_Energy_Efficiency_Report_Property_2_l200.xml b/spec/files/v2.7.0/l200_hvac/Example_NYC_Energy_Efficiency_Report_Property_2_l200.xml similarity index 100% rename from spec/files/v2.7.0/Example_NYC_Energy_Efficiency_Report_Property_2_l200.xml rename to spec/files/v2.7.0/l200_hvac/Example_NYC_Energy_Efficiency_Report_Property_2_l200.xml diff --git a/spec/tests/integration/write_and_run_osws_spec.rb b/spec/tests/integration/write_and_run_osws_spec.rb index c6f2c41..588c16f 100644 --- a/spec/tests/integration/write_and_run_osws_spec.rb +++ b/spec/tests/integration/write_and_run_osws_spec.rb @@ -56,7 +56,8 @@ 'l200_hvac/l200_ptac_ventilation_only.xml' => [['hvac_ptac', 'hvac_ventilation_only'], '90.1-2013'], 'l200_hvac/l200_pthp_doas.xml' => [['hvac_pthp', 'hvac_doas'], '90.1-2013'], 'l200_hvac/l200_four_pipe_fan_coil_doas.xml' => [['hvac_four_pipe_fan_coil', 'hvac_doas'], '90.1-2013'], - 'l200_hvac/l200_vrf_doas.xml' => [['hvac_vrf', 'hvac_doas'], '90.1-2013'] + 'l200_hvac/l200_vrf_doas.xml' => [['hvac_vrf', 'hvac_doas'], '90.1-2013'], + 'l200_hvac/Example_NYC_Energy_Efficiency_Report_Property_2_l200.xml' => [['hvac_heating_with_terminal_cooling'], 'DOE Ref Pre-1980'] } topology_configs = {} if ENV['BOSS_SMOKE'] == '1' diff --git a/spec/tests/unit/heating_with_terminal_cooling_spec.rb b/spec/tests/unit/heating_with_terminal_cooling_spec.rb index 5f09adb..a8cfb0e 100644 --- a/spec/tests/unit/heating_with_terminal_cooling_spec.rb +++ b/spec/tests/unit/heating_with_terminal_cooling_spec.rb @@ -14,7 +14,7 @@ RSpec.describe 'Central furnace with cooling-only PTAC' do files_dir = File.expand_path('../../files/v2.7.0', __dir__) - l200_path = File.join(files_dir, 'Example_NYC_Energy_Efficiency_Report_Property_2_l200.xml') + l200_path = File.join(files_dir, 'l200_hvac', 'Example_NYC_Energy_Efficiency_Report_Property_2_l200.xml') original_path = File.join(files_dir, 'Example_NYC_Energy_Efficiency_Report_Property_2.xml') def hvac_systems(path)