Class: OpenStudio::Model::AirLoopHVAC

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

Overview

Reopen the OpenStudio class to add methods to apply standards to this object

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
# File 'lib/openstudio-standards/hvac_sizing/Siz.AirLoopHVAC.rb', line 13

def applySizingValues

  design_supply_air_flow_rate = self.autosizedDesignSupplyAirFlowRate
  if design_supply_air_flow_rate.is_initialized
    self.setDesignSupplyAirFlowRate(design_supply_air_flow_rate.get) 
  end
      
end

#autosizeObject

Sets all auto-sizeable fields to autosize



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

def autosize
  self.autosizeDesignSupplyAirFlowRate
end

#autosize621OutdoorAirIntakeFlowObject

Retrieve an airloop’s design outdoor air intake (Vot) Ideally, this would only be used to retrieve Vot when calculated by EnergyPlus’ built-in design VRP calculations



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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/openstudio-standards/hvac_sizing/Siz.AirLoopHVAC.rb', line 59

def autosize621OutdoorAirIntakeFlow
  flow_types = ['Heating', 'Cooling']
  flow_rates = []
  flow_types.each do |flow_type|
    result = OpenStudio::OptionalDouble.new
    name = self.name.get.upcase
    sql = self.model.sqlFile
    if sql.is_initialized
      sql = sql.get    
      query = "SELECT Value 
              FROM tabulardatawithstrings
              WHERE ReportName='Standard62.1Summary' 
              AND ReportForString='Entire Facility' 
              AND TableName='System Ventilation Requirements for #{flow_type}'
              AND ColumnName='Outdoor Air Intake Flow Vot'
              AND RowName='#{name}'
              AND Units='m3/s'"
      val = sql.execAndReturnFirstDouble(query)
      if val.is_initialized
        result = OpenStudio::OptionalDouble.new(val.get)
      end
      # Inconsistency in column name in EnergyPlus 9.0: 
      # "Outdoor Air Intake Flow - Vot" vs "Outdoor Air Intake Flow Vot"
      # The following could be deleted if the inconsistency was ever fixed
      if result.to_f == 0.0
        query = "SELECT Value 
        FROM tabulardatawithstrings
        WHERE ReportName='Standard62.1Summary' 
        AND ReportForString='Entire Facility' 
        AND TableName='System Ventilation Requirements for #{flow_type}'
        AND ColumnName='Outdoor Air Intake Flow - Vot'
        AND RowName='#{name}'
        AND Units='m3/s'"
        val = sql.execAndReturnFirstDouble(query)
        if val.is_initialized
          result = OpenStudio::OptionalDouble.new(val.get)
        end
      end
    else
      OpenStudio::logFree(OpenStudio::Error, 'openstudio.model.Model', 'Model has no sql file containing results, cannot lookup data.')
    end
    flow_rates << result.to_f
  end

  return flow_rates.max

end

#autosizedDesignSupplyAirFlowRateObject

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



23
24
25
26
27
# File 'lib/openstudio-standards/hvac_sizing/Siz.AirLoopHVAC.rb', line 23

def autosizedDesignSupplyAirFlowRate

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

#autosizeSumAirTerminalMaxAirFlowRateObject

Retrieve an airloop’s sum of air terminal maximum flow rates: sum(Vpz)



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
# File 'lib/openstudio-standards/hvac_sizing/Siz.AirLoopHVAC.rb', line 108

def autosizeSumAirTerminalMaxAirFlowRate
  result = OpenStudio::OptionalDouble.new
  name = self.name.get.upcase
  sql = self.model.sqlFile
  if sql.is_initialized
    sql = sql.get    
    query = "SELECT Value 
            FROM tabulardatawithstrings
            WHERE ReportName='ComponentSizingSummary' 
            AND ReportForString='Entire Facility' 
            AND TableName='AirLoopHVAC'
            AND ColumnName='Sum of Air Terminal Maximum Flow Rates'
            AND RowName='#{name}'
            AND Units='m3/s'"
    val = sql.execAndReturnFirstDouble(query)
    if val.is_initialized
      result = OpenStudio::OptionalDouble.new(val.get)
    end
  else
    OpenStudio::logFree(OpenStudio::Error, 'openstudio.model.Model', 'Model has no sql file containing results, cannot lookup data.')
  end

  return result.to_f

end

#autosizeSumMinimumHeatingAirFlowRatesObject

Retrieves an airloop sum of air terminal minimum heating flow rates: sum(Vpz_min)



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/openstudio-standards/hvac_sizing/Siz.AirLoopHVAC.rb', line 30

def autosizeSumMinimumHeatingAirFlowRates
  result = OpenStudio::OptionalDouble.new
  name = self.name.get.upcase
  sql = self.model.sqlFile
  if sql.is_initialized
    sql = sql.get    
    query = "SELECT Value 
            FROM tabulardatawithstrings
            WHERE ReportName='ComponentSizingSummary' 
            AND ReportForString='Entire Facility' 
            AND TableName='AirLoopHVAC'
            AND ColumnName='Sum of Air Terminal Minimum Heating Flow Rates'
            AND RowName='#{name}'
            AND Units='m3/s'"
    val = sql.execAndReturnFirstDouble(query)
    if val.is_initialized
      result = OpenStudio::OptionalDouble.new(val.get)
    end
  else
    OpenStudio::logFree(OpenStudio::Error, 'openstudio.model.Model', 'Model has no sql file containing results, cannot lookup data.')
  end

  return result.to_f

end