lib/openstudio-standards/standards/Standards.Model.rb in openstudio-standards-0.1.6 vs lib/openstudio-standards/standards/Standards.Model.rb in openstudio-standards-0.1.7

- old
+ new

@@ -63,10 +63,11 @@ require_relative 'Standards.FanConstantVolume' require_relative 'Standards.FanVariableVolume' require_relative 'Standards.FanOnOff' require_relative 'Standards.FanZoneExhaust' require_relative 'Standards.ChillerElectricEIR' + require_relative 'Standards.CoilDX' require_relative 'Standards.CoilCoolingDXTwoSpeed' require_relative 'Standards.CoilCoolingDXSingleSpeed' require_relative 'Standards.CoilHeatingDXSingleSpeed' require_relative 'Standards.BoilerHotWater' require_relative 'Standards.AirLoopHVAC' @@ -150,10 +151,18 @@ end end OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.Model', '*** Adding Daylighting Controls ***') + # Run a sizing run to calculate VLT for layer-by-layer windows. + # Only necessary for 90.1-2010 daylighting control determination. + if template == '90.1-2010' + if runSizingRun("#{sizing_run_dir}/SizingRunVLT") == false + return false + end + end + # Add daylighting controls to each space getSpaces.sort.each do |space| added = space.add_daylighting_controls(template, false, false) end @@ -452,10 +461,16 @@ # electric # (and for Xcel Energy CO EDA) # fossilandelectric zones = zones_with_occ_and_fuel_type(template, custom) + # Ensure that there is at least one conditioned zone + if zones.size.zero? + OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "The building does not appear to have any conditioned zones. Make sure zones have thermostat with appropriate heating and cooling setpoint schedules.") + return [] + end + # Group the zones by occupancy type type_to_area = Hash.new { 0.0 } zones_grouped_by_occ = zones.group_by { |z| z['occ'] } # Determine the dominant occupancy type by area @@ -523,16 +538,23 @@ zones_grouped_by_fuel.each do |fuel, zns| zns.each do |zn| fuel_to_area[fuel] += zn['area'] end end - dom_fuel = fuel_to_area.sort_by { |k, v| v }.reverse[0][0] + sorted_by_area = fuel_to_area.sort_by { |k, v| v }.reverse + dom_fuel = sorted_by_area[0][0] + # Don't allow unconditioned to be the dominant fuel, # go to the next biggest if dom_fuel == 'unconditioned' - dom_fuel = fuel_to_area.sort_by { |k, v| v }.reverse[1][0] + if sorted_by_area.size > 1 + dom_fuel = sorted_by_area[1][0] + else + OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.Model', "The fuel type was not able to be determined for any zones in this model. Run with debug messages enabled to see possible reasons.") + return [] + end end # Get the dominant fuel type group dom_fuel_group = {} dom_fuel_group['occ'] = occ_type @@ -1417,13 +1439,10 @@ # baseline HVAC systems for later use. # This must be done before removing the HVAC systems # because it requires knowledge of proposed HVAC fuels. sys_groups = prm_baseline_system_groups(template, custom) - # Remove all HVAC from model - BTAP::Resources::HVAC.clear_all_hvac_from_model(self) - # Assign building stories to spaces in the building # where stories are not yet assigned. assign_spaces_to_stories # Determine the baseline HVAC system type for each of @@ -1434,11 +1453,11 @@ climate_zone, sys_group['occ'], sys_group['fuel'], sys_group['area_ft2'], sys_group['stories'], - custom) + custom)[0] # Record the zone-by-zone system type assignments case template when '90.1-2004', '90.1-2007', '90.1-2010', '90.1-2013' @@ -1987,18 +2006,20 @@ getPumpConstantSpeeds.sort.each { |obj| obj.apply_standard_minimum_motor_efficiency(template) } getPumpVariableSpeeds.sort.each { |obj| obj.apply_standard_minimum_motor_efficiency(template) } getHeaderedPumpsConstantSpeeds.sort.each { |obj| obj.apply_standard_minimum_motor_efficiency(template) } getHeaderedPumpsVariableSpeeds.sort.each { |obj| obj.apply_standard_minimum_motor_efficiency(template) } - # Unitary ACs - - getCoilCoolingDXTwoSpeeds.sort.each { |obj| obj.apply_efficiency_and_curves(template) } - getCoilCoolingDXSingleSpeeds.sort.each { |obj| sql_db_vars_map = obj.apply_efficiency_and_curves(template, sql_db_vars_map) } - # Unitary HPs + # set DX HP coils before DX clg coils because when DX HP coils need to first + # pull the capacities of their paried DX clg coils, and this does not work + # correctly if the DX clg coil efficiencies have been set because they are renamed. getCoilHeatingDXSingleSpeeds.sort.each { |obj| sql_db_vars_map = obj.apply_efficiency_and_curves(template, sql_db_vars_map) } + # Unitary ACs + getCoilCoolingDXTwoSpeeds.sort.each { |obj| sql_db_vars_map = obj.apply_efficiency_and_curves(template, sql_db_vars_map) } + getCoilCoolingDXSingleSpeeds.sort.each { |obj| sql_db_vars_map = obj.apply_efficiency_and_curves(template, sql_db_vars_map) } + # Chillers clg_tower_objs = getCoolingTowerSingleSpeeds getChillerElectricEIRs.sort.each { |obj| obj.apply_efficiency_and_curves(template, clg_tower_objs) } # Boilers @@ -3099,10 +3120,14 @@ # get climate zone from model # get ashrae climate zone from model climate_zone = '' getClimateZones.climateZones.each do |cz| if cz.institution == 'ASHRAE' - climate_zone = "ASHRAE 169-2006-#{cz.value}" + if cz.value == '7'||cz.value == '8' + climate_zone = "ASHRAE 169-2006-#{cz.value}A" + else + climate_zone = "ASHRAE 169-2006-#{cz.value}" + end next end end # get building type from model