openstudio-standards 0.8.5 → 0.8.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. checksums.yaml +4 -4
  2. data/data/standards/test_performance_expected_dd_results.csv +90 -90
  3. data/lib/openstudio-standards/btap/activity.rb +858 -61
  4. data/lib/openstudio-standards/btap/attributes.rb +297 -103
  5. data/lib/openstudio-standards/btap/bridging.rb +1335 -593
  6. data/lib/openstudio-standards/btap/btap.rb +60 -181
  7. data/lib/openstudio-standards/btap/carbon/btap_carbon.rb +199 -142
  8. data/lib/openstudio-standards/btap/common/constructions.json +1275 -0
  9. data/lib/openstudio-standards/btap/common/costs.csv +1969 -0
  10. data/lib/openstudio-standards/btap/common/costs_local_factors.csv +2315 -0
  11. data/lib/openstudio-standards/btap/common/materials_glazing.csv +61 -0
  12. data/lib/openstudio-standards/btap/{common_resources → common}/materials_hvac.csv +1685 -1685
  13. data/lib/openstudio-standards/btap/{common_resources → common}/materials_lighting.csv +266 -266
  14. data/lib/openstudio-standards/btap/common/materials_opaque.csv +214 -0
  15. data/lib/openstudio-standards/btap/common/necb_building_types.csv +35 -0
  16. data/lib/openstudio-standards/btap/common/necb_space_types.csv +110 -0
  17. data/lib/openstudio-standards/btap/common/thermal_bridging.csv +73 -0
  18. data/lib/openstudio-standards/btap/costing/btap_costing.rb +346 -429
  19. data/lib/openstudio-standards/btap/costing/database.rb +104 -0
  20. data/lib/openstudio-standards/btap/costing/daylighting_sensor_control_costing.rb +356 -344
  21. data/lib/openstudio-standards/btap/costing/dcv_costing.rb +282 -296
  22. data/lib/openstudio-standards/btap/costing/envelope_costing.rb +179 -192
  23. data/lib/openstudio-standards/btap/costing/heating_cooling_costing.rb +2477 -2316
  24. data/lib/openstudio-standards/btap/costing/led_lighting_costing.rb +127 -142
  25. data/lib/openstudio-standards/btap/costing/lighting_costing.rb +216 -198
  26. data/lib/openstudio-standards/btap/costing/nv_costing.rb +522 -523
  27. data/lib/openstudio-standards/btap/costing/pv_ground_costing.rb +649 -649
  28. data/lib/openstudio-standards/btap/costing/shw_costing.rb +626 -625
  29. data/lib/openstudio-standards/btap/costing/thermal_bridging_costing.rb +72 -0
  30. data/lib/openstudio-standards/btap/costing/ventilation_costing.rb +2363 -2361
  31. data/lib/openstudio-standards/btap/deprecated.rb +1033 -0
  32. data/lib/openstudio-standards/btap/envelope.rb +313 -572
  33. data/lib/openstudio-standards/btap/fileio.rb +152 -1070
  34. data/lib/openstudio-standards/btap/geometry.rb +486 -766
  35. data/lib/openstudio-standards/btap/linear_regression.rb +130 -0
  36. data/lib/openstudio-standards/btap/paths.rb +46 -0
  37. data/lib/openstudio-standards/btap/qaqc/analysis.rb +163 -0
  38. data/lib/openstudio-standards/btap/qaqc/data.rb +2293 -0
  39. data/lib/openstudio-standards/btap/qaqc/datapoint.rb +641 -0
  40. data/lib/openstudio-standards/btap/schedules.rb +11 -611
  41. data/lib/openstudio-standards/btap/structure.rb +574 -189
  42. data/lib/openstudio-standards/constructions/materials/information.rb +1 -1
  43. data/lib/openstudio-standards/create_typical/create_typical.rb +1 -1
  44. data/lib/openstudio-standards/exterior_lighting/create.rb +135 -85
  45. data/lib/openstudio-standards/exterior_lighting/data/typical_exterior_lighting.json +20 -0
  46. data/lib/openstudio-standards/exterior_lighting/information.rb +23 -2
  47. data/lib/openstudio-standards/geometry/create.rb +7 -3
  48. data/lib/openstudio-standards/prototypes/ashrae_90_1/ashrae_90_1_2016/ashrae_90_1_2016.Model.rb +3 -2
  49. data/lib/openstudio-standards/prototypes/ashrae_90_1/ashrae_90_1_2019/ashrae_90_1_2019.Model.rb +3 -2
  50. data/lib/openstudio-standards/prototypes/common/data/thermostat_schedule_lookup.json +84 -84
  51. data/lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb +4 -4
  52. data/lib/openstudio-standards/refrigeration/create_walkin.rb +45 -5
  53. data/lib/openstudio-standards/refrigeration/data/refrigerated_walkins.csv +75 -75
  54. data/lib/openstudio-standards/schedules/parametric.rb +6 -0
  55. data/lib/openstudio-standards/service_water_heating/create_typical.rb +10 -3
  56. data/lib/openstudio-standards/service_water_heating/create_water_heating_loop.rb +30 -14
  57. data/lib/openstudio-standards/service_water_heating/information.rb +4 -1
  58. data/lib/openstudio-standards/sql_file/unmet_hours.rb +2 -1
  59. data/lib/openstudio-standards/standards/Standards.CoilCoolingDXSingleSpeed.rb +3 -1
  60. data/lib/openstudio-standards/standards/Standards.CoilHeatingDXSingleSpeed.rb +3 -1
  61. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2004/data/ashrae_90_1_2004.boilers.json +12 -0
  62. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2004/data/ashrae_90_1_2004.construction_properties.json +18432 -3072
  63. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2007/data/ashrae_90_1_2007.boilers.json +26 -0
  64. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2007/data/ashrae_90_1_2007.construction_properties.json +8532 -1422
  65. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2010/data/ashrae_90_1_2010.boilers.json +26 -0
  66. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2010/data/ashrae_90_1_2010.construction_properties.json +8532 -1422
  67. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2013/data/ashrae_90_1_2013.boilers.json +16 -0
  68. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2013/data/ashrae_90_1_2013.computer_room_acs.json +30 -30
  69. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2013/data/ashrae_90_1_2013.construction_properties.json +7560 -1260
  70. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2016/ashrae_90_1_2016.PumpVariableSpeed.rb +1 -2
  71. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2016/data/ashrae_90_1_2016.boilers.json +16 -0
  72. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2016/data/ashrae_90_1_2016.construction_properties.json +7560 -1260
  73. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2019/ashrae_90_1_2019.AirLoopHVAC.rb +3 -3
  74. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2019/ashrae_90_1_2019.PumpVariableSpeed.rb +1 -2
  75. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2019/data/ashrae_90_1_2019.boilers.json +22 -0
  76. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2019/data/ashrae_90_1_2019.construction_properties.json +7236 -1206
  77. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2019/data/ashrae_90_1_2019.furnaces.json +223 -19
  78. data/lib/openstudio-standards/standards/ashrae_90_1/data/ashrae_90_1.schedules.json +37 -1
  79. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/data/ashrae_90_1_prm_2019.boilers.json +3 -0
  80. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/data/ashrae_90_1_prm_2019.construction_properties.json +6900 -1150
  81. data/lib/openstudio-standards/standards/cbes/data/cbes.schedules.json +1 -1
  82. data/lib/openstudio-standards/standards/deer/data/deer.schedules.json +1 -1
  83. data/lib/openstudio-standards/standards/necb/BTAP1980TO2010/data/surface_thermal_transmittance.json +76 -40
  84. data/lib/openstudio-standards/standards/necb/BTAPPRE1980/data/surface_thermal_transmittance.json +76 -40
  85. data/lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb +6 -4
  86. data/lib/openstudio-standards/standards/necb/NECB2011/NECB2011_QAQC.json +2988 -0
  87. data/lib/openstudio-standards/standards/necb/NECB2011/autozone.rb +25 -3
  88. data/lib/openstudio-standards/standards/necb/NECB2011/building_envelope.rb +672 -534
  89. data/lib/openstudio-standards/standards/necb/NECB2011/data/geometry/Hospital.osm +1791 -1792
  90. data/lib/openstudio-standards/standards/necb/NECB2011/data/geometry/LEEPMultiTower.osm +7 -1
  91. data/lib/openstudio-standards/standards/necb/NECB2011/data/geometry/LEEPTownHouse.osm +7 -1
  92. data/lib/openstudio-standards/standards/necb/NECB2011/data/geometry/LargeHotel.osm +5 -6
  93. data/lib/openstudio-standards/standards/necb/NECB2011/data/geometry/LargeOffice.osm +8 -9
  94. data/lib/openstudio-standards/standards/necb/NECB2011/data/geometry/NorthernEducation.osm +10 -4
  95. data/lib/openstudio-standards/standards/necb/NECB2011/data/geometry/NorthernHealthCare.osm +14 -15
  96. data/lib/openstudio-standards/standards/necb/NECB2011/data/geometry/Outpatient.osm +7 -1
  97. data/lib/openstudio-standards/standards/necb/NECB2011/data/surface_thermal_transmittance.json +76 -40
  98. data/lib/openstudio-standards/standards/necb/NECB2011/hvac_systems.rb +14 -6
  99. data/lib/openstudio-standards/standards/necb/NECB2011/necb_2011.rb +542 -130
  100. data/lib/openstudio-standards/standards/necb/NECB2011/qaqc/necb_qaqc.rb +30 -63
  101. data/lib/openstudio-standards/standards/necb/NECB2011/service_water_heating.rb +7 -2
  102. data/lib/openstudio-standards/standards/necb/NECB2015/data/surface_thermal_transmittance.json +90 -0
  103. data/lib/openstudio-standards/standards/necb/NECB2015/necb_2015.rb +8 -6
  104. data/lib/openstudio-standards/standards/necb/NECB2017/data/surface_thermal_transmittance.json +76 -40
  105. data/lib/openstudio-standards/standards/necb/NECB2017/necb_2017.rb +2 -1
  106. data/lib/openstudio-standards/standards/necb/NECB2020/building_envelope.rb +0 -117
  107. data/lib/openstudio-standards/standards/necb/NECB2020/data/surface_thermal_transmittance.json +76 -45
  108. data/lib/openstudio-standards/standards/necb/NECB2020/necb_2020.rb +218 -0
  109. data/lib/openstudio-standards/standards/necb/common/construction_defaults.osm +12 -7
  110. data/lib/openstudio-standards/standards/standard.rb +1 -1
  111. data/lib/openstudio-standards/version.rb +1 -1
  112. data/lib/openstudio-standards.rb +9 -4
  113. metadata +59 -66
  114. data/data/inventory/thermal_bridging.csv +0 -90
  115. data/data/standards/OpenStudio_Standards-ashrae_90_1-ALL-comstock(space_types).xlsx +0 -0
  116. data/data/standards/openstudio_standards_duplicates_log.csv +0 -7962
  117. data/lib/openstudio-standards/btap/NECB_building_types.csv +0 -35
  118. data/lib/openstudio-standards/btap/NECB_space_types.csv +0 -109
  119. data/lib/openstudio-standards/btap/WeatherData1.json +0 -2110
  120. data/lib/openstudio-standards/btap/WeatherData1.xlsx +0 -0
  121. data/lib/openstudio-standards/btap/btap_result.rb +0 -1144
  122. data/lib/openstudio-standards/btap/btap_test_helper.rb +0 -86
  123. data/lib/openstudio-standards/btap/common_paths.rb +0 -81
  124. data/lib/openstudio-standards/btap/common_resources/ConstructionProperties.csv +0 -52
  125. data/lib/openstudio-standards/btap/common_resources/Constructions.csv +0 -37
  126. data/lib/openstudio-standards/btap/common_resources/construction_sets.csv +0 -1270
  127. data/lib/openstudio-standards/btap/common_resources/constructions_glazing.csv +0 -121
  128. data/lib/openstudio-standards/btap/common_resources/constructions_opaque.csv +0 -2256
  129. data/lib/openstudio-standards/btap/common_resources/costs.csv +0 -1897
  130. data/lib/openstudio-standards/btap/common_resources/costs_local_factors.csv +0 -2315
  131. data/lib/openstudio-standards/btap/common_resources/materials_glazing.csv +0 -35
  132. data/lib/openstudio-standards/btap/common_resources/materials_opaque.csv +0 -164
  133. data/lib/openstudio-standards/btap/costing/btap_measure_helper.rb +0 -359
  134. data/lib/openstudio-standards/btap/costing/btap_workflow.rb +0 -117
  135. data/lib/openstudio-standards/btap/costing/copy_test_results_files_to_expected_results.rb +0 -11
  136. data/lib/openstudio-standards/btap/costing/cost_building_from_file.rb +0 -136
  137. data/lib/openstudio-standards/btap/costing/costing_database_wrapper.rb +0 -173
  138. data/lib/openstudio-standards/btap/costing/dummy.epw +0 -8768
  139. data/lib/openstudio-standards/btap/costing/dummy.osm +0 -5320
  140. data/lib/openstudio-standards/btap/costing/neb_end_use_prices.csv +0 -42
  141. data/lib/openstudio-standards/btap/costing/necb_2011_spacetype_info.csv +0 -225
  142. data/lib/openstudio-standards/btap/costing/necb_reference_runs.csv +0 -28705
  143. data/lib/openstudio-standards/btap/costing/parallel_tests.rb +0 -92
  144. data/lib/openstudio-standards/btap/costing/test_list.txt +0 -15
  145. data/lib/openstudio-standards/btap/costing/test_run_all_test_locally.rb +0 -27
  146. data/lib/openstudio-standards/btap/costing/test_run_costing_tests.rb +0 -80
  147. data/lib/openstudio-standards/btap/necb_2011_spacetype_info.csv +0 -225
  148. data/lib/openstudio-standards/btap/utilities/Add_template_field_to_json.rb +0 -22
  149. data/lib/openstudio-standards/btap/utilities/convert_surfaces_to_adiabatic_necb_8426.rb +0 -204
  150. data/lib/openstudio-standards/btap/utilities/generate_space_types.rb +0 -8
  151. data/lib/openstudio-standards/btap/utilities/necb_to_epw_map.rb +0 -50
  152. data/lib/openstudio-standards/btap/utilities/os_sim_extract.rb +0 -48
  153. data/lib/openstudio-standards/btap/utilities/rename_surfaces.rb +0 -24
  154. data/lib/openstudio-standards/btap/utilities/round_surf_coords.rb +0 -32
  155. data/lib/openstudio-standards/btap/utilities/sched_create.rb +0 -145
  156. data/lib/openstudio-standards/btap/utilities/set_mult_to_adiabatic.rb +0 -53
  157. data/lib/openstudio-standards/btap/utilities/space_type.rb +0 -78
  158. data/lib/openstudio-standards/btap/utilities/weatherData1_xlsx_to_json.rb +0 -56
  159. data/lib/openstudio-standards/btap/vintagizer.rb +0 -161
  160. data/lib/openstudio-standards/btap/visualization.rb +0 -72
  161. data/lib/openstudio-standards/standards/necb/NECB2011/data/necb_2011_spacetype_info.csv +0 -225
  162. data/lib/openstudio-standards/standards/necb/common/btap_analysis.rb +0 -79
  163. data/lib/openstudio-standards/standards/necb/common/btap_data.rb +0 -2656
  164. data/lib/openstudio-standards/standards/necb/common/btap_datapoint.rb +0 -653
  165. data/lib/openstudio-standards/standards/necb/common/necb_reference_runs.csv +0 -28705
  166. data/lib/openstudio-standards/standards/necb/common/utility_pricing_2025-02-20.csv +0 -92
  167. /data/lib/openstudio-standards/btap/{common_resources → common}/carbon_frame.csv +0 -0
  168. /data/lib/openstudio-standards/btap/{common_resources → common}/carbon_glazing.csv +0 -0
  169. /data/lib/openstudio-standards/btap/{common_resources → common}/carbon_opaque.csv +0 -0
  170. /data/lib/openstudio-standards/btap/{common_resources → common}/hvac_vent_ahu.csv +0 -0
  171. /data/lib/openstudio-standards/btap/{common_resources → common}/lighting.csv +0 -0
  172. /data/lib/openstudio-standards/btap/{common_resources → common}/lighting_sets.csv +0 -0
  173. /data/lib/openstudio-standards/btap/{common_resources → common}/locations.csv +0 -0
  174. /data/lib/openstudio-standards/btap/{costing → common}/mech_sizing.json +0 -0
@@ -1,209 +1,227 @@
1
- class BTAPCosting
2
-
3
- def cost_audit_lighting(model, prototype_creator)
4
- # Store number of stories. Required for envelope costing logic.
5
- num_of_above_ground_stories = model.getBuilding.standardsNumberOfAboveGroundStories.to_i
6
-
7
- template_type = prototype_creator.template
8
-
9
- closest_loc = get_closest_cost_location(model.getWeatherFile.latitude, model.getWeatherFile.longitude)
10
- generate_construction_cost_database_for_city(@costing_report["city"],@costing_report["province_state"])
11
-
12
- totLgtCost = 0
13
-
14
- # daylighting sensor control costing
15
- dsc_cost_total = cost_audit_daylighting_sensor_control(model: model, prototype_creator: prototype_creator)
16
-
17
- # led lighting costing
18
- led_cost_total = cost_audit_led_lighting(model: model, prototype_creator: prototype_creator)
19
-
20
- totLgtCost += dsc_cost_total
21
-
22
- # Iterate through the thermal zones.
23
-
24
- #Create Zonal report.
25
- @costing_report["lighting"]["fixture_report"] = []
26
- @costing_report["lighting"]["space_report"] = []
27
- model.getThermalZonesSorted.each do |zone|
28
- # Iterate through spaces.
29
- spaceNum = 0 # Counting number of spaces for reporting
30
- total_with_region = 0
31
- zone.getSpacesSorted.each do |space|
32
- spaceNum += 1 # Counting number of spaces for reporting
33
- # Get SpaceType defined for space.. if not defined it will skip the spacetype. May have to deal with Attic spaces.
34
- if space.spaceType.empty? or space.spaceType.get.standardsSpaceType.empty? or space.spaceType.get.standardsBuildingType.empty?
35
- raise ("standards Space type and building type is not defined for space:#{space.name.get}. Skipping this space for costing.")
36
- end
37
-
38
- # Get space type standard names.
39
- space_type = space.spaceType.get.standardsSpaceType
40
- building_type = space.spaceType.get.standardsBuildingType
41
- space_light = space.spaceType.get.lights
42
- space_has_no_light = space_light.empty?
43
-
44
- # Figure out what light_type is used in the building
45
- light_type = 'Nil'
46
- if space_has_no_light == false
47
- space.spaceType.get.lights.sort.each do |light|
48
- space_lights_definition = light.lightsDefinition
49
- space_lights_definition_name = space_lights_definition.name
50
- if space_lights_definition_name.to_s.include?('LED lighting') or template_type=='NECB2020' # Note: NECB2020's lights default is LED
51
- light_type = 'LED'
52
- else
53
- light_type = 'CFL'
1
+ module BTAP
2
+ class Costing
3
+ def cost_audit_lighting(model, prototype_creator)
4
+
5
+ # Store number of stories. Required for envelope costing logic.
6
+ num_of_above_ground_stories = model.getBuilding.standardsNumberOfAboveGroundStories.to_i
7
+
8
+ template_type = prototype_creator.template
9
+ totLgtCost = 0
10
+
11
+ # Calculate daylighting sensor control and lighting costing.
12
+ dsc_cost_total = cost_audit_daylighting_sensor_control(model: model, prototype_creator: prototype_creator)
13
+ led_cost_total = cost_audit_led_lighting(model: model, prototype_creator: prototype_creator)
14
+ totLgtCost += dsc_cost_total
15
+
16
+ # Create zonal report.
17
+ @costing_report["lighting"]["fixture_report"] = []
18
+ @costing_report["lighting"]["space_report"] = []
19
+ model.getThermalZonesSorted.each do |zone|
20
+
21
+ # Iterate through spaces.
22
+ spaceNum = 0 # Counting number of spaces for reporting.
23
+ zone.getSpacesSorted.each do |space|
24
+
25
+ spaceNum += 1
26
+ total_with_region = 0
27
+
28
+ # Get the SpaceType of the space. If it is not defined it, it will
29
+ # skip the spacetype.
30
+ if space.spaceType.empty? or space.spaceType.get.standardsSpaceType.empty? or space.spaceType.get.standardsBuildingType.empty?
31
+ raise ("standards Space type and building type is not defined for space:#{space.name.get}. Skipping this space for costing.")
32
+ end
33
+
34
+ # Get space type standard names.
35
+ space_type = space.spaceType.get.standardsSpaceType
36
+ building_type = space.spaceType.get.standardsBuildingType
37
+ space_light = space.spaceType.get.lights
38
+ space_has_no_light = space_light.empty?
39
+
40
+ # Figure out what light_type is used in the building.
41
+ light_type = 'Nil'
42
+ if space_has_no_light == false
43
+ space.spaceType.get.lights.sort.each do |light|
44
+ space_lights_definition = light.lightsDefinition
45
+ space_lights_definition_name = space_lights_definition.name
46
+
47
+ # NOTE: NECB2020's lights default is LED.
48
+ if space_lights_definition_name.to_s.include?('LED lighting') or template_type == 'NECB2020'
49
+ light_type = 'LED'
50
+ else
51
+ light_type = 'CFL'
52
+ end
54
53
  end
55
54
  end
56
- end
57
-
58
- # Get standard lighting sets based on collected information (spacetype, no of stories, etc..)
59
- if space_has_no_light == false
60
- lighting_set = @costing_database['raw']['lighting_sets'].detect {|data|
61
- data['template'].to_s.gsub(/\s*/, '') == template_type and
62
- data['building_type'].to_s.downcase == building_type.to_s.downcase and
63
- data['space_type'].to_s.downcase == space_type.to_s.downcase and
64
- data['Type'].to_s.downcase == light_type.to_s.downcase
65
- }
66
- else
67
- lighting_set = @costing_database['raw']['lighting_sets'].detect {|data|
68
- data['template'].to_s.gsub(/\s*/, '') == template_type and
69
- data['building_type'].to_s.downcase == building_type.to_s.downcase and
70
- data['space_type'].to_s.downcase == space_type.to_s.downcase
71
- }
72
- end
73
-
74
- # Determine average space height using space volume and floor area (convert to feet)
75
- ceilHgt, flrArea = 0
76
- if space.floorArea > 0
77
- ceilHgt = space.volume / space.floorArea
78
- ceilHgt = OpenStudio.convert(ceilHgt,"m","ft").get
79
- flrArea = OpenStudio.convert(space.floorArea,"m^2","ft^2").get
80
- end
81
-
82
- # Find Fixture type for this space ceiling height (ft)
83
- fixtureType = 'Nil'
84
- fixture_description = ""
85
- if lighting_set.nil?
86
- raise("Error: lighting_set empty for zone #{zone.name.to_s} and space type #{building_type} #{space_type.to_s}!")
87
- else
88
- if ceilHgt > 0 && ceilHgt < 7.88
89
- fixtureType = lighting_set["Fixture_type_less_than_7.88ft_ht"]
90
- elsif ceilHgt >= 7.88 && ceilHgt <= 15.75
91
- fixtureType = lighting_set["Fixture_type_7.88_to_15.75ft_ht"]
92
- elsif ceilHgt > 15.75
93
- fixtureType = lighting_set["Fixture_type_greater_than_>15.75ft_ht"]
55
+
56
+ # Get standard lighting sets based on collected information
57
+ # (spacetype, no of stories, etc.).
58
+ if space_has_no_light == false
59
+ lighting_set = @costing_database['raw']['lighting_sets'].detect {|data|
60
+ data['template'].to_s.gsub(/\s*/, '') == template_type and
61
+ data['building_type'].to_s.downcase == building_type.to_s.downcase and
62
+ data['space_type'].to_s.downcase == space_type.to_s.downcase and
63
+ data['Type'].to_s.downcase == light_type.to_s.downcase
64
+ }
65
+ else
66
+ lighting_set = @costing_database['raw']['lighting_sets'].detect {|data|
67
+ data['template'].to_s.gsub(/\s*/, '') == template_type and
68
+ data['building_type'].to_s.downcase == building_type.to_s.downcase and
69
+ data['space_type'].to_s.downcase == space_type.to_s.downcase
70
+ }
71
+ end
72
+
73
+ # Determine average space height using space volume and floor area
74
+ # (convert to feet).
75
+ ceilHgt, flrArea = 0
76
+ if space.floorArea > 0
77
+ ceilHgt = space.volume / space.floorArea
78
+ ceilHgt = OpenStudio.convert(ceilHgt,"m","ft").get
79
+ flrArea = OpenStudio.convert(space.floorArea,"m^2","ft^2").get
94
80
  end
95
- end
96
-
97
- # Costs are 0 for 'Nil' because no fixture type due to either zero floor area, zero ceiling height or a 'Nil'
98
- # setting for fixture type in lighting_sets sheet ("- undefined -" space)
99
- if fixtureType != 'Nil'
100
- # Get lighting type sets based on fixtureType
101
- lighting_type = @costing_database['raw']['lighting'].select {|lighting_layer_data|
102
- lighting_layer_data['lighting_type_id'].to_s == fixtureType.to_s
103
- }.first
104
-
105
- # Scan through layer IDs in id_layers field to get API data from materials_lighting sheet
106
- materials_lighting_database = @costing_database["raw"]["materials_lighting"]
107
-
108
- layer_type_IDs = []
109
- layer_type_mult = []
110
- layer_MaterialCost = 0
111
- layer_LabourCost = 0
112
-
113
- if lighting_type["id_layers"].empty?
114
- raise ("Lighting type layers list for lighting type ID #{fixtureType} is empty.")
81
+
82
+ # Find Fixture type for this space ceiling height (ft).
83
+ fixtureType = 'Nil'
84
+ fixture_description = ""
85
+ if lighting_set.nil?
86
+ raise("Error: lighting_set empty for zone #{zone.name.to_s} and space type #{building_type} #{space_type.to_s}!")
115
87
  else
116
- layer_type_IDs = lighting_type["id_layers"].split(/\s*,\s*/)
117
- layer_type_mult = lighting_type["Id_layers_quantity_multipliers"].split(/\s*,\s*/)
118
- lighting_layers = layer_type_IDs.zip(layer_type_mult).to_h
119
-
120
- lighting_layers.each do |layer_id, layer_mult|
121
- # Note: The column in the spreadsheet labelled "lighting_type_id" is mislabelled and should
122
- # really be "lighting_type_layer_id" but left it as-is (below).
123
- lighting_material = materials_lighting_database.find do |data|
124
- data["lighting_type_id"].to_s == layer_id.to_s
125
- end
126
- if lighting_material.nil?
127
- puts "Lighting material error..could not find lighting material #{layer_id} in #{materials_lighting_database}"
128
- raise
129
- else
130
- costing_data = @costing_database['costs'].detect {|data| data['id'].to_s.upcase == lighting_material['id'].to_s.upcase}
131
- if costing_data.nil?
132
- puts "Lighting material id #{lighting_material['id']} not found in costing data. Skipping."
88
+ if ceilHgt > 0 && ceilHgt < 7.88
89
+ fixtureType = lighting_set["Fixture_type_less_than_7.88ft_ht"]
90
+ elsif ceilHgt >= 7.88 && ceilHgt <= 15.75
91
+ fixtureType = lighting_set["Fixture_type_7.88_to_15.75ft_ht"]
92
+ elsif ceilHgt > 15.75
93
+ fixtureType = lighting_set["Fixture_type_greater_than_>15.75ft_ht"]
94
+ end
95
+ end
96
+
97
+ # Costs are 0 for 'Nil' because no fixture type due to either zero
98
+ # floor area, zero ceiling height or a 'Nil' setting for fixture type
99
+ # in lighting_sets sheet ("- undefined -" space).
100
+ if fixtureType != 'Nil'
101
+
102
+ # Get lighting type sets based on fixtureType.
103
+ lighting_type = @costing_database['raw']['lighting'].select {|lighting_layer_data|
104
+ lighting_layer_data['lighting_type_id'].to_s == fixtureType.to_s
105
+ }.first
106
+
107
+ # Scan through layer IDs in id_layers field to get API data from materials_lighting sheet
108
+ materials_lighting_database = @costing_database["raw"]["materials_lighting"]
109
+
110
+ layer_type_IDs = []
111
+ layer_type_mult = []
112
+ layer_MaterialCost = 0
113
+ layer_LabourCost = 0
114
+
115
+ if lighting_type["id_layers"].empty?
116
+ raise ("Lighting type layers list for lighting type ID #{fixtureType} is empty.")
117
+ else
118
+ layer_type_IDs = lighting_type["id_layers"].split(/\s*,\s*/)
119
+ layer_type_mult = lighting_type["Id_layers_quantity_multipliers"].split(/\s*,\s*/)
120
+ lighting_layers = layer_type_IDs.zip(layer_type_mult).to_h
121
+
122
+ lighting_layers.each do |layer_id, layer_mult|
123
+
124
+ # NOTE: The column in `lighting.csv` labelled
125
+ # "lighting_type_id" is mislabelled and should really be
126
+ # "lighting_type_layer_id" but left it as-is (below).
127
+ lighting_material = materials_lighting_database.find do |data|
128
+ data["lighting_type_id"].to_s == layer_id.to_s
129
+ end
130
+ if lighting_material.nil?
131
+ puts "Lighting material error..could not find lighting material #{layer_id} in #{materials_lighting_database}"
133
132
  raise
134
133
  else
135
- # Get cost information from lookup.
136
- material_cost = costing_data['baseCosts']['materialOpCost'].to_f * layer_mult.to_f * flrArea * zone.multiplier
137
- labour_cost = costing_data['baseCosts']['laborOpCost'].to_f * layer_mult.to_f * flrArea * zone.multiplier
138
- layer_MaterialCost += material_cost
139
- layer_LabourCost += labour_cost
140
-
141
- regional_material, regional_installation =
142
- get_regional_cost_factors(@costing_report["province_state"], @costing_report["city"], lighting_material)
143
- total_with_region = layer_MaterialCost * regional_material / 100.0 + layer_LabourCost * regional_installation / 100.0
144
-
145
- # Gather info for costed items output file
146
- tags = ['lighting','necb_default']
147
- add_costed_item(material_id: costing_data['id'],
148
- quantity: layer_mult.to_f * flrArea * zone.multiplier,
149
- material_mult: costing_data['material_mult'].to_f,
150
- labour_mult: costing_data['labour_mult'].to_f,
151
- equip_mult: 1.0,
152
- tags: tags)
153
-
154
-
155
- end # costing_data Nil check
156
- end # lighting_material Nil check
157
- end # lighting layer ids loop
158
-
159
- totLgtCost += total_with_region
160
- fixture_description = lighting_type["description"]
161
- end # lighting layer ids check
162
- end # fixtureType Nil check
163
-
164
- zName = zone.name.to_s
165
-
166
- # Create Lighting space report.
167
- @costing_report["lighting"]["space_report"] << {
168
- 'space' => space.name.to_s,
169
- 'zone' => zone.name.to_s,
170
- 'building_type' =>space.spaceType.get.standardsBuildingType.to_s,
171
- 'space_type' => space.spaceType.get.standardsSpaceType.to_s,
172
- 'zone_multiplier' => space.multiplier,
173
- 'fixture_type' => fixtureType,
174
- 'fixture_desciption' => fixture_description,
175
- 'height_avg_ft' => ceilHgt.round(1),
176
- 'floor_area_ft2' => (flrArea * space.multiplier).round(1),
177
- 'cost' => total_with_region.round(2),
178
- 'cost_per_ft2' => (total_with_region / ( flrArea * space.multiplier )).round(2),
179
- 'note' => ""
180
- }
181
-
182
- # Create Lighting Zonal report.
183
- lighting_fixture_report = @costing_report["lighting"]["fixture_report"].detect {|fixture_report| fixture_report["fixture_type"] == fixtureType}
184
- unless lighting_fixture_report.nil?
185
- lighting_fixture_report['floor_area_ft2'] = (lighting_fixture_report['floor_area_ft2'] + (flrArea * space.multiplier)).round(1)
186
- lighting_fixture_report['cost'] = (lighting_fixture_report['cost'] + total_with_region).round(2)
187
- lighting_fixture_report['cost_per_ft2'] = (lighting_fixture_report['cost'] / lighting_fixture_report['floor_area_ft2']).round(2)
188
- lighting_fixture_report['spaces'] << space.name.get
189
- lighting_fixture_report['number_of_spaces'] = lighting_fixture_report['spaces'].size
190
- else
191
- @costing_report["lighting"]["fixture_report"] << {
192
- 'fixture_type' => fixtureType,
193
- 'fixture_description' => fixture_description,
194
- 'floor_area_ft2' => (flrArea * space.multiplier).round(1),
195
- 'cost' => total_with_region.round(2),
196
- 'cost_per_ft2' => (total_with_region / (flrArea * space.multiplier)).round(2),
197
- 'spaces' => [space.name.get],
198
- 'number_of_spaces' => 1
134
+ costing_data = @costing_database['costs'].detect {|data| data['id'].to_s.upcase == lighting_material['id'].to_s.upcase}
135
+ if costing_data.nil?
136
+ puts "Lighting material id #{lighting_material['id']} not found in costing data. Skipping."
137
+ raise
138
+ else
139
+
140
+ # Get cost information from lookup.
141
+ material_cost =
142
+ costing_data['baseCosts']['materialOpCost'].to_f * layer_mult.to_f * flrArea * zone.multiplier
143
+
144
+ labour_cost =
145
+ costing_data['baseCosts']['laborOpCost'].to_f * layer_mult.to_f * flrArea * zone.multiplier
146
+
147
+ layer_MaterialCost += material_cost
148
+ layer_LabourCost += labour_cost
149
+
150
+ regional_material, regional_installation =
151
+ get_regional_cost_factors(@costing_report["province_state"],
152
+ @costing_report["city"],
153
+ lighting_material)
154
+
155
+ total_with_region =
156
+ layer_MaterialCost * regional_material / 100.0 + layer_LabourCost * regional_installation / 100.0
157
+
158
+ # Gather info for costed items output file.
159
+ tags = ['lighting','necb_default']
160
+ add_costed_item(material_id: costing_data['id'],
161
+ quantity: layer_mult.to_f * flrArea * zone.multiplier,
162
+ material_mult: costing_data['material_mult'].to_f,
163
+ labour_mult: costing_data['labour_mult'].to_f,
164
+ equip_mult: 1.0,
165
+ tags: tags)
166
+
167
+
168
+ end # costing_data Nil check
169
+ end # lighting_material Nil check
170
+ end # lighting layer ids loop
171
+
172
+ totLgtCost += total_with_region
173
+ fixture_description = lighting_type["description"]
174
+ end # lighting layer ids check
175
+ end # fixtureType Nil check
176
+
177
+ zName = zone.name.to_s
178
+
179
+ # Create Lighting space report.
180
+ @costing_report["lighting"]["space_report"] << {
181
+ 'space' => space.name.to_s,
182
+ 'zone' => zone.name.to_s,
183
+ 'building_type' =>space.spaceType.get.standardsBuildingType.to_s,
184
+ 'space_type' => space.spaceType.get.standardsSpaceType.to_s,
185
+ 'zone_multiplier' => space.multiplier,
186
+ 'fixture_type' => fixtureType,
187
+ 'fixture_desciption' => fixture_description,
188
+ 'height_avg_ft' => ceilHgt.round(1),
189
+ 'floor_area_ft2' => (flrArea * space.multiplier).round(1),
190
+ 'cost' => total_with_region.round(2),
191
+ 'cost_per_ft2' => (total_with_region / ( flrArea * space.multiplier )).round(2),
192
+ 'note' => ""
199
193
  }
200
- end
201
- end # Spaces loop
202
- end # thermalzone loop
203
194
 
204
- @costing_report["lighting"]['total_lighting_cost'] = totLgtCost.round(2)
205
- puts "\nLighting costing data successfully generated. Total lighting cost is $#{totLgtCost.round(2)}"
195
+ # Create Lighting Zonal report.
196
+ lighting_fixture_report = @costing_report["lighting"]["fixture_report"].detect {|fixture_report| fixture_report["fixture_type"] == fixtureType}
197
+ unless lighting_fixture_report.nil?
198
+ lighting_fixture_report['floor_area_ft2'] =
199
+ (lighting_fixture_report['floor_area_ft2'] + (flrArea * space.multiplier)).round(1)
200
+
201
+ lighting_fixture_report['cost'] = (lighting_fixture_report['cost'] + total_with_region).round(2)
202
+ lighting_fixture_report['cost_per_ft2'] =
203
+ (lighting_fixture_report['cost'] / lighting_fixture_report['floor_area_ft2']).round(2)
204
+
205
+ lighting_fixture_report['spaces'] << space.name.get
206
+ lighting_fixture_report['number_of_spaces'] = lighting_fixture_report['spaces'].size
207
+ else
208
+ @costing_report["lighting"]["fixture_report"] << {
209
+ 'fixture_type' => fixtureType,
210
+ 'fixture_description' => fixture_description,
211
+ 'floor_area_ft2' => (flrArea * space.multiplier).round(1),
212
+ 'cost' => total_with_region.round(2),
213
+ 'cost_per_ft2' => (total_with_region / (flrArea * space.multiplier)).round(2),
214
+ 'spaces' => [space.name.get],
215
+ 'number_of_spaces' => 1
216
+ }
217
+ end
218
+ end # Spaces loop
219
+ end # thermalzone loop
220
+
221
+ @costing_report["lighting"]['total_lighting_cost'] = totLgtCost.round(2)
222
+ puts "\nLighting costing data successfully generated. Total lighting cost is $#{totLgtCost.round(2)}"
206
223
 
207
- return totLgtCost
224
+ return totLgtCost
225
+ end
208
226
  end
209
227
  end