Sha256: 16ba9580f6c64e6b0d091b587418fe1f64c2e3bc69a64b63b4bea04f5d9d853f

Contents?: true

Size: 1.8 KB

Versions: 7

Compression:

Stored size: 1.8 KB

Contents

require 'openstudio'

translator = OpenStudio::OSVersion::VersionTranslator.new
ospath_in = OpenStudio::Path.new('./NECB2011Hospital_4.osm')
ospath_out = OpenStudio::Path.new('./NECB2011Hospital_4_updated.osm')
model = translator.loadModel(ospath_in)
model = model.get

spaces = model.getSpaces
converted = []
# loop through space
spaces.each{|space|
	# check for multiplier
	if space.multiplier > 1
    puts space.name
		surfaces = space.surfaces
		# get surfaces of a space
		surfaces.each{|surface|
			puts "\t#{surface.name}\n\t\t#{surface.outsideBoundaryCondition}"
			# convert all surfaces except outdoors BC, and make it adabatic. if that 
			# surface has an adjacent surface, then also convert it to adiabatic
			if surface.outsideBoundaryCondition.to_s == "Surface"
				if !surface.adjacentSurface.nil?
					adj_surface = surface.adjacentSurface.get
					adj_surface.setOutsideBoundaryCondition('Adiabatic')
					converted << adj_surface.name
				end
				surface.setOutsideBoundaryCondition('Adiabatic')
				converted << surface.name
			# if the surface is already not adiabatic or outdoors, set the BC to adiabatic
			elsif surface.outsideBoundaryCondition.to_s != "Outdoors" and  surface.outsideBoundaryCondition.to_s != "Adiabatic"
				surface.setOutsideBoundaryCondition('Adiabatic')
				converted << surface.name
			end
		}
	end
}

# ASSUMING THAT ALL ADIABATIC SURFACES ARE NOT SUPPOSED TO BE EXPOSED TO THE WIND AND SUN
# set adiabatic surface's sun and wind exposure to none
model.getSurfaces.each{|surface|
  if surface.outsideBoundaryCondition.to_s == "Adiabatic"
	surface.setWindExposure("NoWind")
	surface.setSunExposure("NoSun")
	converted << "#{surface.name} -- NoSun NoWind"
  end
}

puts "\n\n"
puts converted
puts converted.length

model.save(ospath_out, true)

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
openstudio-standards-0.2.12 lib/openstudio-standards/utilities/set_mult_to_adiabatic.rb
openstudio-standards-0.2.12.rc7 lib/openstudio-standards/utilities/set_mult_to_adiabatic.rb
openstudio-standards-0.2.12.rc6 lib/openstudio-standards/utilities/set_mult_to_adiabatic.rb
openstudio-standards-0.2.12.rc5 lib/openstudio-standards/utilities/set_mult_to_adiabatic.rb
openstudio-standards-0.2.12.rc4 lib/openstudio-standards/utilities/set_mult_to_adiabatic.rb
openstudio-standards-0.2.12.rc2 lib/openstudio-standards/utilities/set_mult_to_adiabatic.rb
openstudio-standards-0.2.12.rc1 lib/openstudio-standards/utilities/set_mult_to_adiabatic.rb