Class: BTAP::Activity
- Inherits:
-
Object
- Object
- BTAP::Activity
- Extended by:
- ActivityData
- Defined in:
- lib/openstudio-standards/btap/activity.rb
Instance Attribute Summary collapse
-
#activities ⇒ Hash
readonly
Collection of space ACTIVITIES, e.g.
-
#activity ⇒ String
readonly
Assigned or inferred building ACTIVITY, e.g.
-
#category ⇒ String
readonly
Building type CATEGORY, e.g.
-
#feedback ⇒ Hash
readonly
Logged messages.
-
#liveload ⇒ Float
readonly
Expected non-occupant liveload, e.g.
Instance Method Summary collapse
-
#act(space = nil) ⇒ String
Returns a space's activity, e.g.
-
#assignAncillarySchedules ⇒ Boolean
Sets schedules to ancillary spaces.
-
#assignAuxiliarySchedules(uset = false) ⇒ Boolean
Sets schedules to auxiliary spaces.
-
#bldg(space = nil) ⇒ String
Returns a space's building type, e.g.
-
#buildingActivity(model = nil) ⇒ String
Determines general building activity, either set by user or inferred.
-
#buildingActivity?(model = nil) ⇒ Boolean
Validates whether user has explicitly set a valid building activity AdditionalProperty.
-
#density(space = nil) ⇒ Float
Returns a space's occupant density (m2/occupant).
-
#eqpWm2(space = nil) ⇒ Float
Returns a space's peak receptacle load (W/m2).
-
#fOCC(space = nil) ⇒ Float
Returns a space's "factor for occupancy control" of lighting (Focc), per NECB 4.3.2.10.1 (2015-2025).
-
#fPERS(space = nil) ⇒ Float
Returns a space's "factor for personal control" of lighting (Fpers), per NECB 4.3.2.10.2 (2015-2025).
-
#initialize(model = nil, option = "") ⇒ Activity
constructor
Initialize BTAP Activity parameters.
-
#keyword(space = nil) ⇒ String
Returns a space's BTAP::Activity keyword, e.g.
-
#m2(space = nil) ⇒ Float
Returns a space's floor area (m2), factoring a space's multiplier.
-
#neighbours(space = nil) ⇒ Array
Collects list of neighbouring (side-by-side), non-ancillary spaces.
-
#occsensing?(space = nil) ⇒ Boolean
Validates whether a space is targeted for occupancy-sensing lighting control, per NECB2011.
-
#schedule(space = nil) ⇒ String
Returns a space's (NECB-related) schedule set character, e.g.
-
#spaceActivities(model = nil) ⇒ Hash
Gather activities of occupied spaces in a model.
-
#swhWm2(space = nil) ⇒ Float
Returns a space's peak service water heating load (W/m2).
Methods included from ActivityData
ancillary?, auxiliary?, data, extended, occsensing_deprecated?, rp28?, wet?
Constructor Details
#initialize(model = nil, option = "") ⇒ Activity
Initialize BTAP Activity parameters.
440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 |
# File 'lib/openstudio-standards/btap/activity.rb', line 440 def initialize(model = nil, option = "") mth = "BTAP::Activity::#{__callee__}" @feedback = {logs: []} lgs = @feedback[:logs] @activity = "" @activities = {} @category = "" unless model.is_a?(OpenStudio::Model::Model) lgs << "Invalid or empty OpenStudio model (#{mth})" return end option = "" unless option == "structure" # Tag spaces as un/conditioned with "space_conditioning_category". For # now, this is simply determined based on whether spaces are: # - part of the total floor area (i.e. occupied) # - have "attic" included in their identifiers (i.e. unconditioned) # # As per ASHRE 90.1, OpenStudio-Standards distinguishes between: # - "nonresconditioned" vs # - "resconditioned" # # Sticking to "nonresconditioned" - NECBs do not distinguish between "res" # vs "non-res" (for e.g. envelope), as opposed to ASHRAE 90.1. # # The solution could be further refined in future BTAP versions by e.g.: # - relying on user-defined thermostats # - expanded to cover semi-heated and refrigerated spaces tag = "space_conditioning_category" model.getSpaces.each do |space| next unless space.additionalProperties.getFeatureAsString(tag).empty? if space.partofTotalFloorArea space.additionalProperties.setFeature(tag, "nonresconditioned") else if space.nameString.downcase.include?("attic") if option.empty? space.additionalProperties.setFeature(tag, "nonresconditioned") else space.additionalProperties.setFeature(tag, "unconditioned") end else # treat all other cases as indirectly-conditioned e.g. plenums space.additionalProperties.setFeature(tag, "nonresconditioned") end end end # Determine activities of occupied spaces in the model, then building. @activities = self.spaceActivities(model) @activity = self.buildingActivity(model) @liveload = data[:bldg][:activity][@activity][:liveload] # Assign building category. unless @activity.empty? @category = data[:bldg][:activity][@activity][:category] end # Assign schedules to auxiliary spaces - if present. self.assignAuxiliarySchedules(self.buildingActivity?(model)) # Assign schedules to ancillary spaces - if present. self.assignAncillarySchedules true end |
Instance Attribute Details
#activities ⇒ Hash (readonly)
Returns collection of space ACTIVITIES, e.g. "bulk::warehouse".
423 424 425 |
# File 'lib/openstudio-standards/btap/activity.rb', line 423 def activities @activities end |
#activity ⇒ String (readonly)
Returns assigned or inferred building ACTIVITY, e.g. "warehouse".
420 421 422 |
# File 'lib/openstudio-standards/btap/activity.rb', line 420 def activity @activity end |
#category ⇒ String (readonly)
Returns building type CATEGORY, e.g. "industry".
426 427 428 |
# File 'lib/openstudio-standards/btap/activity.rb', line 426 def category @category end |
#feedback ⇒ Hash (readonly)
Returns logged messages.
432 433 434 |
# File 'lib/openstudio-standards/btap/activity.rb', line 432 def feedback @feedback end |
#liveload ⇒ Float (readonly)
Returns expected non-occupant liveload, e.g. 90 kg/m2.
429 430 431 |
# File 'lib/openstudio-standards/btap/activity.rb', line 429 def liveload @liveload end |
Instance Method Details
#act(space = nil) ⇒ String
Returns a space's activity, e.g. "corridor" in "corridor::hospital".
908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 |
# File 'lib/openstudio-standards/btap/activity.rb', line 908 def act(space = nil) lgs = @feedback[:logs] mth = "BTAP::Activity::#{__callee__}" cl = OpenStudio::Model::Space unless space.is_a?(OpenStudio::Model::Space) lgs << "Invalid or empty OpenStudio space (#{mth})" return "" end unless @activities.key?(space) lgs << "Unlisted space #{space.nameString} (#{mth})" return "" end @activities[space][:activity] end |
#assignAncillarySchedules ⇒ Boolean
Sets schedules to ancillary spaces.
833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 |
# File 'lib/openstudio-standards/btap/activity.rb', line 833 def assignAncillarySchedules lgs = @feedback[:logs] mth = "BTAP::Activity::#{__callee__}" bkup = "a" if @@data[:bldg][:activity].key?(@activity) bkup = @@data[:bldg][:activity][@activity][:schedule] end # Loop through ancillary spaces (largest to smallest in floor area). @activities.sort_by { |space, v| v[:m2] }.reverse.each do |space, v| id = space.nameString next unless self.ancillary?(v[:keyword]) # Retrieve each space's non-ancillary neighbours. schedules = {} schedule = bkup self.neighbours(space).each do |nghbour| next unless @activities.key?(nghbour) sched = @activities[nghbour][:schedule] m2 = @activities[nghbour][:m2] schedules[sched] = 0 unless schedules.key?(sched) schedules[sched] += m2 end if schedules.empty? # Assign common building schedule if no non-ancillary adjacent spaces. lgs << "Assigning BUILDING schedule #{bkup} for #{id} (#{mth})" v[:schedule] = bkup else v[:schedule] = schedules.sort_by { |sched, m2| m2 }.reverse.first.first end # Forcing schedule set 'J' for ancillary spaces in: # - short-term accomodation (e.g. hotels, firestation quarters) # - housing (MURBs, dormitories) v[:schedule] = "j" if ["f", "g"].include?(v[:schedule]) end true end |
#assignAuxiliarySchedules(uset = false) ⇒ Boolean
Sets schedules to auxiliary spaces.
807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 |
# File 'lib/openstudio-standards/btap/activity.rb', line 807 def assignAuxiliarySchedules(uset = false) lgs = @feedback[:logs] mth = "BTAP::Activity::#{__callee__}" bkup = "a" uset = false unless [true, false].include?(uset) if @@data[:bldg][:activity].key?(@activity) bkup = @@data[:bldg][:activity][@activity][:schedule] end # Loop through auxiliary spaces (largest to smallest in floor area). @activities.sort_by { |space, v| v[:m2] }.reverse.each do |space, v| id = space.nameString sch = self.schedule(space) next unless self.auxiliary?(v[:keyword]) v[:schedule] = uset ? bkup : sch.delete("*") end true end |
#bldg(space = nil) ⇒ String
Returns a space's building type, e.g. "hospital" in "corridor::hospital".
932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 |
# File 'lib/openstudio-standards/btap/activity.rb', line 932 def bldg(space = nil) lgs = @feedback[:logs] mth = "BTAP::Activity::#{__callee__}" cl = OpenStudio::Model::Space unless space.is_a?(OpenStudio::Model::Space) lgs << "Invalid or empty OpenStudio space (#{mth})" return "" end unless @activities.key?(space) lgs << "Unlisted space #{space.nameString} (#{mth})" return "" end @activities[space][:bldgtype] end |
#buildingActivity(model = nil) ⇒ String
Determines general building activity, either set by user or inferred.
603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 |
# File 'lib/openstudio-standards/btap/activity.rb', line 603 def buildingActivity(model = nil) lgs = @feedback[:logs] mth = "BTAP::Activity::#{__callee__}" unless model.is_a?(OpenStudio::Model::Model) lgs << "Invalid or empty OpenStudio model (#{mth})" return "office" end # OPTION A: Extract building activity from user-set 'additionalProperty'. tag = "btap_building_activity" bldg = model.getBuilding activity = bldg.additionalProperties.getFeatureAsString(tag) if activity.empty? activity = "" else activity = activity.get.downcase return activity if data[:bldg][:activities].include?(activity) end # OPTION B: Extract building activity from user-set 'building type'. bldgtype = model.getBuilding.standardsBuildingType unless bldgtype.empty? bldgtype = bldgtype.get.downcase candidates = [] fallbacks = [] # Fetch matching BTAP data, if keywords included. data[:bldg][:activity].each do |k, v| v[:includes].each do |kword| candidates << k if bldgtype.include?(kword) end end # Keep track of fallbacks, if applicable. candidates.each do |candidate| fallback = data[:bldg][:activity][candidate][:fallback] fallbacks << fallback unless fallback.empty? end # Reject if matching excluded keywords. data[:bldg][:activity].each do |k, v| v[:excludes].each do |kword| candidates.delete(k) if bldgtype.include?(kword) end end # Fallbacks? if candidates.empty? fallbacks.each do |fallback| return fallback if data[:bldg][:activity].key?(fallback) end else return candidates.first end end # OPTION C: Infer building activity from distribution of spacetypes. bldgtypes = {} @activities.values.each do |v| next unless v.key?(:m2) next unless v.key?(:bldgtype) bldgtypes[v[:bldgtype]] = 0 unless bldgtypes.include?(v[:bldgtype]) bldgtypes[v[:bldgtype]] += v[:m2] end activity = bldgtypes.sort.reverse.to_h.keys.first unless bldgtypes.empty? # Many NECB space types are listed as "common". Examples include spaces # that are educational in nature (e.g. "classroom", "teachinglabs") and # typical office spaces (e.g. "openplan", "office"). This is odd, as NECBs # list "school/university" and "office" as admissible building types. # Inferring an overall building type/activity (e.g. "school"), based on # the prevalence of space types (e.g. "classrooms") in a model, becomes # unnecessarily challenging. A fallback solution is needed when # predominant space types end up as "common" for a given model. # # One odd exception is 'audience' seating for an "auditorium", which is # found in all NECB editions. All listed 'audience' seating space types # are linked to a listed building type, e.g.: # - "religious building" # - "sports arena" # - "motion picture theatre" # # ... except for "auditorium". No NECB edition holds an "auditorium" # building type entry. For the moment, "auditorium" == "theatre". if activity == "common" activities = {} @activities.values.each do |v| next unless v.key?(:m2) next unless v.key?(:activity) activities[v[:activity]] = 0 unless activities.key?(v[:activity]) activities[v[:activity]] += v[:m2] end activity = case activities.sort.reverse.to_h.keys.first when "audience" then "theatre" when "sales" then "retail" when "dining" then "restaurant" when "cuisine" then "restaurant" when "rooms" then "hotel" when "recreation" then "exercise" when "cell" then "penitentiary" when "classroom" then "school" when "teachinglab" then "school" when "storage" then "warehouse" when "laundry" then "retail" when "lounge" then "leisure" when "pharmacy" then "retail" else "office" end end # Log warning. if activity.empty? lgs << "Assigning building activity 'office' (#{mth})" activity = "office" end activity = "hospital" if activity == "health" activity end |
#buildingActivity?(model = nil) ⇒ Boolean
Validates whether user has explicitly set a valid building activity AdditionalProperty.
739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 |
# File 'lib/openstudio-standards/btap/activity.rb', line 739 def buildingActivity?(model = nil) lgs = @feedback[:logs] mth = "BTAP::Activity::#{__callee__}" cl = OpenStudio::Model::Model unless model.is_a?(OpenStudio::Model::Model) lgs << "Invalid or empty OpenStudio model (#{mth})" return false end tag = "btap_building_activity" bldg = model.getBuilding activity = bldg.additionalProperties.getFeatureAsString(tag) return false if activity.empty? activity = activity.get.downcase return false unless data[:bldg][:activities].include?(activity) true end |
#density(space = nil) ⇒ Float
Returns a space's occupant density (m2/occupant).
980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 |
# File 'lib/openstudio-standards/btap/activity.rb', line 980 def density(space = nil) lgs = @feedback[:logs] mth = "BTAP::Activity::#{__callee__}" cl = OpenStudio::Model::Space unless space.is_a?(OpenStudio::Model::Space) lgs << "Invalid or empty OpenStudio space (#{mth})" return 0.0 end unless @activities.key?(space) lgs << "Unlisted space #{space.nameString} (#{mth})" return 0.0 end @activities[space][:density] end |
#eqpWm2(space = nil) ⇒ Float
Returns a space's peak receptacle load (W/m2).
1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 |
# File 'lib/openstudio-standards/btap/activity.rb', line 1004 def eqpWm2(space = nil) lgs = @feedback[:logs] mth = "BTAP::Activity::#{__callee__}" cl = OpenStudio::Model::Space unless space.is_a?(OpenStudio::Model::Space) lgs << "Invalid or empty OpenStudio space (#{mth})" return 0.0 end unless @activities.key?(space) lgs << "Unlisted space #{space.nameString} (#{mth})" return 0.0 end @activities[space][:eqpload] end |
#fOCC(space = nil) ⇒ Float
Returns a space's "factor for occupancy control" of lighting (Focc), per NECB 4.3.2.10.1 (2015-2025).
1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 |
# File 'lib/openstudio-standards/btap/activity.rb', line 1118 def fOCC(space = nil) lgs = @feedback[:logs] mth = "BTAP::Activity::#{__callee__}" cl = OpenStudio::Model::Space unless space.is_a?(OpenStudio::Model::Space) lgs << "Invalid or empty OpenStudio space (#{mth})" return 1.0 end unless @activities.key?(space) lgs << "Unlisted space #{space.nameString} (#{mth})" return 1.0 end activity = @activities[space][:keyword] # Focc = 1 - Ca x Cocc, where: # Ca = factor to account for the relative absence of occupants # Cocc = factor to account for the occupancy-sensing mechanism cA = case activity when "audience::convention" then 0.2 when "audience::religious" then 0.3 when "classroom::common" then 0.5 when "classroom::penitentiary" then 0.5 when "computer::common" then 0.7 when "server::common" then 0.7 when "meeting::common" then 0.5 when "copiers::common" then 0.2 when "tribunal::court" then 0.2 when "dressing::theatre" then 0.4 when "mechanical::common" then 0.9 when "emergency::common" then 0.5 when "teachinglab::common" then 0.4 when "locker::common" then 0.5 when "openplan::common" then 0.2 when "office::common" then 0.3 when "garage::parking" then 0.4 when "storage::common" then 0.6 when "washroom::common" then 0.5 when "supplies::health" then 0.5 when "exam::health" then 0.3 when "operating::health" then 0.1 when "patient::health" then 0.1 when "therapy::health" then 0.2 when "equipment::manufacturing" then 0.2 when "restoration::museum" then 0.3 when "exhibit::museum" then 0.2 when "refectory::religious" then 0.3 when "pulpit::religious" then 0.1 when "dressing::retail" then 0.4 when "chapel::religious" then 0.5 when "recreation::common" then 0.2 when "bulk::warehouse" then 0.5 when "fine::warehouse" then 0.5 else 0.0 end return 1.0 if cA.round(1) == 0.0 # NECB 2025 Table 4.3.2.10.-B : Cocc # _____________________________________________________________ ____ # automatic FULL OFF (FULL ON) 0.67 # automatic FULL OFF (manual ON or automatic PARTIAL ON) 0.75 # automatic PARTIAL OFF (manual ON) 0.34 # manual (ON/OFF or bi-level) – enclosed office less than 25 m2 0.30 # manual – all other spaces 0.10 # none 0.00 # # The conditional application of lighting controls is often subject to # professional judgment (as described in the NECB). Automating their # assignment (e.g. Cocc within BTAP) becomes particularly challenging. # # The following are tentative postulates governing the automated # application of Cocc - needs a deeper dive, @todo: # # - almost all spaces require manual ON # - almost all spaces require automated or scheduled OFF (only) # - so by default, spaces with Ca > 0 (see above): Cocc of 0.75 # # - spaces with automated PARTIAL OFF control have a Cocc of 0.34 # # - all other (unlisted) spaces: Cocc of 0.10. cOCC = case activity when "audience::convention" then 0.75 when "audience::religious" then 0.75 when "classroom::common" then 0.75 when "classroom::penitentiary" then 0.75 when "computer::common" then 0.75 when "server::common" then 0.75 when "meeting::common" then 0.75 when "copiers::common" then 0.75 when "tribunal::court" then 0.75 when "dressing::theatre" then 0.75 when "mechanical::common" then 0.75 when "emergency::common" then 0.75 when "teachinglab::common" then 0.34 # when "locker::common" then 0.75 when "openplan::common" then 0.75 when "office::common" then 0.75 when "garage::parking" then 0.34 # when "storage::common" then 0.75 when "washroom::common" then 0.75 when "supplies::health" then 0.75 when "exam::health" then 0.75 when "operating::health" then 0.75 when "patient::health" then 0.75 when "therapy::health" then 0.75 when "equipment::manufacturing" then 0.75 when "restoration::museum" then 0.75 when "exhibit::museum" then 0.75 when "refectory::religious" then 0.75 when "pulpit::religious" then 0.75 when "dressing::retail" then 0.75 when "chapel::religious" then 0.75 when "recreation::common" then 0.75 when "bulk::warehouse" then 0.34 # when "fine::warehouse" then 0.34 # else 0.10 end # Reset cOCC if small enclosed offices. cOCC = 0.30 if activity == "office::common" && space.floorArea < 25 1.0 - cA * cOCC end |
#fPERS(space = nil) ⇒ Float
Returns a space's "factor for personal control" of lighting (Fpers), per NECB 4.3.2.10.2 (2015-2025).
1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 |
# File 'lib/openstudio-standards/btap/activity.rb', line 1252 def fPERS(space = nil) lgs = @feedback[:logs] mth = "BTAP::Activity::#{__callee__}" cl = OpenStudio::Model::Space unless space.is_a?(OpenStudio::Model::Space) lgs << "Invalid or empty OpenStudio space (#{mth})" return 1.0 end unless @activities.key?(space) lgs << "Unlisted space #{space.nameString} (#{mth})" return 1.0 end activity = @activities[space][:keyword] return 0.9 if activity == "teachinglab::common" return 0.9 if activity == "openplan::common" return 0.9 if activity == "office::common" return 0.9 if activity == "patient::health" 1.0 end |
#keyword(space = nil) ⇒ String
Returns a space's BTAP::Activity keyword, e.g. "corridor::hospital".
884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 |
# File 'lib/openstudio-standards/btap/activity.rb', line 884 def keyword(space = nil) lgs = @feedback[:logs] mth = "BTAP::Activity::#{__callee__}" cl = OpenStudio::Model::Space unless space.is_a?(OpenStudio::Model::Space) lgs << "Invalid or empty OpenStudio space (#{mth})" return "" end unless @activities.key?(space) lgs << "Unlisted space #{space.nameString} (#{mth})" return "" end @activities[space][:keyword] end |
#m2(space = nil) ⇒ Float
Returns a space's floor area (m2), factoring a space's multiplier.
956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 |
# File 'lib/openstudio-standards/btap/activity.rb', line 956 def m2(space = nil) lgs = @feedback[:logs] mth = "BTAP::Activity::#{__callee__}" cl = OpenStudio::Model::Space unless space.is_a?(OpenStudio::Model::Space) lgs << "Invalid or empty OpenStudio space (#{mth})" return 0.0 end unless @activities.key?(space) lgs << "Unlisted space #{space.nameString} (#{mth})" return 0.0 end @activities[space][:m2] end |
#neighbours(space = nil) ⇒ Array
Collects list of neighbouring (side-by-side), non-ancillary spaces. Here, non-ancillary spaces include ancillary spaces that have valid assigned schedule sets.
768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 |
# File 'lib/openstudio-standards/btap/activity.rb', line 768 def neighbours(space = nil) lgs = @feedback[:logs] mth = "BTAP::Activity::#{__callee__}" cl = OpenStudio::Model::Space unless space.is_a?(OpenStudio::Model::Space) lgs << "Invalid or empty OpenStudio space (#{mth})" return {} end nghbours = [] space.surfaces.each do |s| next unless s.surfaceType.downcase == "wall" voisin = s.adjacentSurface next if voisin.empty? espace = voisin.get.space next if espace.empty? espace = espace.get next if espace == space next if nghbours.include?(espace) next unless @activities.key?(espace) next unless @activities[espace][:schedule] != "*" nghbours << espace end nghbours end |
#occsensing?(space = nil) ⇒ Boolean
Validates whether a space is targeted for occupancy-sensing lighting control, per NECB2011.
1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 |
# File 'lib/openstudio-standards/btap/activity.rb', line 1077 def occsensing?(space = nil) lgs = @feedback[:logs] mth = "BTAP::Activity::#{__callee__}" cl = OpenStudio::Model::Space unless space.is_a?(OpenStudio::Model::Space) lgs << "Invalid or empty OpenStudio space (#{mth})" return false end unless @activities.key?(space) lgs << "Unlisted space #{space.nameString} (#{mth})" return false end activity = @activities[space][:keyword] area = space.floorArea return true if activity == "classroom::common" return true if activity == "classroom::penitentiary" return true if activity == "meeting::common" return true if activity == "lounge::common" return true if activity == "lounge::health" return true if activity == "storage::common" && area.round < 100 return true if activity == "supplies::health" && area.round < 100 return true if activity == "copiers::common" return true if activity == "office::common" && area.round < 25 return true if activity == "washroom::common" return true if activity == "dressing::theatre" return true if activity == "dressing::retail" return true if activity == "locker::common" false end |
#schedule(space = nil) ⇒ String
Returns a space's (NECB-related) schedule set character, e.g. "a".
1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 |
# File 'lib/openstudio-standards/btap/activity.rb', line 1052 def schedule(space = nil) lgs = @feedback[:logs] mth = "BTAP::Activity::#{__callee__}" cl = OpenStudio::Model::Space unless space.is_a?(OpenStudio::Model::Space) lgs << "Invalid or empty OpenStudio space (#{mth})" return "" end unless @activities.key?(space) lgs << "Unlisted space #{space.nameString} (#{mth})" return "" end @activities[space][:schedule] end |
#spaceActivities(model = nil) ⇒ Hash
Gather activities of occupied spaces in a model.
515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 |
# File 'lib/openstudio-standards/btap/activity.rb', line 515 def spaceActivities(model = nil) lgs = @feedback[:logs] mth = "BTAP::Activity::#{__callee__}" unless model.is_a?(OpenStudio::Model::Model) lgs << "Invalid or empty OpenStudio model (#{mth})" return {} end activities = {} model.getSpaces.each do |space| next unless space.partofTotalFloorArea # Defaulted values (if missing or invalid entries). spacetype = nil standards = "" activity = "" bldgtype = "" fallbacks = [] candidates = [] # Recover user-set space types? unless space.spaceType.empty? spacetype = space.spaceType.get stdstype = spacetype.standardsSpaceType standards = stdstype.get.downcase unless stdstype.empty? end # Fetch matching BTAP data, if keywords included. data[:space][:activity].each do |k, v| v[:includes].each do |kword| candidates << k if standards.include?(kword) end end # Keep track of fallbacks, if applicable. candidates.each do |candidate| fallback = data[:space][:activity][candidate][:fallback] fallbacks << fallback unless fallback.empty? end # Reject if matching any excluded keyword. data[:space][:activity].each do |k, v| v[:excludes].each do |kword| candidates.delete(k) if standards.include?(kword) end end # Fallbacks? if candidates.empty? candidate = "" fallbacks.each do |fallback| break unless candidate.empty? candidate = fallback if data[:space][:activity].key?(fallback) end candidate = data[:space][:activity].keys.first if candidate.empty? else candidate = candidates.first end entry = {} entry[:m2 ] = space.floorArea * space.multiplier entry[:spacetype] = spacetype entry[:standards] = standards entry[:keyword ] = candidate entry[:activity ] = data[:space][:activity][candidate][:activity] entry[:bldgtype ] = data[:space][:activity][candidate][:bldgtype] entry[:density ] = data[:space][:activity][candidate][:density] entry[:eqpload ] = data[:space][:activity][candidate][:eqpload] entry[:swhload ] = data[:space][:activity][candidate][:swhload] entry[:schedule ] = data[:space][:activity][candidate][:schedule] activities[space] = entry end activities end |
#swhWm2(space = nil) ⇒ Float
Returns a space's peak service water heating load (W/m2).
1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 |
# File 'lib/openstudio-standards/btap/activity.rb', line 1028 def swhWm2(space = nil) lgs = @feedback[:logs] mth = "BTAP::Activity::#{__callee__}" cl = OpenStudio::Model::Space unless space.is_a?(OpenStudio::Model::Space) lgs << "Invalid or empty OpenStudio space (#{mth})" return 0.0 end unless @activities.key?(space) lgs << "Unlisted space #{space.nameString} (#{mth})" return 0.0 end @activities[space][:swhload] end |