lib/openstudio-standards.rb in openstudio-standards-0.2.9 vs lib/openstudio-standards.rb in openstudio-standards-0.2.10.rc1

- old
+ new

@@ -27,46 +27,97 @@ proto = 'openstudio-standards/prototypes' ### Standards ### # Standards classes require_relative "#{stds}/standard" - require_relative "#{stds}/necb/necb_2011/necb_2011" - require_relative "#{stds}/necb/necb_2015/necb_2015" - require_relative "#{stds}/necb/necb_2011/building_envelope" - require_relative "#{stds}/necb/necb_2011/lighting" - require_relative "#{stds}/necb/necb_2011/hvac_systems" - require_relative "#{stds}/necb/necb_2015/hvac_systems" - require_relative "#{stds}/necb/necb_2011/service_water_heating" - require_relative "#{stds}/necb/necb_2011/electrical_power_systems_and_motors" - require_relative "#{stds}/necb/necb_2011/beps_compliance_path" + # NECB2011 Code + require_relative "#{stds}/necb/NECB2011/necb_2011" + require_relative "#{stds}/necb/NECB2011/building_envelope" + require_relative "#{stds}/necb/NECB2011/lighting" + require_relative "#{stds}/necb/NECB2011/hvac_systems" + require_relative "#{stds}/necb/NECB2011/autozone" + require_relative "#{stds}/necb/NECB2011/hvac_system_1_single_speed" + require_relative "#{stds}/necb/NECB2011/hvac_system_2_and_5" + require_relative "#{stds}/necb/NECB2011/hvac_system_3_and_8_single_speed" + require_relative "#{stds}/necb/NECB2011/hvac_system_4" + require_relative "#{stds}/necb/NECB2011/hvac_system_6" + require_relative "#{stds}/necb/NECB2011/service_water_heating" + require_relative "#{stds}/necb/NECB2011/electrical_power_systems_and_motors" + require_relative "#{stds}/necb/NECB2011/beps_compliance_path" + # NECB2015 Code + require_relative "#{stds}/necb/NECB2015/necb_2015" + require_relative "#{stds}/necb/NECB2015/lighting" + require_relative "#{stds}/necb/NECB2015/hvac_systems" + # NECB2017 Code + require_relative "#{stds}/necb/NECB2017/necb_2017" + require_relative "#{stds}/necb/NECB2017/hvac_systems" # NECB QAQC - require_relative "#{stds}/necb/necb_2011/qaqc/necb_qaqc.rb" - require_relative "#{stds}/necb/necb_2015/qaqc/necb_2015_qaqc.rb" + require_relative "#{stds}/necb/NECB2011/qaqc/necb_qaqc.rb" + require_relative "#{stds}/necb/NECB2015/qaqc/necb_2015_qaqc.rb" require_relative "#{stds}/ashrae_90_1/ashrae_90_1" require_relative "#{stds}/ashrae_90_1/doe_ref_pre_1980/doe_ref_pre_1980" + require_relative "#{stds}/ashrae_90_1/doe_ref_pre_1980/comstock_doe_ref_pre_1980/comstock_doe_ref_pre_1980" require_relative "#{stds}/ashrae_90_1/doe_ref_1980_2004/doe_ref_1980_2004" + require_relative "#{stds}/ashrae_90_1/doe_ref_1980_2004/comstock_doe_ref_1980_2004/comstock_doe_ref_1980_2004" require_relative "#{stds}/ashrae_90_1/ashrae_90_1_2004/ashrae_90_1_2004" + require_relative "#{stds}/ashrae_90_1/ashrae_90_1_2004/comstock_ashrae_90_1_2004/comstock_ashrae_90_1_2004" require_relative "#{stds}/ashrae_90_1/ashrae_90_1_2007/ashrae_90_1_2007" + require_relative "#{stds}/ashrae_90_1/ashrae_90_1_2007/comstock_ashrae_90_1_2007/comstock_ashrae_90_1_2007" require_relative "#{stds}/ashrae_90_1/ashrae_90_1_2010/ashrae_90_1_2010" + require_relative "#{stds}/ashrae_90_1/ashrae_90_1_2010/comstock_ashrae_90_1_2010/comstock_ashrae_90_1_2010" require_relative "#{stds}/ashrae_90_1/ashrae_90_1_2013/ashrae_90_1_2013" + require_relative "#{stds}/ashrae_90_1/ashrae_90_1_2013/comstock_ashrae_90_1_2013/comstock_ashrae_90_1_2013" require_relative "#{stds}/ashrae_90_1/nrel_zne_ready_2017/nrel_zne_ready_2017" require_relative "#{stds}/deer/deer" require_relative "#{stds}/deer/deer_pre_1975/deer_pre_1975" + require_relative "#{stds}/deer/deer_pre_1975/comstock_deer_pre_1975/comstock_deer_pre_1975" require_relative "#{stds}/deer/deer_1985/deer_1985" + require_relative "#{stds}/deer/deer_1985/comstock_deer_1985/comstock_deer_1985" require_relative "#{stds}/deer/deer_1996/deer_1996" + require_relative "#{stds}/deer/deer_1996/comstock_deer_1996/comstock_deer_1996" require_relative "#{stds}/deer/deer_2003/deer_2003" + require_relative "#{stds}/deer/deer_2003/comstock_deer_2003/comstock_deer_2003" require_relative "#{stds}/deer/deer_2007/deer_2007" + require_relative "#{stds}/deer/deer_2007/comstock_deer_2007/comstock_deer_2007" require_relative "#{stds}/deer/deer_2011/deer_2011" + require_relative "#{stds}/deer/deer_2011/comstock_deer_2011/comstock_deer_2011" require_relative "#{stds}/deer/deer_2014/deer_2014" + require_relative "#{stds}/deer/deer_2014/comstock_deer_2014/comstock_deer_2014" require_relative "#{stds}/deer/deer_2015/deer_2015" + require_relative "#{stds}/deer/deer_2015/comstock_deer_2015/comstock_deer_2015" require_relative "#{stds}/deer/deer_2017/deer_2017" + require_relative "#{stds}/deer/deer_2017/comstock_deer_2017/comstock_deer_2017" + require_relative "#{stds}/deer/deer_2020/deer_2020" + require_relative "#{stds}/deer/deer_2020/comstock_deer_2020/comstock_deer_2020" + require_relative "#{stds}/deer/deer_2025/deer_2025" + require_relative "#{stds}/deer/deer_2025/comstock_deer_2025/comstock_deer_2025" + require_relative "#{stds}/deer/deer_2030/deer_2030" + require_relative "#{stds}/deer/deer_2030/comstock_deer_2030/comstock_deer_2030" + require_relative "#{stds}/deer/deer_2035/deer_2035" + require_relative "#{stds}/deer/deer_2035/comstock_deer_2035/comstock_deer_2035" + require_relative "#{stds}/deer/deer_2040/deer_2040" + require_relative "#{stds}/deer/deer_2040/comstock_deer_2040/comstock_deer_2040" + require_relative "#{stds}/deer/deer_2045/deer_2045" + require_relative "#{stds}/deer/deer_2045/comstock_deer_2045/comstock_deer_2045" + require_relative "#{stds}/deer/deer_2050/deer_2050" + require_relative "#{stds}/deer/deer_2050/comstock_deer_2050/comstock_deer_2050" + require_relative "#{stds}/deer/deer_2055/deer_2055" + require_relative "#{stds}/deer/deer_2055/comstock_deer_2055/comstock_deer_2055" + require_relative "#{stds}/deer/deer_2060/deer_2060" + require_relative "#{stds}/deer/deer_2060/comstock_deer_2060/comstock_deer_2060" + require_relative "#{stds}/deer/deer_2065/deer_2065" + require_relative "#{stds}/deer/deer_2065/comstock_deer_2065/comstock_deer_2065" + require_relative "#{stds}/deer/deer_2070/deer_2070" + require_relative "#{stds}/deer/deer_2070/comstock_deer_2070/comstock_deer_2070" + require_relative "#{stds}/deer/deer_2075/deer_2075" + require_relative "#{stds}/deer/deer_2075/comstock_deer_2075/comstock_deer_2075" require_relative "#{stds}/oeesc/oeesc" - require_relative "#{stds}/oeesc/oeesc_2014/oeesc_2014" + require_relative "#{stds}/oeesc/oeesc_2014/oeesc_2014" require_relative "#{stds}/icc_iecc/icc_iecc" require_relative "#{stds}/icc_iecc/icc_iecc_2015/icc_iecc_2015" require_relative "#{stds}/cbes/cbes" @@ -97,10 +148,11 @@ require_relative "#{stds}/Standards.CoilCoolingDXTwoSpeed" require_relative "#{stds}/Standards.CoilDX" require_relative "#{stds}/Standards.CoilHeatingDXMultiSpeed" require_relative "#{stds}/Standards.CoilHeatingDXSingleSpeed" require_relative "#{stds}/Standards.CoilHeatingGasMultiStage" + require_relative "#{stds}/Standards.CoilHeatingGas" require_relative "#{stds}/Standards.Construction" require_relative "#{stds}/Standards.CoolingTower" require_relative "#{stds}/Standards.CoolingTowerSingleSpeed" require_relative "#{stds}/Standards.CoolingTowerTwoSpeed" require_relative "#{stds}/Standards.CoolingTowerVariableSpeed" @@ -190,10 +242,11 @@ require_relative "#{stds}/ashrae_90_1/nrel_zne_ready_2017/nrel_zne_ready_2017.ZoneHVACComponent" # DEER Common require_relative "#{stds}/deer/deer.Model" require_relative "#{stds}/deer/deer.AirLoopHVAC" require_relative "#{stds}/deer/deer.Space" + require_relative "#{stds}/deer/deer.PlanarSurface" # CBES Common require_relative "#{stds}/cbes/cbes.AirLoopHVAC" require_relative "#{stds}/cbes/cbes.Model" require_relative "#{stds}/cbes/cbes.PlantLoop" require_relative "#{stds}/cbes/cbes.Space" @@ -219,14 +272,18 @@ require_relative "#{proto}/common/buildings/Prototype.SecondarySchool" require_relative "#{proto}/common/buildings/Prototype.SmallHotel" require_relative "#{proto}/common/buildings/Prototype.SmallOffice" require_relative "#{proto}/common/buildings/Prototype.SuperMarket" require_relative "#{proto}/common/buildings/Prototype.Warehouse" + require_relative "#{proto}/common/buildings/Prototype.SmallDataCenterLowITE" + require_relative "#{proto}/common/buildings/Prototype.SmallDataCenterHighITE" + require_relative "#{proto}/common/buildings/Prototype.LargeDataCenterLowITE" + require_relative "#{proto}/common/buildings/Prototype.LargeDataCenterHighITE" require_relative "#{proto}/common/buildings/Prototype.LargeOfficeDetailed" require_relative "#{proto}/common/buildings/Prototype.MediumOfficeDetailed" require_relative "#{proto}/common/buildings/Prototype.SmallOfficeDetailed" - + require_relative "#{proto}/common/buildings/Prototype.Laboratory" # NECB Building Types require_relative "#{proto}/common/prototype_metaprogramming.rb" create_meta_classes @@ -243,10 +300,11 @@ require_relative "#{proto}/common/objects/Prototype.CoilHeatingElectric" require_relative "#{proto}/common/objects/Prototype.CoilHeatingGas" require_relative "#{proto}/common/objects/Prototype.CoilHeatingWater" require_relative "#{proto}/common/objects/Prototype.CoilHeatingWaterToAirHeatPumpEquationFit" require_relative "#{proto}/common/objects/Prototype.ControllerWaterCoil" + require_relative "#{proto}/common/objects/Prototype.radiant_system_controls" require_relative "#{proto}/common/objects/Prototype.Fan" require_relative "#{proto}/common/objects/Prototype.FanConstantVolume" require_relative "#{proto}/common/objects/Prototype.FanOnOff" require_relative "#{proto}/common/objects/Prototype.FanVariableVolume" require_relative "#{proto}/common/objects/Prototype.FanZoneExhaust" @@ -307,52 +365,69 @@ require_relative "#{proto}/cbes/cbes.refrigeration" # CBES T24 2008 require_relative "#{proto}/cbes/cbes_t24_2008/cbes_t24_2008.FanConstantVolume" require_relative "#{proto}/cbes/cbes_t24_2008/cbes_t24_2008.FanOnOff" require_relative "#{proto}/cbes/cbes_t24_2008/cbes_t24_2008.FanVariableVolume" - + # DLM: not sure where this code should go def self.get_run_env() # blank out bundler and gem path modifications, will be re-setup by new call new_env = {} - new_env["BUNDLER_ORIG_MANPATH"] = nil - new_env["BUNDLER_ORIG_PATH"] = nil - new_env["BUNDLER_VERSION"] = nil - new_env["BUNDLE_BIN_PATH"] = nil - new_env["RUBYLIB"] = nil - new_env["RUBYOPT"] = nil - + new_env['BUNDLER_ORIG_MANPATH'] = nil + new_env['BUNDLER_ORIG_PATH'] = nil + new_env['BUNDLER_VERSION'] = nil + new_env['BUNDLE_BIN_PATH'] = nil + new_env['RUBYLIB'] = nil + new_env['RUBYOPT'] = nil + # DLM: preserve GEM_HOME and GEM_PATH set by current bundle because we are not supporting bundle # requires to ruby gems will work, will fail if we require a native gem - #new_env["GEM_PATH"] = nil - #new_env["GEM_HOME"] = nil - + new_env['GEM_PATH'] = nil + new_env['GEM_HOME'] = nil + # DLM: for now, ignore current bundle in case it has binary dependencies in it #bundle_gemfile = ENV['BUNDLE_GEMFILE'] - #bundle_path = ENV['BUNDLE_PATH'] + #bundle_path = ENV['BUNDLE_PATH'] #if bundle_gemfile.nil? || bundle_path.nil? new_env['BUNDLE_GEMFILE'] = nil new_env['BUNDLE_PATH'] = nil + new_env['BUNDLE_WITHOUT'] = nil #else # new_env['BUNDLE_GEMFILE'] = bundle_gemfile - # new_env['BUNDLE_PATH'] = bundle_path - #end - + # new_env['BUNDLE_PATH'] = bundle_path + #end + return new_env end - + def self.run_command(command) stdout_str, stderr_str, status = Open3.capture3(get_run_env(), command) if status.success? - puts "Command completed successfully" + OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.command', "Successfully ran command: '#{command}'") #puts "stdout: #{stdout_str}" #puts "stderr: #{stderr_str}" return true else - puts "Error running command: '#{command}'" - puts "stdout: #{stdout_str}" - puts "stderr: #{stderr_str}" - return false + OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.command', "Error running command: '#{command}'") + OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.command', "stdout: #{stdout_str}") + OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.command', "stderr: #{stderr_str}") + + # Print the ENV for debugging + final_env = [] + env_changes = get_run_env() + ENV.each do |env_var, val| + next if env_changes.key?(env_var) && env_changes[env_var].nil? + final_env << "#{env_var} = #{val}" + end + OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.command', "command's modified ENV: \n #{final_env.join("\n")}") + + # List the gems available to openstudio at this point + cli_path = OpenStudio.getOpenStudioCLI + cmd = "\"#{cli_path}\" gem_list" + stdout_str_2, stderr_str_2, status_2 = Open3.capture3(get_run_env(), cmd) + OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.command', "Gems available to openstudio cli according to (openstudio gem_list): \n #{stdout_str_2}") + + return false end end - + end