From 1b473293824344c92ff4218f597420a161d66f24 Mon Sep 17 00:00:00 2001 From: David Goldwasser Date: Wed, 17 Jun 2026 16:07:20 -0600 Subject: [PATCH 1/2] Fixes Issue #170 I confirmed fix on the test model. I also confirmed that if I try to use space name as zone name in OS app that it renames it, so adding prefix seems like good approach. I hard coded "zone " but could make an argument if there is interest or an option to look for and swap out "space" if it is found with "zone" --- lib/measures/merge_floorspace_js_with_model/measure.rb | 2 +- lib/measures/merge_floorspace_js_with_model/measure.xml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/measures/merge_floorspace_js_with_model/measure.rb b/lib/measures/merge_floorspace_js_with_model/measure.rb index 2b7d90c6..0861821c 100644 --- a/lib/measures/merge_floorspace_js_with_model/measure.rb +++ b/lib/measures/merge_floorspace_js_with_model/measure.rb @@ -227,7 +227,7 @@ def run(model, runner, user_arguments) space_type.spaces.each do |space| unless space.thermalZone.is_initialized thermal_zone = OpenStudio::Model::ThermalZone.new(model) - thermal_zone.setName(space.name.to_s) + thermal_zone.setName("zone #{space.name.to_s}") space.setThermalZone(thermal_zone) end end diff --git a/lib/measures/merge_floorspace_js_with_model/measure.xml b/lib/measures/merge_floorspace_js_with_model/measure.xml index a505d92c..11d22327 100644 --- a/lib/measures/merge_floorspace_js_with_model/measure.xml +++ b/lib/measures/merge_floorspace_js_with_model/measure.xml @@ -3,8 +3,8 @@ 3.1 merge_floorspace_js_with_model 16ef6369-6420-4f17-894c-a767895bcaa4 - 08fb938b-1331-47e4-bcaa-07fae4abc783 - 2025-08-01T14:58:34Z + c3c232cf-cb02-4ce8-ad73-3caace5dfb60 + 2026-06-17T22:04:59Z 0AD1E2E2 MergeFloorspaceJsWithModel Merge FloorspaceJs with Model @@ -80,7 +80,7 @@ measure.rb rb script - 23601781 + 410E985D SDDC Office template.osm From 559dddcacba47ac9c0c5260fb4c934eae151232d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Jun 2026 22:45:50 +0000 Subject: [PATCH 2/2] test: add zone/space name assertions to prevent Issue #170 regression --- .../merge_floorspace_js_with_model_test.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/measures/merge_floorspace_js_with_model/tests/merge_floorspace_js_with_model_test.rb b/lib/measures/merge_floorspace_js_with_model/tests/merge_floorspace_js_with_model_test.rb index 3f131acf..4c8bf78e 100644 --- a/lib/measures/merge_floorspace_js_with_model/tests/merge_floorspace_js_with_model_test.rb +++ b/lib/measures/merge_floorspace_js_with_model/tests/merge_floorspace_js_with_model_test.rb @@ -35,6 +35,9 @@ def test_good_argument_values # store the number of spaces in the seed model num_spaces_seed = model.getSpaces.size + # capture existing zone names before running the measure + existing_zone_names = model.getThermalZones.map { |z| z.name.to_s } + # get arguments arguments = measure.arguments(model) argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments) @@ -69,6 +72,20 @@ def test_good_argument_values # check that there is now 1 space # assert_equal(1, model.getSpaces.size - num_spaces_seed) + # verify that newly created thermal zones are prefixed with "zone " + # and that zone names do not exactly match the corresponding space name (Issue #170) + model.getSpaces.each do |space| + next unless space.thermalZone.is_initialized + zone_name = space.thermalZone.get.name.to_s + next if existing_zone_names.include?(zone_name) + + space_name = space.name.to_s + assert(zone_name.start_with?('zone '), + "Expected newly created zone '#{zone_name}' to start with 'zone ' for space '#{space_name}'") + refute_equal(space_name, zone_name, + "Thermal zone name '#{zone_name}' must not equal space name '#{space_name}'") + end + # save the model to test output directory output_file_path = "#{File.dirname(__FILE__)}//output/test_output.osm" model.save(output_file_path, true)