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(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
2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2549 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
2858 2859 2860 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2858 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
2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2789 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
2847 2848 2849 2850 2851 2852 2853 2854 2855 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2847 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
2782 2783 2784 2785 2786 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2782 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
2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2819 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”
2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2684 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
2740 2741 2742 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2740 def self.get_sub_surface_net_area(subsurface) return subsurface.netArea() end |
.get_subsurfaces_from_surfaces(surface_array) ⇒ Object
2632 2633 2634 2635 2636 2637 2638 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2632 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.
2729 2730 2731 2732 2733 2734 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2729 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
2736 2737 2738 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2736 def self.get_surface_net_area(surface) return surface.netArea() end |
.get_surfaces_from_building_stories(story_array) ⇒ Object
2614 2615 2616 2617 2618 2619 2620 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2614 def self.get_surfaces_from_building_stories(story_array) surfaces = Array.new() get_spaces_from_storeys(story_array).each do |space| surfaces.concat(space.surfaces()) end return surfaces end |
.get_surfaces_from_spaces(spaces_array) ⇒ Object
2606 2607 2608 2609 2610 2611 2612 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2606 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
2622 2623 2624 2625 2626 2627 2628 2629 2630 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2622 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
2669 2670 2671 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2669 def self.get_total_ext_fenestration_area(model) end |
.get_total_ext_floor_area(model) ⇒ Object
2664 2665 2666 2667 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2664 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
2673 2674 2675 2676 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2673 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.
2656 2657 2658 2659 2660 2661 2662 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2656 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.
2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2643 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
2873 2874 2875 2876 2877 2878 2879 2880 2881 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2873 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 )
2599 2600 2601 2602 2603 2604 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2599 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
2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2567 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
2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2580 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.
2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2754 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
2745 2746 2747 2748 2749 2750 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2745 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.
2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2715 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
2863 2864 2865 2866 2867 2868 2869 2870 2871 |
# File 'lib/openstudio-standards/btap/geometry.rb', line 2863 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 |