Class: BTAP::EQuest::DOESubSurface

Inherits:
DOESurface show all
Defined in:
lib/openstudio-standards/btap/equest.rb

Overview

This class allows to manipulate a subsurface (window/door) in inherits from surface.

Instance Attribute Summary

Attributes inherited from DOESurface

#construction, #polygon

Attributes inherited from DOECommand

#building, #children, #commandName, #commandType, #comments, #exempt, #keywordPairs, #non_utype_commands, #one_line_commands, #parents, #utype, #uvalue

Instance Method Summary collapse

Methods inherited from DOESurface

#determine_user_defined_construction, #get_doors, #get_sub_surface_origin, #get_windows

Methods inherited from DOECommand

#basic_output, #check_keyword?, #depth, #doe_scope, #get_children, #get_children_of_command, #get_command_from_string, #get_keyword_value, #get_name, #get_parent, #get_parents, #name, #output, #remove, #remove_keyword_pair, #set_keyword_value, #set_parent

Constructor Details

#initializeDOESubSurface

Returns a new instance of DOESubSurface.



939
940
941
942
# File 'lib/openstudio-standards/btap/equest.rb', line 939

def initialize
  #run the parent class initialization. 
  super()
end

Instance Method Details

#convert_to_openstudio(model) ⇒ Object

this will translate the subsurface to the openstudio model.



1023
1024
# File 'lib/openstudio-standards/btap/equest.rb', line 1023

def convert_to_openstudio(model)        
end

#get_3d_polygonObject

Return the widow polygon with an origin of zero



953
954
955
956
957
958
959
960
961
962
963
964
# File 'lib/openstudio-standards/btap/equest.rb', line 953

def get_3d_polygon()
  height = get_keyword_value("HEIGHT").to_f
  width = get_keyword_value("WIDTH").to_f
  x = self.check_keyword?("X")?  self.get_keyword_value("X").to_f : 0.0
  y = self.check_keyword?("Y")?  self.get_keyword_value("Y").to_f : 0.0
  #counter clockwise
  origin = OpenStudio::Point3d.new( x, y , 0.0 )
  p2 = OpenStudio::Point3d.new(x + width , y,0.0 )
  p3 = OpenStudio::Point3d.new(x + width , y + height , 0.0 )
  p4 = OpenStudio::Point3d.new(x, y + height,0.0 )
  return [origin,p2,p3,p4]
end

#get_areaObject

This method returns the area of the window



945
946
947
948
949
950
# File 'lib/openstudio-standards/btap/equest.rb', line 945

def get_area()
  unless check_keyword?("HEIGHT")  and check_keyword?("WIDTH")
    raise "Error: In the command #{@utype}:#{@command_name} the area could not be evaluated. Either the HEIGHT or WIDTH is invalid.\n #{output}"
  end
  return get_keyword_value("WIDTH").to_f * get_keyword_value("HEIGHT").to_f
end

#get_azimuthObject

Gets azimuth, based on parent surface.



973
974
975
# File 'lib/openstudio-standards/btap/equest.rb', line 973

def get_azimuth()
  get_parent_surface().get_azimuth()
end

#get_originObject

Returns the origin relative to the parent surface.



967
968
969
970
# File 'lib/openstudio-standards/btap/equest.rb', line 967

def get_origin()
  origin = get_parent_surface().get_sub_surface_origin()
  return origin
end

#get_parent_surfaceObject

return the parent surface of the subsurface.



983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
# File 'lib/openstudio-standards/btap/equest.rb', line 983

def get_parent_surface()
  get_parents().each do |findcommand|
    [
      "EXTERIOR-WALL",
      "INTERIOR-WALL",
      "UNDERGROUND-WALL",
      "ROOF"
    ].each do |type|

      if ( findcommand.commandName == type)
        return findcommand
      end
    end
  end
  raise("#no parent surface defined!")
end

#get_rotation_matrixObject



1005
1006
1007
1008
1009
1010
# File 'lib/openstudio-standards/btap/equest.rb', line 1005

def get_rotation_matrix
  #Rotate points around z (azimuth) and x (Tilt)
  e_a = OpenStudio::EulerAngles.new(	OpenStudio::degToRad( self.get_tilt ), 0.0, OpenStudio::degToRad( 0.0  ) )
  rotations = OpenStudio::Transformation::rotation(e_a)
  return  rotations 
end

#get_tiltObject

gets tilt based on parent surface.



978
979
980
# File 'lib/openstudio-standards/btap/equest.rb', line 978

def get_tilt()
  get_parent_surface().get_tilt()
end

#get_transformation_matrixObject

returns the translation matrix reletive to its parent ( the surface )



1001
1002
1003
# File 'lib/openstudio-standards/btap/equest.rb', line 1001

def get_transformation_matrix
  return  self.get_rotation_matrix() * self.get_translation_matrix()
end

#get_translation_matrixObject



1012
1013
1014
1015
1016
# File 'lib/openstudio-standards/btap/equest.rb', line 1012

def get_translation_matrix
  #Rotate points around z (azimuth) and x (Tilt)
  translation = OpenStudio::createTranslation(self.get_origin) 
  return  translation 
end