Class: OpenStudio::Model::ThermalZone

Inherits:
Object
  • Object
show all
Defined in:
lib/openstudio-standards/hvac_sizing/Siz.ThermalZone.rb

Overview

open the class to add methods to return sizing values

Instance Method Summary collapse

Instance Method Details

#applySizingValuesObject

Takes the values calculated by the EnergyPlus sizing routines and puts them into this object model in place of the autosized fields. Must have previously completed a run with sql output for this to work.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/openstudio-standards/hvac_sizing/Siz.ThermalZone.rb', line 13

def applySizingValues

  # In OpenStudio, the design OA flow rates are calculated by the
  # Controller:OutdoorAir object associated with this system.
  # Therefore, this property will be retrieved from that object's sizing values
  air_loop = self.airLoopHVAC
  if air_loop.airLoopHVACOutdoorAirSystem.is_initialized
    controller_oa = air_loop.airLoopHVACOutdoorAirSystem.get.getControllerOutdoorAir
    # get the max oa flow rate from the controller:outdoor air sizing
    maximum_outdoor_air_flow_rate = controller_oa.autosizedMaximumOutdoorAirFlowRate
    if maximum_outdoor_air_flow_rate.is_initialized
      self.setDesignOutdoorAirFlowRate(maximum_outdoor_air_flow_rate.get)
      # Set the OA flow method to "ZoneSum" to avoid severe errors
      # in the fully hard-sized model.
      self.setSystemOutdoorAirMethod("ZoneSum")
    end
  end
  
end

#autosizeObject

Sets all auto-sizeable fields to autosize



6
7
8
# File 'lib/openstudio-standards/hvac_sizing/Siz.ThermalZone.rb', line 6

def autosize
  self.autosizeDesignOutdoorAirFlowRate
end

#autosizedCoolingDesignAirFlowRateObject

returns the autosized cooling design air flow rate as an optional double



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/openstudio-standards/hvac_sizing/Siz.ThermalZone.rb', line 48

def autosizedCoolingDesignAirFlowRate

  result = OpenStudio::OptionalDouble.new

  name = self.name.get.upcase

  sql = self.model.sqlFile
  
  if sql.is_initialized
    sql = sql.get
  
    # In E+ 8.4, (OS 1.9.3 onward) the table name changed
    table_name = nil
    if self.model.version < OpenStudio::VersionString.new('1.9.3')
      table_name = 'Zone Cooling'
    else
      table_name = 'Zone Sensible Cooling'
    end  
  
    query = "SELECT Value 
            FROM tabulardatawithstrings
            WHERE ReportName='HVACSizingSummary' 
            AND ReportForString='Entire Facility' 
            AND TableName='#{table_name}'
            AND ColumnName='User Design Air Flow'
            AND RowName='#{name}'
            AND Units='m3/s'"

    val = sql.execAndReturnFirstDouble(query)
    
    if val.is_initialized
      result = OpenStudio::OptionalDouble.new(val.get)
    else
      #OpenStudio::logFree(OpenStudio::Warn, "openstudio.model.Model", "Data not found for query: #{query}")
    end

  else
    OpenStudio::logFree(OpenStudio::Error, 'openstudio.model.Model', 'Model has no sql file containing results, cannot lookup data.')
  end

  return result

end

#autosizedHeatingDesignAirFlowRateObject

returns the autosized heating design air flow rate as an optional double



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/openstudio-standards/hvac_sizing/Siz.ThermalZone.rb', line 93

def autosizedHeatingDesignAirFlowRate

  result = OpenStudio::OptionalDouble.new

  name = self.name.get.upcase

  sql = self.model.sqlFile
  
  if sql.is_initialized
    sql = sql.get
  
    # In E+ 8.4, (OS 1.9.3 onward) the table name changed
    table_name = nil
    if self.model.version < OpenStudio::VersionString.new('1.9.3')
      table_name = 'Zone Heating'
    else
      table_name = 'Zone Sensible Heating'
    end    
  
    query = "SELECT Value 
            FROM tabulardatawithstrings
            WHERE ReportName='HVACSizingSummary' 
            AND ReportForString='Entire Facility' 
            AND TableName='#{table_name}'
            AND ColumnName='User Design Air Flow'
            AND RowName='#{name}'
            AND Units='m3/s'"

    val = sql.execAndReturnFirstDouble(query)
    
    if val.is_initialized
      result = OpenStudio::OptionalDouble.new(val.get)
    else
      #OpenStudio::logFree(OpenStudio::Warn, "openstudio.model.Model", "Data not found for query: #{query}")
    end

  else
    OpenStudio::logFree(OpenStudio::Error, 'openstudio.model.Model', 'Model has no sql file containing results, cannot lookup data.')
  end

  return result

end

#autosizedMaximumOutdoorAirFlowRateObject

returns the autosized maximum outdoor air flow rate as an optional double



34
35
36
37
38
# File 'lib/openstudio-standards/hvac_sizing/Siz.ThermalZone.rb', line 34

def autosizedMaximumOutdoorAirFlowRate

  return self.model.getAutosizedValue(self, 'Maximum Outdoor Air Flow Rate', 'm3/s')
  
end

#autosizedMinimumOutdoorAirFlowRateObject

returns the autosized minimum outdoor air flow rate as an optional double



41
42
43
44
45
# File 'lib/openstudio-standards/hvac_sizing/Siz.ThermalZone.rb', line 41

def autosizedMinimumOutdoorAirFlowRate

  return self.model.getAutosizedValue(self, 'Minimum Outdoor Air Flow Rate', 'm3/s')
  
end

#cooling_fuelsObject

Determine the zone cooling fuels, including any fuels used by zone equipment, reheat terminals, the air loops serving the zone, and any plant loops serving those air loops.

return [Array<String>] An array. Possible values are Electricity, NaturalGas, PropaneGas, FuelOil#1, FuelOil#2, Coal, Diesel, Gasoline, DistrictCooling, DistrictHeating, and SolarEnergy.



284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
# File 'lib/openstudio-standards/hvac_sizing/Siz.ThermalZone.rb', line 284

def cooling_fuels

  fuels = []
  
  # Check the zone hvac cooling fuels
  fuels += self.model.zone_equipment_cooling_fuels(self)

  # Check the zone airloop cooling fuels
  fuels += self.model.zone_airloop_cooling_fuels(self)

  OpenStudio::logFree(OpenStudio::Debug, 'openstudio.model.Model', "For #{name}, cooling fuels = #{fuels.uniq.sort.join(', ')}.")

  return fuels.uniq.sort
  
end

#coolingDesignLoadObject

returns the calculated cooling design load as an optional double



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/openstudio-standards/hvac_sizing/Siz.ThermalZone.rb', line 138

def coolingDesignLoad

  result = OpenStudio::OptionalDouble.new

  name = self.name.get.upcase

  sql = self.model.sqlFile
  
  if sql.is_initialized
    sql = sql.get
  
    # In E+ 8.4, (OS 1.9.3 onward) the table name changed
    table_name = nil
    if self.model.version < OpenStudio::VersionString.new('1.9.3')
      table_name = 'Zone Cooling'
    else
      table_name = 'Zone Sensible Cooling'
    end    
  
    query = "SELECT Value 
            FROM tabulardatawithstrings
            WHERE ReportName='HVACSizingSummary' 
            AND ReportForString='Entire Facility' 
            AND TableName='#{table_name}'
            AND ColumnName='User Design Load'
            AND RowName='#{name}'
            AND Units='W'"

    val = sql.execAndReturnFirstDouble(query)
    
    if val.is_initialized
      floor_area_no_multiplier_m2 = self.floorArea
      floor_area_m2 = floor_area_no_multiplier_m2 * self.multiplier
      w_per_m2 = val.get/floor_area_m2
      result = OpenStudio::OptionalDouble.new(w_per_m2)
    else
      #OpenStudio::logFree(OpenStudio::Warn, "openstudio.model.Model", "Data not found for query: #{query}")
    end

  else
    OpenStudio::logFree(OpenStudio::Error, 'openstudio.model.Model', 'Model has no sql file containing results, cannot lookup data.')
  end

  return result  

end

#heating_fuelsObject

Determine the zone heating fuels, including any fuels used by zone equipment, reheat terminals, the air loops serving the zone, and any plant loops serving those air loops.

return [Array<String>] An array. Possible values are Electricity, NaturalGas, PropaneGas, FuelOil#1, FuelOil#2, Coal, Diesel, Gasoline, DistrictCooling, DistrictHeating, and SolarEnergy.



242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
# File 'lib/openstudio-standards/hvac_sizing/Siz.ThermalZone.rb', line 242

def heating_fuels

  fuels = []
  
  # Special logic for models imported from Sefaira.
  # In this case, the fuels are listed as a comment
  # above the Zone object.
  if !self.comment == ''
    m = self.comment.match /! *(.*)/
    if m
      all_fuels = m[1].split(',')
      all_fuels.each do |fuel|
        fuels += fuel.strip
      end
    end
    if fuels.size > 0
      OpenStudio::logFree(OpenStudio::Info, 'openstudio.model.Model', "For #{self.name}, fuel type #{fuels.join(', ')} pulled from Zone comment.")
      fuels.uniq.sort
    end
  end
  
  # Check the zone hvac heating fuels
  fuels += self.model.zone_equipment_heating_fuels(self)

  # Check the zone airloop heating fuels
  fuels += self.model.zone_airloop_heating_fuels(self)

  OpenStudio::logFree(OpenStudio::Debug, 'openstudio.model.Model', "For #{name}, heating fuels = #{fuels.uniq.sort.join(', ')}.")

  return fuels.uniq.sort
  
end

#heatingDesignLoadObject

returns the calculated heating design load as an optional double



186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/openstudio-standards/hvac_sizing/Siz.ThermalZone.rb', line 186

def heatingDesignLoad

  result = OpenStudio::OptionalDouble.new

  name = self.name.get.upcase

  sql = self.model.sqlFile
  
  if sql.is_initialized
    sql = sql.get
    
    # In E+ 8.4, (OS 1.9.3 onward) the table name changed
    table_name = nil
    if self.model.version < OpenStudio::VersionString.new('1.9.3')
      table_name = 'Zone Heating'
    else
      table_name = 'Zone Sensible Heating'
    end
    
    query = "SELECT Value 
            FROM tabulardatawithstrings
            WHERE ReportName='HVACSizingSummary' 
            AND ReportForString='Entire Facility' 
            AND TableName='#{table_name}'
            AND ColumnName='User Design Load'
            AND RowName='#{name}'
            AND Units='W'"

    val = sql.execAndReturnFirstDouble(query)
    
    if val.is_initialized
      floor_area_no_multiplier_m2 = self.floorArea
      floor_area_m2 = floor_area_no_multiplier_m2 * self.multiplier
      w_per_m2 = val.get/floor_area_m2
      result = OpenStudio::OptionalDouble.new(w_per_m2)
    else
      #OpenStudio::logFree(OpenStudio::Warn, "openstudio.model.Model", "Data not found for query: #{query}")
    end

  else
    OpenStudio::logFree(OpenStudio::Error, 'openstudio.model.Model', 'Model has no sql file containing results, cannot lookup data.')
  end

  return result  

end