Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I get those following codes from os_lib_reporting.rb file. Plesae give me some instruction for change them into SI unit of value and unit shown in result First type: # total building area query = 'SELECT Value FROM tabulardatawithstrings WHERE ' query << "ReportName='AnnualBuildingUtilityPerformanceSummary' and " # Notice no space in SystemSummary query << "ReportForString='Entire Facility' and " query << "TableName='Building Area' and " query << "RowName='Total Building Area' and " query << "ColumnName='Area' and " query << "Units='m2';" query_results = sqlFile.execAndReturnFirstDouble(query) if query_results.empty? runner.registerError('Did not find value for total building area.') return false else display = 'Total Building Area' source_units = 'm^2' target_units = 'ft^2' value = OpenStudio.convert(query_results.get, source_units, target_units).get value_neat = OpenStudio.toNeatString(value, 0, true) general_building_information[:data] << [display, value_neat, target_units] runner.registerValue(display, value, target_units)

Second type: # summary of what to show for each type of air loop component def self.air_loop_component_summary_logic(component, model) if component.to_AirLoopHVACOutdoorAirSystem.is_initialized component = component.to_AirLoopHVACOutdoorAirSystem.get # get ControllerOutdoorAir controller_oa = component.getControllerOutdoorAir

  sizing_source_units = 'm^3/s'
  sizing_target_units = 'cfm'
  if controller_oa.maximumOutdoorAirFlowRate.is_initialized
    sizing_ip = OpenStudio.convert(controller_oa.maximumOutdoorAirFlowRate.get, sizing_source_units, sizing_target_units).get
    sizing_ip_neat = OpenStudio.toNeatString(sizing_ip, 2, true)
  else
    sizing_ip_neat = 'Autosized'
  end
  value_source_units = 'm^3/s'
  value_target_units = 'cfm'
  if controller_oa.minimumOutdoorAirFlowRate.is_initialized
    value_ip = OpenStudio.convert(controller_oa.minimumOutdoorAirFlowRate.get, value_source_units, value_target_units).get
    value_ip_neat = OpenStudio.toNeatString(value_ip, 2, true)
  else
    value_ip_neat = 'Autosized'
  end
  data_array = [component.iddObject.name, sizing_ip_neat, sizing_target_units, 'Minimum Outdoor Air Flow Rate', value_ip_neat, value_target_units, '']

elsif component.to_CoilCoolingDXSingleSpeed.is_initialized
  component = component.to_CoilCoolingDXSingleSpeed.get
  sizing_source_units = 'W'
  sizing_target_units = 'Btu/h'
  if component.ratedTotalCoolingCapacity.is_initialized
    sizing_ip = OpenStudio.convert(component.ratedTotalCoolingCapacity.get, sizing_source_units, sizing_target_units).get
    sizing_ip_neat = OpenStudio.toNeatString(sizing_ip, 2, true)
  else
    sizing_ip_neat = 'Autosized'
  end
  value_source_units = 'COP'
  value_target_units = 'COP'
  value_ip = component.ratedCOP.get
  value_ip_neat = OpenStudio.toNeatString(value_ip, 2, true)
  description = 'Rated COP'
  data_array = [component.iddObject.name, sizing_ip_neat, sizing_target_units, description, value_ip_neat, value_target_units, '']

I get those following codes from os_lib_reporting.rb file. Plesae give me some instruction for change them into SI unit of value and unit shown in result result.

First type: type:

# total building area
    query = 'SELECT Value FROM tabulardatawithstrings WHERE '
    query << "ReportName='AnnualBuildingUtilityPerformanceSummary' and " # Notice no space in SystemSummary
    query << "ReportForString='Entire Facility' and "
    query << "TableName='Building Area' and "
    query << "RowName='Total Building Area' and "
    query << "ColumnName='Area' and "
    query << "Units='m2';"
    query_results = sqlFile.execAndReturnFirstDouble(query)
    if query_results.empty?
      runner.registerError('Did not find EUI
    eui =  sqlFile.netSiteEnergy.get / query_results.get
    display = 'EUI'
    source_units = 'GJ/m^2'
    target_units = 'kBtu/ft^2'
    value for total building area.')
      return false
    else
      display = 'Total Building Area'
      source_units = 'm^2'
      target_units = 'ft^2'
      value = OpenStudio.convert(query_results.get, = OpenStudio.convert(eui, source_units, target_units).get
     value_neat = OpenStudio.toNeatString(value, 0, 2, true)
     general_building_information[:data] << [display, value_neat, target_units]
     runner.registerValue(display, value, target_units)

target_units) return general_building_information end

Second type: type:

# summary of what to show for each type of air loop component
  def self.air_loop_component_summary_logic(component, model)
    if component.to_AirLoopHVACOutdoorAirSystem.is_initialized
      component = component.to_AirLoopHVACOutdoorAirSystem.get
      # get ControllerOutdoorAir
      controller_oa = component.getControllerOutdoorAir

component.getControllerOutdoorAir

      sizing_source_units = 'm^3/s'
   sizing_target_units = 'cfm'
   if controller_oa.maximumOutdoorAirFlowRate.is_initialized
     sizing_ip = OpenStudio.convert(controller_oa.maximumOutdoorAirFlowRate.get, sizing_source_units, sizing_target_units).get
     sizing_ip_neat = OpenStudio.toNeatString(sizing_ip, 2, true)
   else
     sizing_ip_neat = 'Autosized'
   end
   value_source_units = 'm^3/s'
   value_target_units = 'cfm'
   if controller_oa.minimumOutdoorAirFlowRate.is_initialized
     value_ip = OpenStudio.convert(controller_oa.minimumOutdoorAirFlowRate.get, value_source_units, value_target_units).get
     value_ip_neat = OpenStudio.toNeatString(value_ip, 2, true)
   else
     value_ip_neat = 'Autosized'
   end
   data_array = [component.iddObject.name, sizing_ip_neat, sizing_target_units, 'Minimum Outdoor Air Flow Rate', value_ip_neat, value_target_units, '']

 elsif component.to_CoilCoolingDXSingleSpeed.is_initialized
   component = component.to_CoilCoolingDXSingleSpeed.get
   sizing_source_units = 'W'
   sizing_target_units = 'Btu/h'
   if component.ratedTotalCoolingCapacity.is_initialized
     sizing_ip = OpenStudio.convert(component.ratedTotalCoolingCapacity.get, sizing_source_units, sizing_target_units).get
     sizing_ip_neat = OpenStudio.toNeatString(sizing_ip, 2, true)
   else
     sizing_ip_neat = 'Autosized'
   end
  value_source_units = 'COP'
  value_target_units = 'COP'
  value_ip = component.ratedCOP.get
  value_ip_neat = OpenStudio.toNeatString(value_ip, 2, true)
  description = 'Rated COP'
  data_array = [component.iddObject.name, sizing_ip_neat, sizing_target_units, description, value_ip_neat, value_target_units, '']