Module: BTAP::Geometry::Surfaces
- Defined in:
- lib/openstudio-standards/btap/geometry.rb
Class Method Summary collapse
- .create_surface(model, name, os_point3d_array, boundary_condition = "", construction = "") ⇒ Object
-
.filter_by_azimuth_and_tilt(surfaces, azimuth_from, azimuth_to, tilt_from, tilt_to, tolerance = 1.0) ⇒ Object
Azimuth start from Y axis, Tilts starts from Z-axis.
- .filter_by_boundary_condition(surfaces, boundary_conditions) ⇒ Object
- .filter_by_interzonal_surface(surfaces) ⇒ Object
- .filter_by_non_defaulted_surfaces(surfaces) ⇒ Object
- .filter_by_surface_types(surfaces, surfaceTypes) ⇒ Object
-
.filter_subsurfaces_by_types(subsurfaces, subSurfaceTypes) ⇒ Object
[“FixedWindow” , “OperableWindow” , “Door” , “GlassDoor”, “OverheadDoor” , “Skylight”, “TubularDaylightDiffuser”,“TubularDaylightDome”].
- .get_sub_surface_net_area(subsurface) ⇒ Object
- .get_subsurfaces_from_surfaces(surface_array) ⇒ Object
-
.get_surface_construction_conductance(surface) ⇒ Object
This method creates a new construction based on the current, changes the rsi and assign the construction to the current surface.
- .get_surface_net_area(surface) ⇒ Object
- .get_surfaces_from_building_stories(model, story_array) ⇒ Object
- .get_surfaces_from_spaces(spaces_array) ⇒ Object
- .get_surfaces_from_thermal_zones(thermal_zone_array) ⇒ Object
- .get_total_ext_fenestration_area(model) ⇒ Object
- .get_total_ext_floor_area(model) ⇒ Object
- .get_total_ext_roof_area(model) ⇒ Object
-
.get_total_ext_wall_area(model) ⇒ Object
get total exterior surface area of building.
-
.get_weighted_average_surface_conductance(surfaces) ⇒ Object
determine average conductance on set of surfaces or subsurfaces.
- .hide(surfaces) ⇒ Object
-
.remove_all_subsurfaces(surfaces) ⇒ OpenStudio::Model::Model
This Method removes all the subsurfaces in a model (Windows, Doors ).
-
.rotate_tilt_translate_surfaces(planar_surfaces, azimuth_degrees, tilt_degrees = 0.0, translation_vector = OpenStudio::Vector3d.new(0.0,0.0,0.0)) ⇒ OpenStudio::Model::Model
This method will rotate a surface.
- .set_fenestration_to_wall_ratio(surfaces, ratio, offset = 0, height_offset_from_floor = true, floor = "all") ⇒ Object
-
.set_surfaces_boundary_condition(model, surfaces, boundaryCondition) ⇒ Object
This method sets the boundary condition for a surface and it’s matching surface.
- .set_surfaces_construction(surfaces, construction) ⇒ Object
-
.set_surfaces_construction_conductance(surfaces, conductance) ⇒ Object
This method creates a new construction based on the current, changes the rsi and assign the construction to the current surface.
- .show(surfaces) ⇒ Object
Class Method Details
.create_surface(model, name, os_point3d_array, boundary_condition = "", construction = "") ⇒ Object
2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2569 def self.create_surface(model,name,os_point3d_array, boundary_condition = "",construction = "") os_surface = OpenStudio::Model::Surface.new(os_point3d_array, model) os_surface.setName( name ) if OpenStudio::Model::Surface::validOutsideBoundaryConditionValues.include?(boundary_condition) self.set_surfaces_boundary_condition([os_surface], boundary_condition) else puts "boundary condition not set for #{name}" end self.set_surfaces_construction([os_surface],construction) return os_surface end |
.filter_by_azimuth_and_tilt(surfaces, azimuth_from, azimuth_to, tilt_from, tilt_to, tolerance = 1.0) ⇒ Object
Azimuth start from Y axis, Tilts starts from Z-axis
2878 2879 2880 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2878 def self.filter_by_azimuth_and_tilt(surfaces,azimuth_from,azimuth_to,tilt_from,tilt_to,tolerance = 1.0) return OpenStudio::Model::PlanarSurface::findPlanarSurfaces(surfaces, OpenStudio::OptionalDouble.new(azimuth_from), OpenStudio::OptionalDouble.new(azimuth_to), OpenStudio::OptionalDouble.new(tilt_from), OpenStudio::OptionalDouble.new(tilt_to),tolerance) end |
.filter_by_boundary_condition(surfaces, boundary_conditions) ⇒ Object
2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2809 def self.filter_by_boundary_condition(surfaces, boundary_conditions) #check to see if a string or an array was passed. if boundary_conditions.kind_of?(String) temp = boundary_conditions boundary_conditions = Array.new() boundary_conditions.push(temp) end #ensure boundary conditions are valid boundary_conditions.each do |boundary_condition| unless OpenStudio::Model::Surface::validOutsideBoundaryConditionValues.include?(boundary_condition) raise "ERROR: Invalid Boundary Condition = " + boundary_condition + "Correct Values are:" + OpenStudio::Model::Surface::validOutsideBoundaryConditionValues.to_s end end #create return array. return_array = Array.new() if boundary_conditions.size == 0 or boundary_conditions[0].upcase == "All".upcase return_array = surfaces else surfaces.each do |surface| boundary_conditions.each do |condition| if surface.outsideBoundaryCondition == condition return_array.push(surface) end end end end return return_array end |
.filter_by_interzonal_surface(surfaces) ⇒ Object
2867 2868 2869 2870 2871 2872 2873 2874 2875 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2867 def self.filter_by_interzonal_surface(surfaces) return_array = Array.new() surfaces.each do |surface| unless surface.adjacentSurface().empty? return_array.push(surface) end return return_array end end |
.filter_by_non_defaulted_surfaces(surfaces) ⇒ Object
2802 2803 2804 2805 2806 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2802 def self.filter_by_non_defaulted_surfaces(surfaces) non_defaulted_surfaces = Array.new() surfaces.each { |surface| non_defaulted_surfaces << surface unless surface.isConstructionDefaulted } return non_defaulted_surfaces end |
.filter_by_surface_types(surfaces, surfaceTypes) ⇒ Object
2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2839 def self.filter_by_surface_types(surfaces,surfaceTypes) #check to see if a string or an array was passed. if surfaceTypes.kind_of?(String) temp = surfaceTypes surfaceTypes = Array.new() surfaceTypes.push(temp) end surfaceTypes.each do |surfaceType| unless OpenStudio::Model::Surface::validSurfaceTypeValues.include?(surfaceType) raise( "ERROR: Invalid surface type = #{surfaceType} Correct Values are: #{OpenStudio::Model::Surface::validSurfaceTypeValues}") end end return_array = Array.new() if surfaceTypes.size == 0 or surfaceTypes[0].upcase == "All".upcase return_array = self else surfaces.each do |surface| surfaceTypes.each do |surfaceType| if surface.surfaceType == surfaceType return_array.push(surface) end end end end return return_array end |
.filter_subsurfaces_by_types(subsurfaces, subSurfaceTypes) ⇒ Object
- “FixedWindow” , “OperableWindow” , “Door” , “GlassDoor”, “OverheadDoor” , “Skylight”, “TubularDaylightDiffuser”,“TubularDaylightDome”
2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2704 def self.filter_subsurfaces_by_types(subsurfaces,subSurfaceTypes) #check to see if a string or an array was passed. if subSurfaceTypes.kind_of?(String) temp = subSurfaceTypes subSurfaceTypes = Array.new() subSurfaceTypes.push(temp) end subSurfaceTypes.each do |subSurfaceType| unless OpenStudio::Model::SubSurface::validSubSurfaceTypeValues.include?(subSurfaceType) raise( "ERROR: Invalid surface type = #{subSurfaceType} Correct Values are: #{OpenStudio::Model::SubSurface::validSubSurfaceTypeValues}") end end return_array = Array.new() if subSurfaceTypes.size == 0 or subSurfaceTypes[0].upcase == "All".upcase return_array = self else subsurfaces.each do |subsurface| subSurfaceTypes.each do |subSurfaceType| if subsurface.subSurfaceType == subSurfaceType return_array.push(subsurface) end end end end return return_array end |
.get_sub_surface_net_area(subsurface) ⇒ Object
2760 2761 2762 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2760 def self.get_sub_surface_net_area(subsurface) return subsurface.netArea() end |
.get_subsurfaces_from_surfaces(surface_array) ⇒ Object
2652 2653 2654 2655 2656 2657 2658 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2652 def self.get_subsurfaces_from_surfaces(surface_array) subsurfaces = Array.new() surface_array.each do |surface| subsurfaces.concat(surface.subSurfaces) end return subsurfaces end |
.get_surface_construction_conductance(surface) ⇒ Object
This method creates a new construction based on the current, changes the rsi and assign the construction to the current surface. Most of the meat of this method is in the construction class. Testing is done there.
2749 2750 2751 2752 2753 2754 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2749 def self.get_surface_construction_conductance(surface) #a bit of acrobatics to get the construction object from the ConstrustionBase object's name. construction = OpenStudio::Model::getConstructionByName(surface.model,surface.construction.get.name.to_s).get #create a new construction with the requested RSI value based on the current construction. return BTAP::Resources::Envelope::Constructions::get_conductance(construction) end |
.get_surface_net_area(surface) ⇒ Object
2756 2757 2758 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2756 def self.get_surface_net_area(surface) return surface.netArea() end |
.get_surfaces_from_building_stories(model, story_array) ⇒ Object
2634 2635 2636 2637 2638 2639 2640 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2634 def self.get_surfaces_from_building_stories(model, story_array) surfaces = Array.new() BTAP::Geometry::Spaces::get_spaces_from_storeys(model, story_array).each do |space| surfaces.concat(space.surfaces()) end return surfaces end |
.get_surfaces_from_spaces(spaces_array) ⇒ Object
2626 2627 2628 2629 2630 2631 2632 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2626 def self.get_surfaces_from_spaces(spaces_array) surfaces = Array.new() spaces_array.each do |space| surfaces.concat(space.surfaces()) end return surfaces end |
.get_surfaces_from_thermal_zones(thermal_zone_array) ⇒ Object
2642 2643 2644 2645 2646 2647 2648 2649 2650 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2642 def self.get_surfaces_from_thermal_zones(thermal_zone_array) surfaces = Array.new() thermal_zone_array.each do |thermal_zone| thermal_zone.spaces.each do |space| surfaces.concat(space.surfaces()) end return surfaces end end |
.get_total_ext_fenestration_area(model) ⇒ Object
2689 2690 2691 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2689 def self.get_total_ext_fenestration_area(model) end |
.get_total_ext_floor_area(model) ⇒ Object
2684 2685 2686 2687 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2684 def self.get_total_ext_floor_area(model) outdoor_floors = BTAP::Geometry::Surfaces::filter_by_surface_types(outdoor_surfaces, "Floor") end |
.get_total_ext_roof_area(model) ⇒ Object
2693 2694 2695 2696 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2693 def self.get_total_ext_roof_area(model) outdoor_roofs = BTAP::Geometry::Surfaces::filter_by_surface_types(outdoor_surfaces, "RoofCeiling") end |
.get_total_ext_wall_area(model) ⇒ Object
get total exterior surface area of building.
2676 2677 2678 2679 2680 2681 2682 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2676 def self.get_total_ext_wall_area(model) outdoor_surfaces = BTAP::Geometry::Surfaces::filter_by_boundary_condition(model.getSurfaces(), "Outdoors") outdoor_walls = BTAP::Geometry::Surfaces::filter_by_surface_types(outdoor_surfaces, "Wall") end |
.get_weighted_average_surface_conductance(surfaces) ⇒ Object
determine average conductance on set of surfaces or subsurfaces.
2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2663 def self.get_weighted_average_surface_conductance(surfaces) total_area = 0.0 temp = 0.0 surfaces.each do |surface| temp = temp + BTAP::Geometry::Surfaces::get_surface_net_area(surface) * BTAP::Geometry::Surfaces::get_surface_construction_conductance(surface) total_area = total_area + BTAP::Geometry::Surfaces::get_surface_net_area(surface) end average_conductance = "NA" average_conductance = temp / total_area unless total_area == 0.0 return average_conductance end |
.hide(surfaces) ⇒ Object
2893 2894 2895 2896 2897 2898 2899 2900 2901 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2893 def self.hide(surfaces) surfaces.each do |surface| if drawing_interface = surface.drawing_interface if entity = drawing_interface.entity entity.visible = false end end end end |
.remove_all_subsurfaces(surfaces) ⇒ OpenStudio::Model::Model
This Method removes all the subsurfaces in a model (Windows, Doors )
2619 2620 2621 2622 2623 2624 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2619 def self.remove_all_subsurfaces(surfaces) surfaces.each do |subsurface| subsurface.remove end return surfaces end |
.rotate_tilt_translate_surfaces(planar_surfaces, azimuth_degrees, tilt_degrees = 0.0, translation_vector = OpenStudio::Vector3d.new(0.0,0.0,0.0)) ⇒ OpenStudio::Model::Model
This method will rotate a surface
2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2587 def self.rotate_tilt_translate_surfaces(planar_surfaces, azimuth_degrees, tilt_degrees = 0.0, translation_vector = OpenStudio::Vector3d.new(0.0,0.0,0.0) ) # Identity matrix for setting space origins azimuth_matrix = OpenStudio::Transformation::rotation(OpenStudio::Vector3d.new(0,0,1),azimuth_degrees*Math::PI/180) tilt_matrix = OpenStudio::Transformation::rotation(OpenStudio::Vector3d.new(0,0,1),tilt_degrees*Math::PI/180) translation_matrix = OpenStudio::createTranslation(translation_vector) planar_surfaces.each do |surface| surface.changeTransformation(azimuth_matrix) surface.changeTransformation(tilt_matrix) surface.changeTransformation(translation_matrix) end return planar_surfaces end |
.set_fenestration_to_wall_ratio(surfaces, ratio, offset = 0, height_offset_from_floor = true, floor = "all") ⇒ Object
2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2600 def self.set_fenestration_to_wall_ratio(surfaces,ratio,offset = 0, height_offset_from_floor = true, floor = "all") surfaces.each do |surface| result = surface.setWindowToWallRatio(ratio,offset,height_offset_from_floor) raise( "Unable to set FWR for surface " + surface.getAttribute("name").to_s + " . Possible reasons are if the surface is not a wall, if the surface is not rectangular in face coordinates, if requested ratio is too large (window area ~= surface area) or too small (min dimension of window < 1 foot), or if the window clips any remaining sub surfaces. Otherwise, removes all existing windows and adds new window to meet requested ratio.") unless result end return surfaces end |
.set_surfaces_boundary_condition(model, surfaces, boundaryCondition) ⇒ Object
This method sets the boundary condition for a surface and it’s matching surface.
If set to adiabatic, it will remove all subsurfaces since E+ cannot have adiabatic sub surfaces.
2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2774 def self.set_surfaces_boundary_condition(model,surfaces, boundaryCondition) surfaces = BTAP::Common::validate_array(model,surfaces,"Surface") if OpenStudio::Model::Surface::validOutsideBoundaryConditionValues.include?(boundaryCondition) surfaces.each do |surface| if boundaryCondition == "Adiabatic" #need to remove subsurface as you cannot have a adiabatic surface with a #subsurface. surface.subSurfaces.each do |subsurface| subsurface.remove end #A bug with adiabatic surfaces. They do not hold the default contruction. surface.setConstruction( surface.construction.get() ) if surface.isConstructionDefaulted end surface.setOutsideBoundaryCondition(boundaryCondition) adj_surface = surface.adjacentSurface unless adj_surface.empty? adj_surface.get.setOutsideBoundaryCondition( boundaryCondition ) end end else puts "ERROR: Invalid Boundary Condition = " + boundary_condition puts "Correct Values are:" puts OpenStudio::Model::Surface::validOutsideBoundaryConditionValues end end |
.set_surfaces_construction(surfaces, construction) ⇒ Object
2765 2766 2767 2768 2769 2770 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2765 def self.set_surfaces_construction(surfaces,construction) surfaces.each do |surface| surface.setConstruction(construction) end return true end |
.set_surfaces_construction_conductance(surfaces, conductance) ⇒ Object
This method creates a new construction based on the current, changes the rsi and assign the construction to the current surface. Most of the meat of this method is in the construction class. Testing is done there.
2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2735 def self.set_surfaces_construction_conductance(surfaces,conductance) surfaces.each do |surface| #a bit of acrobatics to get the construction object from the ConstrustionBase object's name. construction = OpenStudio::Model::getConstructionByName(surface.model,surface.construction.get.name.to_s).get #create a new construction with the requested conductance value based on the current construction. new_construction = BTAP::Resources::Envelope::Constructions::customize_opaque_construction(surface.model,construction,conductance) surface.setConstruction(new_construction) end return surfaces end |
.show(surfaces) ⇒ Object
2883 2884 2885 2886 2887 2888 2889 2890 2891 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2883 def self.show(surfaces) surfaces.each do |surface| if drawing_interface = surface.drawing_interface if entity = drawing_interface.entity entity.visible = false end end end end |