lib/openstudio-standards/standards/Standards.Model.rb in openstudio-standards-0.3.1.rc1 vs lib/openstudio-standards/standards/Standards.Model.rb in openstudio-standards-0.3.1.rc2

- old
+ new

@@ -73,12 +73,12 @@ if umlh > 300 OpenStudio.logFree(OpenStudio::Error, 'prm.log', "Proposed model unmet load hours exceed 300. Baseline model(s) won't be created.") raise "Proposed model unmet load hours exceed 300. Baseline model(s) won't be created." end else - OpenStudio.logFree(OpenStudio::Error, 'prm.log', "Simulation failed. Check the model to make sure no severe errors.") - raise "Simulation on proposed model failed. Baseline generation is stopped." + OpenStudio.logFree(OpenStudio::Error, 'prm.log', 'Simulation failed. Check the model to make sure no severe errors.') + raise 'Simulation on proposed model failed. Baseline generation is stopped.' end end # User data process # bldg_type_hvac_zone_hash could be an empty hash if all zones in the models are unconditioned @@ -3235,20 +3235,23 @@ frame.setFrameWidth(frame_with_m) frame.setFrameConductance(frame_conductance_si) skylights_frame_added = 0 model.getSubSurfaces.each do |sub_surface| next unless sub_surface.outsideBoundaryCondition == 'Outdoors' && sub_surface.subSurfaceType == 'Skylight' - - # @todo enable proper window frame setting after https://github.com/NREL/OpenStudio/issues/2895 is fixed - sub_surface.setString(8, frame.name.get.to_s) - skylights_frame_added += 1 - # if sub_surface.allowWindowPropertyFrameAndDivider - # sub_surface.setWindowPropertyFrameAndDivider(frame) - # skylights_frame_added += 1 - # else - # OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "For #{sub_surface.name}: cannot add a frame to this skylight.") - # end + + if model.version < OpenStudio::VersionString.new('3.1.0') + # window frame setting before https://github.com/NREL/OpenStudio/issues/2895 was fixed + sub_surface.setString(8, frame.name.get.to_s) + skylights_frame_added += 1 + else + if sub_surface.allowWindowPropertyFrameAndDivider + sub_surface.setWindowPropertyFrameAndDivider(frame) + skylights_frame_added += 1 + else + OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "For #{sub_surface.name}: cannot add a frame to this skylight.") + end + end end OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.Model', "Adding #{frame.name} to #{skylights_frame_added} skylights.") if skylights_frame_added > 0 else OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "Cannot find skylight framing data for: #{framing_name}, will not be created.") return false @@ -4672,11 +4675,14 @@ # Report baseline WWR vals['wwr_nr'] *= vals['mult_nr_red'] vals['wwr_res'] *= vals['mult_res_red'] vals['wwr_sh'] *= vals['mult_sh_red'] wwrs = [vals['wwr_nr'], vals['wwr_res'], vals['wwr_sh']] - wwrs = wwrs.reject! &:nan? - base_wwr[bat] = wwrs.max + max_wwrs = [] + wwrs.each do |w| + max_wwrs << w unless w.nan? + end + base_wwr[bat] = max_wwrs.max # Reduce the window area if any of the categories necessary model.getSpaces.sort.each do |space| # Catch spaces without space types std_spc_type = space.additionalProperties.getFeatureAsString('building_type_for_wwr').get