openstudio-standards 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/data/standards/OpenStudio_Standards.xlsx +0 -0
  3. data/data/standards/OpenStudio_Standards_boilers.json +62 -4
  4. data/data/standards/OpenStudio_Standards_chillers.json +778 -68
  5. data/data/standards/OpenStudio_Standards_construction_sets.json +52 -93
  6. data/data/standards/OpenStudio_Standards_curve_biquadratics.json +36 -36
  7. data/data/standards/OpenStudio_Standards_curve_quadratics.json +3 -3
  8. data/data/standards/OpenStudio_Standards_heat_pumps.json +840 -0
  9. data/data/standards/OpenStudio_Standards_heat_pumps_heating.json +352 -0
  10. data/data/standards/OpenStudio_Standards_heat_rejection.json +48 -0
  11. data/data/standards/OpenStudio_Standards_motors.json +270 -0
  12. data/data/standards/OpenStudio_Standards_space_types.json +10390 -2824
  13. data/data/standards/OpenStudio_Standards_unitary_acs.json +794 -18
  14. data/data/weather/USA_CO_Boulder-Broomfield-Jefferson.County.AP.724699_TMY3.ddy +538 -0
  15. data/data/weather/USA_CO_Boulder-Broomfield-Jefferson.County.AP.724699_TMY3.epw +8768 -0
  16. data/data/weather/USA_CO_Boulder-Broomfield-Jefferson.County.AP.724699_TMY3.stat +493 -0
  17. data/data/weather/USA_CO_Denver.Intl.AP.725650_TMY3.ddy +536 -0
  18. data/data/weather/USA_CO_Denver.Intl.AP.725650_TMY3.epw +8768 -0
  19. data/data/weather/USA_CO_Denver.Intl.AP.725650_TMY3.stat +554 -0
  20. data/data/weather/USA_CO_Fort.Collins.AWOS.724769_TMY3.ddy +536 -0
  21. data/data/weather/USA_CO_Fort.Collins.AWOS.724769_TMY3.epw +8768 -0
  22. data/data/weather/USA_CO_Fort.Collins.AWOS.724769_TMY3.stat +554 -0
  23. data/data/weather/envelope_info.csv +6 -0
  24. data/lib/openstudio-standards.rb +10 -11
  25. data/lib/openstudio-standards/btap/compliance.rb +251 -969
  26. data/lib/openstudio-standards/btap/envelope.rb +1 -1
  27. data/lib/openstudio-standards/btap/fileio.rb +37 -5
  28. data/lib/openstudio-standards/btap/geometry.rb +27 -17
  29. data/lib/openstudio-standards/btap/hvac.rb +80 -27
  30. data/lib/openstudio-standards/hvac_sizing/{HVACSizing.CoilHeatingDXMultiSpeed.rb → Siz.CoilHeatingDXMultiSpeed.rb} +0 -0
  31. data/lib/openstudio-standards/hvac_sizing/Siz.ControllerOutdoorAir.rb +30 -4
  32. data/lib/openstudio-standards/hvac_sizing/Siz.CoolingTowerTwoSpeed.rb +61 -5
  33. data/lib/openstudio-standards/hvac_sizing/Siz.CoolingTowerVariableSpeed.rb +37 -7
  34. data/lib/openstudio-standards/hvac_sizing/Siz.DistrictCooling.rb +27 -0
  35. data/lib/openstudio-standards/hvac_sizing/Siz.DistrictHeating.rb +27 -0
  36. data/lib/openstudio-standards/hvac_sizing/Siz.HeaderedPumpsConstantSpeed.rb +55 -0
  37. data/lib/openstudio-standards/hvac_sizing/Siz.HeaderedPumpsVariableSpeed.rb +55 -0
  38. data/lib/openstudio-standards/hvac_sizing/Siz.HeatingCoolingFuels.rb +51 -9
  39. data/lib/openstudio-standards/hvac_sizing/Siz.Model.rb +99 -17
  40. data/lib/openstudio-standards/hvac_sizing/Siz.PumpConstantSpeed.rb +1 -1
  41. data/lib/openstudio-standards/hvac_sizing/Siz.ThermalZone.rb +29 -6
  42. data/lib/openstudio-standards/hvac_sizing/Siz.WaterHeaterMixed.rb +16 -0
  43. data/lib/openstudio-standards/prototypes/Prototype.AirTerminalSingleDuctVAVReheat.rb +43 -48
  44. data/lib/openstudio-standards/prototypes/Prototype.ControllerWaterCoil.rb +5 -9
  45. data/lib/openstudio-standards/prototypes/Prototype.Fan.rb +68 -0
  46. data/lib/openstudio-standards/prototypes/Prototype.FanConstantVolume.rb +39 -43
  47. data/lib/openstudio-standards/prototypes/Prototype.FanOnOff.rb +49 -51
  48. data/lib/openstudio-standards/prototypes/Prototype.FanVariableVolume.rb +55 -61
  49. data/lib/openstudio-standards/prototypes/Prototype.FanZoneExhaust.rb +8 -10
  50. data/lib/openstudio-standards/prototypes/Prototype.HeatExchangerAirToAirSensibleAndLatent.rb +15 -20
  51. data/lib/openstudio-standards/prototypes/Prototype.Model.hvac.rb +330 -322
  52. data/lib/openstudio-standards/prototypes/Prototype.Model.rb +501 -446
  53. data/lib/openstudio-standards/prototypes/Prototype.Model.swh.rb +221 -230
  54. data/lib/openstudio-standards/prototypes/Prototype.add_objects.rb +0 -2
  55. data/lib/openstudio-standards/prototypes/Prototype.full_service_restaurant.rb +130 -137
  56. data/lib/openstudio-standards/prototypes/Prototype.high_rise_apartment.rb +374 -291
  57. data/lib/openstudio-standards/prototypes/Prototype.hospital.rb +146 -193
  58. data/lib/openstudio-standards/prototypes/Prototype.hvac_systems.rb +1315 -1113
  59. data/lib/openstudio-standards/prototypes/Prototype.large_hotel.rb +65 -88
  60. data/lib/openstudio-standards/prototypes/Prototype.large_office.rb +101 -156
  61. data/lib/openstudio-standards/prototypes/Prototype.medium_office.rb +46 -96
  62. data/lib/openstudio-standards/prototypes/Prototype.mid_rise_apartment.rb +113 -123
  63. data/lib/openstudio-standards/prototypes/Prototype.outpatient.rb +356 -345
  64. data/lib/openstudio-standards/prototypes/Prototype.primary_school.rb +48 -103
  65. data/lib/openstudio-standards/prototypes/Prototype.quick_service_restaurant.rb +115 -123
  66. data/lib/openstudio-standards/prototypes/Prototype.retail_standalone.rb +30 -39
  67. data/lib/openstudio-standards/prototypes/Prototype.retail_stripmall.rb +32 -45
  68. data/lib/openstudio-standards/prototypes/Prototype.secondary_school.rb +98 -258
  69. data/lib/openstudio-standards/prototypes/Prototype.small_hotel.rb +429 -474
  70. data/lib/openstudio-standards/prototypes/Prototype.small_office.rb +28 -36
  71. data/lib/openstudio-standards/prototypes/Prototype.strip_model.rb +7 -7
  72. data/lib/openstudio-standards/prototypes/Prototype.utilities.rb +172 -146
  73. data/lib/openstudio-standards/prototypes/Prototype.warehouse.rb +46 -53
  74. data/lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb +885 -707
  75. data/lib/openstudio-standards/standards/Standards.AirTerminalSingleDuctParallelPIUReheat.rb +48 -57
  76. data/lib/openstudio-standards/standards/Standards.AirTerminalSingleDuctVAVReheat.rb +24 -31
  77. data/lib/openstudio-standards/standards/Standards.BoilerHotWater.rb +80 -93
  78. data/lib/openstudio-standards/standards/Standards.BuildingStory.rb +69 -0
  79. data/lib/openstudio-standards/standards/Standards.ChillerElectricEIR.rb +60 -72
  80. data/lib/openstudio-standards/standards/Standards.CoilCoolingDXMultiSpeed.rb +104 -108
  81. data/lib/openstudio-standards/standards/Standards.CoilCoolingDXSingleSpeed.rb +190 -198
  82. data/lib/openstudio-standards/standards/Standards.CoilCoolingDXTwoSpeed.rb +134 -146
  83. data/lib/openstudio-standards/standards/Standards.CoilHeatingDXMultiSpeed.rb +56 -60
  84. data/lib/openstudio-standards/standards/Standards.CoilHeatingDXSingleSpeed.rb +151 -161
  85. data/lib/openstudio-standards/standards/Standards.CoilHeatingGasMultiStage.rb +30 -34
  86. data/lib/openstudio-standards/standards/Standards.Construction.rb +116 -132
  87. data/lib/openstudio-standards/standards/Standards.CoolingTower.rb +138 -0
  88. data/lib/openstudio-standards/standards/Standards.CoolingTowerSingleSpeed.rb +11 -0
  89. data/lib/openstudio-standards/standards/Standards.CoolingTowerTwoSpeed.rb +11 -0
  90. data/lib/openstudio-standards/standards/Standards.CoolingTowerVariableSpeed.rb +16 -0
  91. data/lib/openstudio-standards/standards/Standards.Fan.rb +190 -236
  92. data/lib/openstudio-standards/standards/Standards.FanConstantVolume.rb +0 -2
  93. data/lib/openstudio-standards/standards/Standards.FanOnOff.rb +0 -2
  94. data/lib/openstudio-standards/standards/Standards.FanVariableVolume.rb +168 -14
  95. data/lib/openstudio-standards/standards/Standards.FanZoneExhaust.rb +0 -2
  96. data/lib/openstudio-standards/standards/Standards.HeaderedPumpsConstantSpeed.rb +33 -0
  97. data/lib/openstudio-standards/standards/Standards.HeaderedPumpsVariableSpeed.rb +83 -0
  98. data/lib/openstudio-standards/standards/Standards.HeatExchangerSensLat.rb +22 -0
  99. data/lib/openstudio-standards/standards/Standards.Model.rb +2385 -1622
  100. data/lib/openstudio-standards/standards/Standards.PlanarSurface.rb +83 -35
  101. data/lib/openstudio-standards/standards/Standards.PlantLoop.rb +805 -395
  102. data/lib/openstudio-standards/standards/Standards.Pump.rb +139 -119
  103. data/lib/openstudio-standards/standards/Standards.PumpConstantSpeed.rb +0 -2
  104. data/lib/openstudio-standards/standards/Standards.PumpVariableSpeed.rb +16 -15
  105. data/lib/openstudio-standards/standards/Standards.ScheduleCompact.rb +35 -0
  106. data/lib/openstudio-standards/standards/Standards.ScheduleConstant.rb +7 -13
  107. data/lib/openstudio-standards/standards/Standards.ScheduleRuleset.rb +144 -59
  108. data/lib/openstudio-standards/standards/Standards.Space.rb +1509 -1326
  109. data/lib/openstudio-standards/standards/Standards.SpaceType.rb +254 -262
  110. data/lib/openstudio-standards/standards/Standards.SubSurface.rb +105 -105
  111. data/lib/openstudio-standards/standards/Standards.Surface.rb +27 -31
  112. data/lib/openstudio-standards/standards/Standards.ThermalZone.rb +882 -157
  113. data/lib/openstudio-standards/standards/Standards.WaterHeaterMixed.rb +179 -69
  114. data/lib/openstudio-standards/standards/Standards.ZoneHVACComponent.rb +75 -0
  115. data/lib/openstudio-standards/utilities/logging.rb +31 -38
  116. data/lib/openstudio-standards/utilities/simulation.rb +118 -82
  117. data/lib/openstudio-standards/version.rb +1 -1
  118. data/lib/openstudio-standards/weather/Weather.Model.rb +382 -390
  119. data/lib/openstudio-standards/weather/Weather.stat_file.rb +159 -78
  120. metadata +59 -6
@@ -1,50 +1,48 @@
1
1
 
2
2
  # open the class to add methods to return sizing values
3
3
  class OpenStudio::Model::CoilHeatingGasMultiStage
4
-
5
- def setStandardEfficiencyAndCurves(template, standards)
6
-
4
+ def apply_efficiency_and_curves(template, standards)
7
5
  successfully_set_all_properties = true
8
-
6
+
9
7
  # Get the coil capacity
10
8
  capacity_w = nil
11
- htg_stages = self.stages
9
+ htg_stages = stages
12
10
  if htg_stages.last.nominalCapacity.is_initialized
13
11
  capacity_w = htg_stages.last.nominalCapacity.get
14
- elsif self.autosizedStage4NominalCapacity.is_initialized
15
- capacity_w = self.autosizedStage4NominalCapacity.get
12
+ elsif autosizedStage4NominalCapacity.is_initialized
13
+ capacity_w = autosizedStage4NominalCapacity.get
16
14
  else
17
- OpenStudio::logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXMultiSpeed', "For #{self.name} capacity is not available, cannot apply efficiency standard.")
15
+ OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilCoolingDXMultiSpeed', "For #{name} capacity is not available, cannot apply efficiency standard.")
18
16
  successfully_set_all_properties = false
19
17
  return successfully_set_all_properties
20
- end
18
+ end
21
19
 
22
20
  # Set number of stages for NECB 2011
23
- if(template == 'NECB 2011')
24
- num_stages = (capacity_w/(66.0*1000.0)+0.5).round
25
- num_stages = [num_stages,4].min
21
+ if template == 'NECB 2011'
22
+ num_stages = (capacity_w / (66.0 * 1000.0) + 0.5).round
23
+ num_stages = [num_stages, 4].min
26
24
  stage_cap = []
27
- if(num_stages == 1)
28
- stage_cap[0] = capacity_w/2.0
29
- stage_cap[1] = 2.0*stage_cap[0]
30
- stage_cap[2] = stage_cap[1]+0.1
31
- stage_cap[3] = stage_cap[2]+0.1
25
+ if num_stages == 1
26
+ stage_cap[0] = capacity_w / 2.0
27
+ stage_cap[1] = 2.0 * stage_cap[0]
28
+ stage_cap[2] = stage_cap[1] + 0.1
29
+ stage_cap[3] = stage_cap[2] + 0.1
32
30
  else
33
- stage_cap[0] = 66.0*1000.0
34
- stage_cap[1] = 2.0*stage_cap[0]
35
- if(num_stages == 2)
36
- stage_cap[2] = stage_cap[1]+0.1
37
- stage_cap[3] = stage_cap[2]+0.1
38
- elsif(num_stages == 3)
39
- stage_cap[2] = 3.0*stage_cap[0]
40
- stage_cap[3] = stage_cap[2]+0.1
41
- elsif(num_stages == 4)
42
- stage_cap[2] = 3.0*stage_cap[0]
43
- stage_cap[3] = 4.0*stage_cap[0]
31
+ stage_cap[0] = 66.0 * 1000.0
32
+ stage_cap[1] = 2.0 * stage_cap[0]
33
+ if num_stages == 2
34
+ stage_cap[2] = stage_cap[1] + 0.1
35
+ stage_cap[3] = stage_cap[2] + 0.1
36
+ elsif num_stages == 3
37
+ stage_cap[2] = 3.0 * stage_cap[0]
38
+ stage_cap[3] = stage_cap[2] + 0.1
39
+ elsif num_stages == 4
40
+ stage_cap[2] = 3.0 * stage_cap[0]
41
+ stage_cap[3] = 4.0 * stage_cap[0]
44
42
  end
45
43
  end
46
44
  # set capacities, flow rates, and sensible heat ratio for stages
47
- for istage in 0..3
45
+ (0..3).each do |istage|
48
46
  htg_stages[istage].setNominalCapacity(stage_cap[istage])
49
47
  end
50
48
  # PLF vs PLR curve
@@ -52,14 +50,12 @@ class OpenStudio::Model::CoilHeatingGasMultiStage
52
50
  end
53
51
 
54
52
  # plf vs plr curve for furnace
55
- furnace_plffplr_curve = self.model.add_curve(furnace_plffplr_curve_name, standards)
53
+ furnace_plffplr_curve = model.add_curve(furnace_plffplr_curve_name, standards)
56
54
  if furnace_plffplr_curve
57
- self.setPartLoadFractionCorrelationCurve(furnace_plffplr_curve)
55
+ setPartLoadFractionCorrelationCurve(furnace_plffplr_curve)
58
56
  else
59
- OpenStudio::logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingGasMultiStage', "For #{self.name}, cannot find plffplr curve, will not be set.")
57
+ OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.CoilHeatingGasMultiStage', "For #{name}, cannot find plffplr curve, will not be set.")
60
58
  successfully_set_all_properties = false
61
59
  end
62
-
63
60
  end
64
-
65
61
  end
@@ -1,75 +1,71 @@
1
1
 
2
2
  # Reopen the OpenStudio class to add methods to apply standards to this object
3
3
  class OpenStudio::Model::Construction
4
-
5
4
  # Sets the U-value of a construction to a specified value
6
5
  # by modifying the thickness of the insulation layer.
7
6
  #
8
7
  # @param target_u_value_ip [Double] U-Value (Btu/ft^2*hr*R)
9
8
  # @param insulation_layer_name [String] The name of the insulation layer in this construction
10
- # @param intended_surface_type [String]
11
- # Valid choices: 'AtticFloor', 'AtticWall', 'AtticRoof', 'DemisingFloor', 'InteriorFloor', 'InteriorCeiling',
9
+ # @param intended_surface_type [String]
10
+ # Valid choices: 'AtticFloor', 'AtticWall', 'AtticRoof', 'DemisingFloor', 'InteriorFloor', 'InteriorCeiling',
12
11
  # 'DemisingWall', 'InteriorWall', 'InteriorPartition', 'InteriorWindow', 'InteriorDoor', 'DemisingRoof',
13
- # 'ExteriorRoof', 'Skylight', 'TubularDaylightDome', 'TubularDaylightDiffuser', 'ExteriorFloor',
12
+ # 'ExteriorRoof', 'Skylight', 'TubularDaylightDome', 'TubularDaylightDiffuser', 'ExteriorFloor',
14
13
  # 'ExteriorWall', 'ExteriorWindow', 'ExteriorDoor', 'GlassDoor', 'OverheadDoor', 'GroundContactFloor',
15
14
  # 'GroundContactWall', 'GroundContactRoof'
16
15
  # @param target_includes_film_coefficients [Bool] if true, subtracts off standard film coefficients from your
17
- # target_u_value before modifying insulation thickness. Film values from 90.1-2010 A9.4.1 Air Films
16
+ # target_u_value before modifying insulation thickness. Film values from 90.1-2010 A9.4.1 Air Films
18
17
  # @return [Bool] returns true if successful, false if not
19
18
  # @todo Put in Phlyroy's logic for inferring the insulation layer of a construction
20
- def set_u_value(target_u_value_ip, insulation_layer_name = nil, intended_surface_type = 'ExteriorWall', target_includes_film_coefficients = true)
21
-
22
- OpenStudio::logFree(OpenStudio::Debug, 'openstudio.standards.ConstructionBase', "Setting U-Value for #{self.name}.")
23
-
19
+ def set_u_value(target_u_value_ip, insulation_layer_name = nil, intended_surface_type = 'ExteriorWall', target_includes_film_coefficients = true)
20
+ OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.ConstructionBase', "Setting U-Value for #{name}.")
21
+
24
22
  # Skip fenestration constructions
25
- if self.isFenestration
26
- OpenStudio::logFree(OpenStudio::Warn, 'openstudio.standards.ConstructionBase', "Can only set the u-value of opaque constructions. #{self.name} is not opaque.")
23
+ if isFenestration
24
+ OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.ConstructionBase', "Can only set the u-value of opaque constructions. #{name} is not opaque.")
27
25
  return false
28
26
  end
29
-
27
+
30
28
  # Make sure an insulation layer was specified
31
29
  if insulation_layer_name.nil? && target_u_value_ip == 0.0
32
30
  # Do nothing if the construction already doesn't have an insulation layer
33
31
  elsif insulation_layer_name.nil?
34
- OpenStudio::logFree(OpenStudio::Error, 'openstudio.standards.ConstructionBase', "Requested U-value of #{target_u_value_ip} for #{self.name}, but this construction has no insulation layer specified. Requested U-value will not be set.")
32
+ OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.ConstructionBase', "Requested U-value of #{target_u_value_ip} for #{name}, but this construction has no insulation layer specified. Requested U-value will not be set.")
35
33
  return false
36
- else
37
- # TODO put in Phlyroy's logic for inferring the insulation layer of a construction
38
- end
39
-
40
- # Remove the insulation layer if the specified U-value is zero.
34
+ end
35
+
36
+ # Remove the insulation layer if the specified U-value is zero.
41
37
  if target_u_value_ip == 0.0
42
38
  layer_index = 0
43
- self.layers.each do |layer|
39
+ layers.each do |layer|
44
40
  break if layer.name.get == insulation_layer_name
45
41
  layer_index += 1
46
42
  end
47
- self.eraseLayer(layer_index)
43
+ eraseLayer(layer_index)
48
44
  return true
49
45
  end
50
-
46
+
51
47
  # Convert the target U-value to SI
52
48
  target_u_value_ip = target_u_value_ip.to_f
53
- target_r_value_ip = 1.0/target_u_value_ip
54
-
49
+ target_r_value_ip = 1.0 / target_u_value_ip
50
+
55
51
  target_u_value_si = OpenStudio.convert(target_u_value_ip, 'Btu/ft^2*hr*R', 'W/m^2*K').get
56
- target_r_value_si = 1.0/target_u_value_si
57
-
58
- OpenStudio::logFree(OpenStudio::Debug, 'openstudio.standards.ConstructionBase', "#{self.name}.")
59
- OpenStudio::logFree(OpenStudio::Debug, 'openstudio.standards.ConstructionBase', "---target_u_value_ip = #{target_u_value_ip.round(3)} for #{self.name}.")
60
- OpenStudio::logFree(OpenStudio::Debug, 'openstudio.standards.ConstructionBase', "---target_r_value_ip = #{target_r_value_ip.round(2)} for #{self.name}.")
61
- OpenStudio::logFree(OpenStudio::Debug, 'openstudio.standards.ConstructionBase', "---target_u_value_si = #{target_u_value_si.round(3)} for #{self.name}.")
62
- OpenStudio::logFree(OpenStudio::Debug, 'openstudio.standards.ConstructionBase', "---target_r_value_si = #{target_r_value_si.round(2)} for #{self.name}.")
63
-
52
+ target_r_value_si = 1.0 / target_u_value_si
53
+
54
+ OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.ConstructionBase', "#{name}.")
55
+ OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.ConstructionBase', "---target_u_value_ip = #{target_u_value_ip.round(3)} for #{name}.")
56
+ OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.ConstructionBase', "---target_r_value_ip = #{target_r_value_ip.round(2)} for #{name}.")
57
+ OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.ConstructionBase', "---target_u_value_si = #{target_u_value_si.round(3)} for #{name}.")
58
+ OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.ConstructionBase', "---target_r_value_si = #{target_r_value_si.round(2)} for #{name}.")
59
+
64
60
  # Determine the R-value of the non-insulation layers
65
61
  other_layer_r_value_si = 0.0
66
- self.layers.each do |layer|
62
+ layers.each do |layer|
67
63
  next if layer.to_OpaqueMaterial.empty?
68
64
  next if layer.name.get == insulation_layer_name
69
65
  other_layer_r_value_si += layer.to_OpaqueMaterial.get.thermalResistance
70
66
  end
71
67
 
72
- # todo - remove code below and use film_coefficients_u_value method instead
68
+ # TODO: - remove code below and use film_coefficients_u_value method instead
73
69
  # Determine the R-value of the air films, if requested
74
70
  # Film values from 90.1-2010 A9.4.1 Air Films
75
71
  if target_includes_film_coefficients
@@ -124,13 +120,13 @@ class OpenStudio::Model::Construction
124
120
  # This is the desired R-value of the insulation.
125
121
  ins_r_value_si = target_r_value_si - other_layer_r_value_si
126
122
  if ins_r_value_si <= 0.0
127
- OpenStudio::logFree(OpenStudio::Warn, 'openstudio.standards.ConstructionBase', "Requested U-value of #{target_u_value_ip} for #{self.name} is too low given the other materials in the construction; insulation layer will not be modified.")
123
+ OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.ConstructionBase', "Requested U-value of #{target_u_value_ip} for #{name} is too low given the other materials in the construction; insulation layer will not be modified.")
128
124
  return false
129
125
  end
130
126
  ins_r_value_ip = OpenStudio.convert(ins_r_value_si, 'm^2*K/W', 'ft^2*h*R/Btu').get
131
-
127
+
132
128
  # Set the R-value of the insulation layer
133
- self.layers.each do |layer|
129
+ layers.each do |layer|
134
130
  next unless layer.name.get == insulation_layer_name
135
131
  if layer.to_StandardOpaqueMaterial.is_initialized
136
132
  layer = layer.to_StandardOpaqueMaterial.get
@@ -150,69 +146,66 @@ class OpenStudio::Model::Construction
150
146
  break # Stop looking for the insulation layer once found
151
147
  end
152
148
  end
153
-
149
+
154
150
  # Modify the construction name
155
- self.setName("#{self.name} R-#{target_r_value_ip.round(2)}")
156
-
151
+ setName("#{name} R-#{target_r_value_ip.round(2)}")
152
+
157
153
  return true
158
-
159
154
  end
160
155
 
161
156
  # Set the F-Factor of a slab to a specified value.
162
157
  # Assumes an unheated, fully insulated slab, and modifies
163
- # the insulation layer according to the values from 90.1-2004
158
+ # the insulation layer according to the values from 90.1-2004
164
159
  # Table A6.3 Assembly F-Factors for Slab-on-Grade Floors.
165
160
  #
166
161
  # @param target_f_factor_ip [Double] F-Factor
167
162
  # @param insulation_layer_name [String] The name of the insulation layer in this construction
168
163
  # @return [Bool] returns true if successful, false if not
169
164
  def set_slab_f_factor(target_f_factor_ip, insulation_layer_name = nil)
170
-
171
165
  # Regression from table A6.3 unheated, fully insulated slab
172
166
  r_value_ip = 1.0248 * target_f_factor_ip**-2.186
173
- u_value_ip = 1.0/r_value_ip
174
-
167
+ u_value_ip = 1.0 / r_value_ip
168
+
175
169
  # Set the insulation U-value
176
170
  set_u_value(u_value_ip, insulation_layer_name, 'GroundContactFloor', true)
177
-
171
+
178
172
  # Modify the construction name
179
- self.setName("#{self.name} F-#{target_f_factor_ip.round(3)}")
180
-
173
+ setName("#{name} F-#{target_f_factor_ip.round(3)}")
174
+
181
175
  return true
182
-
183
176
  end
184
177
 
185
178
  # Set the C-Factor of an underground wall to a specified value.
186
179
  # Assumes continuous exterior insulation and modifies
187
- # the insulation layer according to the values from 90.1-2004
180
+ # the insulation layer according to the values from 90.1-2004
188
181
  # Table A4.2 Assembly C-Factors for Below-Grade walls.
189
182
  #
190
183
  # @param target_c_factor_ip [Double] C-Factor
191
184
  # @param insulation_layer_name [String] The name of the insulation layer in this construction
192
185
  # @return [Bool] returns true if successful, false if not
193
186
  def set_underground_wall_c_factor(target_c_factor_ip, insulation_layer_name = nil)
194
-
195
187
  # Regression from table A4.2 continuous exterior insulation
196
188
  r_value_ip = 0.775 * target_c_factor_ip**-1.067
197
- u_value_ip = 1.0/r_value_ip
198
-
189
+ u_value_ip = 1.0 / r_value_ip
190
+
199
191
  # Set the insulation U-value
200
192
  set_u_value(u_value_ip, insulation_layer_name, 'GroundContactWall', true)
201
-
193
+
202
194
  # Modify the construction name
203
- self.setName("#{self.name} C-#{target_c_factor_ip.round(3)}")
204
-
195
+ setName("#{name} C-#{target_c_factor_ip.round(3)}")
196
+
205
197
  return true
206
-
207
198
  end
208
199
 
200
+ # Get the SHGC as calculated by EnergyPlus.
201
+ # Only applies to fenestration constructions.
202
+ # @return [Double] the SHGC as a decimal.
209
203
  def calculated_solar_heat_gain_coefficient
210
-
211
- construction_name = self.name.get.to_s
204
+ construction_name = name.get.to_s
212
205
 
213
206
  shgc = nil
214
207
 
215
- sql = self.model.sqlFile
208
+ sql = model.sqlFile
216
209
 
217
210
  if sql.is_initialized
218
211
  sql = sql.get
@@ -229,7 +222,7 @@ class OpenStudio::Model::Construction
229
222
  if row_id.is_initialized
230
223
  row_id = row_id.get
231
224
  else
232
- OpenStudio::logFree(OpenStudio::Warn, "openstudio.model.Model", "SHGC row ID not found for construction: #{construction_name}.")
225
+ OpenStudio.logFree(OpenStudio::Warn, 'openstudio.model.Model', "SHGC row ID not found for construction: #{construction_name}.")
233
226
  row_id = 9999
234
227
  end
235
228
 
@@ -241,32 +234,28 @@ class OpenStudio::Model::Construction
241
234
  AND ColumnName='Glass SHGC'
242
235
  AND RowName='#{row_id}'"
243
236
 
244
-
245
237
  shgc = sql.execAndReturnFirstDouble(shgc_query)
246
238
 
247
- if shgc.is_initialized
248
- shgc = shgc.get
249
- else
250
- shgc = nil
251
- end
239
+ shgc = if shgc.is_initialized
240
+ shgc.get
241
+ end
252
242
 
253
243
  else
254
- OpenStudio::logFree(OpenStudio::Error, 'openstudio.standards.Construction', 'Model has no sql file containing results, cannot lookup data.')
244
+ OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.Construction', 'Model has no sql file containing results, cannot lookup data.')
255
245
  end
256
246
 
257
247
  return shgc
258
-
259
248
  end
260
249
 
261
- # Get the VT as calculated by EnergyPlus
262
- #
250
+ # Get the VT as calculated by EnergyPlus.
251
+ # Only applies to fenestration constructions.
252
+ # @return [Double] the visible transmittance as a decimal.
263
253
  def calculated_visible_transmittance
264
-
265
- construction_name = self.name.get.to_s
254
+ construction_name = name.get.to_s
266
255
 
267
256
  vt = nil
268
257
 
269
- sql = self.model.sqlFile
258
+ sql = model.sqlFile
270
259
 
271
260
  if sql.is_initialized
272
261
  sql = sql.get
@@ -283,7 +272,7 @@ class OpenStudio::Model::Construction
283
272
  if row_id.is_initialized
284
273
  row_id = row_id.get
285
274
  else
286
- OpenStudio::logFree(OpenStudio::Warn, "openstudio.model.Model", "VT row ID not found for construction: #{construction_name}.")
275
+ OpenStudio.logFree(OpenStudio::Warn, 'openstudio.model.Model', "VT row ID not found for construction: #{construction_name}.")
287
276
  row_id = 9999
288
277
  end
289
278
 
@@ -295,32 +284,28 @@ class OpenStudio::Model::Construction
295
284
  AND ColumnName='Glass Visible Transmittance'
296
285
  AND RowName='#{row_id}'"
297
286
 
298
-
299
287
  vt = sql.execAndReturnFirstDouble(vt_query)
300
288
 
301
- if vt.is_initialized
302
- vt = vt.get
303
- else
304
- vt = nil
305
- end
289
+ vt = if vt.is_initialized
290
+ vt.get
291
+ end
306
292
 
307
293
  else
308
- OpenStudio::logFree(OpenStudio::Error, 'openstudio.standards.Space', 'Model has no sql file containing results, cannot lookup data.')
294
+ OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.Space', 'Model has no sql file containing results, cannot lookup data.')
309
295
  end
310
296
 
311
297
  return vt
312
-
313
298
  end
314
299
 
315
- # Get the U-Factor as calculated by EnergyPlus
316
- # in W/m^2*K
300
+ # Get the U-Factor as calculated by EnergyPlus.
301
+ # Only applies to fenestration constructions.
302
+ # @return [Double] the U-Factor in W/m^2*K.
317
303
  def calculated_u_factor
318
-
319
- construction_name = self.name.get.to_s
304
+ construction_name = name.get.to_s
320
305
 
321
306
  u_factor_w_per_m2_k = nil
322
307
 
323
- sql = self.model.sqlFile
308
+ sql = model.sqlFile
324
309
 
325
310
  if sql.is_initialized
326
311
  sql = sql.get
@@ -337,7 +322,7 @@ class OpenStudio::Model::Construction
337
322
  if row_id.is_initialized
338
323
  row_id = row_id.get
339
324
  else
340
- OpenStudio::logFree(OpenStudio::Warn, "openstudio.model.Model", "U-Factor row ID not found for construction: #{construction_name}.")
325
+ OpenStudio.logFree(OpenStudio::Warn, 'openstudio.model.Model', "U-Factor row ID not found for construction: #{construction_name}.")
341
326
  row_id = 9999
342
327
  end
343
328
 
@@ -349,27 +334,29 @@ class OpenStudio::Model::Construction
349
334
  AND ColumnName='Glass U-Factor'
350
335
  AND RowName='#{row_id}'"
351
336
 
352
-
353
337
  u_factor_w_per_m2_k = sql.execAndReturnFirstDouble(u_factor_query)
354
338
 
355
- if u_factor_w_per_m2_k.is_initialized
356
- u_factor_w_per_m2_k = u_factor_w_per_m2_k.get
357
- else
358
- u_factor_w_per_m2_k = nil
359
- end
339
+ u_factor_w_per_m2_k = if u_factor_w_per_m2_k.is_initialized
340
+ u_factor_w_per_m2_k.get
341
+ end
360
342
 
361
343
  else
362
- OpenStudio::logFree(OpenStudio::Error, 'openstudio.standards.Space', 'Model has no sql file containing results, cannot lookup data.')
344
+ OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.Space', 'Model has no sql file containing results, cannot lookup data.')
363
345
  end
364
346
 
365
347
  return u_factor_w_per_m2_k
366
-
367
348
  end
368
349
 
369
- # @param intended_surface_type [string]
370
- # @return u value [double]
350
+ # Returns the R-value of the combined inside and outside
351
+ # air film values from 90.1-2010 A9.4.1 Air Films
352
+ # @param intended_surface_type [String]
353
+ # Valid choices: 'AtticFloor', 'AtticWall', 'AtticRoof', 'DemisingFloor', 'InteriorFloor', 'InteriorCeiling',
354
+ # 'DemisingWall', 'InteriorWall', 'InteriorPartition', 'InteriorWindow', 'InteriorDoor', 'DemisingRoof',
355
+ # 'ExteriorRoof', 'Skylight', 'TubularDaylightDome', 'TubularDaylightDiffuser', 'ExteriorFloor',
356
+ # 'ExteriorWall', 'ExteriorWindow', 'ExteriorDoor', 'GlassDoor', 'OverheadDoor', 'GroundContactFloor',
357
+ # 'GroundContactWall', 'GroundContactRoof'
358
+ # @return [double] r-value in m^2*K/W.
371
359
  def film_coefficients_r_value(intended_surface_type)
372
-
373
360
  other_layer_r_value_si = 0.0
374
361
 
375
362
  # Determine the R-value of the air films, if requested
@@ -387,41 +374,38 @@ class OpenStudio::Model::Construction
387
374
  fil_int_surf_vertical_r_si = OpenStudio.convert(fil_int_surf_vertical_r_ip, 'ft^2*hr*R/Btu', 'm^2*K/W').get
388
375
 
389
376
  case intended_surface_type
390
- when 'AtticFloor'
391
- other_layer_r_value_si += film_int_surf_ht_flow_up_r_si # Outside
392
- other_layer_r_value_si += film_semi_ext_surf_r_si # Inside
393
- when 'AtticWall', 'AtticRoof'
394
- other_layer_r_value_si += film_ext_surf_r_si # Outside
395
- other_layer_r_value_si += film_semi_ext_surf_r_si # Inside
396
- when 'DemisingFloor', 'InteriorFloor'
397
- other_layer_r_value_si += film_int_surf_ht_flow_up_r_si # Outside
398
- other_layer_r_value_si += film_int_surf_ht_flow_dwn_r_si # Inside
399
- when 'InteriorCeiling'
400
- other_layer_r_value_si += film_int_surf_ht_flow_dwn_r_si # Outside
401
- other_layer_r_value_si += film_int_surf_ht_flow_up_r_si # Inside
402
- when 'DemisingWall', 'InteriorWall', 'InteriorPartition', 'InteriorWindow', 'InteriorDoor'
403
- other_layer_r_value_si += fil_int_surf_vertical_r_si # Outside
404
- other_layer_r_value_si += fil_int_surf_vertical_r_si # Inside
405
- when 'DemisingRoof', 'ExteriorRoof', 'Skylight', 'TubularDaylightDome', 'TubularDaylightDiffuser'
406
- other_layer_r_value_si += film_ext_surf_r_si # Outside
407
- other_layer_r_value_si += film_int_surf_ht_flow_up_r_si # Inside
408
- when 'ExteriorFloor'
409
- other_layer_r_value_si += film_ext_surf_r_si # Outside
410
- other_layer_r_value_si += film_int_surf_ht_flow_dwn_r_si # Inside
411
- when 'ExteriorWall', 'ExteriorWindow', 'ExteriorDoor', 'GlassDoor', 'OverheadDoor'
412
- other_layer_r_value_si += film_ext_surf_r_si # Outside
413
- other_layer_r_value_si += fil_int_surf_vertical_r_si # Inside
414
- when 'GroundContactFloor'
415
- other_layer_r_value_si += film_int_surf_ht_flow_dwn_r_si # Inside
416
- when 'GroundContactWall'
417
- other_layer_r_value_si += fil_int_surf_vertical_r_si # Inside
418
- when 'GroundContactRoof'
419
- other_layer_r_value_si += film_int_surf_ht_flow_up_r_si # Inside
377
+ when 'AtticFloor'
378
+ other_layer_r_value_si += film_int_surf_ht_flow_up_r_si # Outside
379
+ other_layer_r_value_si += film_semi_ext_surf_r_si # Inside
380
+ when 'AtticWall', 'AtticRoof'
381
+ other_layer_r_value_si += film_ext_surf_r_si # Outside
382
+ other_layer_r_value_si += film_semi_ext_surf_r_si # Inside
383
+ when 'DemisingFloor', 'InteriorFloor'
384
+ other_layer_r_value_si += film_int_surf_ht_flow_up_r_si # Outside
385
+ other_layer_r_value_si += film_int_surf_ht_flow_dwn_r_si # Inside
386
+ when 'InteriorCeiling'
387
+ other_layer_r_value_si += film_int_surf_ht_flow_dwn_r_si # Outside
388
+ other_layer_r_value_si += film_int_surf_ht_flow_up_r_si # Inside
389
+ when 'DemisingWall', 'InteriorWall', 'InteriorPartition', 'InteriorWindow', 'InteriorDoor'
390
+ other_layer_r_value_si += fil_int_surf_vertical_r_si # Outside
391
+ other_layer_r_value_si += fil_int_surf_vertical_r_si # Inside
392
+ when 'DemisingRoof', 'ExteriorRoof', 'Skylight', 'TubularDaylightDome', 'TubularDaylightDiffuser'
393
+ other_layer_r_value_si += film_ext_surf_r_si # Outside
394
+ other_layer_r_value_si += film_int_surf_ht_flow_up_r_si # Inside
395
+ when 'ExteriorFloor'
396
+ other_layer_r_value_si += film_ext_surf_r_si # Outside
397
+ other_layer_r_value_si += film_int_surf_ht_flow_dwn_r_si # Inside
398
+ when 'ExteriorWall', 'ExteriorWindow', 'ExteriorDoor', 'GlassDoor', 'OverheadDoor'
399
+ other_layer_r_value_si += film_ext_surf_r_si # Outside
400
+ other_layer_r_value_si += fil_int_surf_vertical_r_si # Inside
401
+ when 'GroundContactFloor'
402
+ other_layer_r_value_si += film_int_surf_ht_flow_dwn_r_si # Inside
403
+ when 'GroundContactWall'
404
+ other_layer_r_value_si += fil_int_surf_vertical_r_si # Inside
405
+ when 'GroundContactRoof'
406
+ other_layer_r_value_si += film_int_surf_ht_flow_up_r_si # Inside
420
407
  end
421
408
 
422
-
423
409
  return other_layer_r_value_si
424
-
425
410
  end
426
-
427
411
  end