Class: OpenStudio::Model::Space
- Inherits:
-
Object
- Object
- OpenStudio::Model::Space
- Defined in:
- lib/openstudio-standards/standards/Standards.Space.rb
Overview
open the class to add methods to apply HVAC efficiency standards
Instance Method Summary collapse
-
#add_daylighting_controls(template, remove_existing_controls, draw_daylight_areas_for_debugging = false) ⇒ Hash
Adds daylighting controls (sidelighting and toplighting) per the template.
-
#apply_infiltration_rate(template) ⇒ Double
Set the infiltration rate for this space to include the impact of air leakage requirements in the standard.
-
#component_infiltration_rate(template) ⇒ Double
Determine the component infiltration rate for this space.
-
#conditioning_category(template, climate_zone) ⇒ String
Determines whether the space is conditioned per 90.1, which is based on heating and cooling loads.
-
#cooled? ⇒ Bool
Determines cooling status.
-
#daylighted_areas(template, draw_daylight_areas_for_debugging = false) ⇒ Hash
Returns values for the different types of daylighted areas in the space.
-
#design_internal_load ⇒ Double
Determine the design internal load (W) for this space without space multipliers.
-
#exterior_wall_and_roof_and_subsurface_area ⇒ Double
Calculate the area of the exterior walls, including the area of the windows on these walls.
-
#exterior_wall_and_window_area ⇒ Double
Calculate the area of the exterior walls, including the area of the windows on these walls.
- #get_adjacent_space_with_most_shared_wall_area(same_floor = true) ⇒ Object
-
#get_adjacent_spaces_with_shared_wall_areas(same_floor = true) ⇒ Object
will return a sorted array of array of spaces and connected area (Descending).
-
#heated? ⇒ Bool
Determines heating status.
-
#plenum? ⇒ Boolean
Determine if the space is a plenum.
-
#residential?(template) ⇒ Boolean
Determine if the space is residential based on the space type properties for the space.
-
#sidelighting_effective_aperture(primary_sidelighted_area) ⇒ Double
Returns the sidelighting effective aperture sidelighting_effective_aperture = E(window area * window VT) / primary_sidelighted_area.
-
#skylight_effective_aperture(toplighted_area) ⇒ Double
Returns the skylight effective aperture skylight_effective_aperture = E(0.85 * skylight area * skylight VT * WF) / toplighted_area.
Instance Method Details
#add_daylighting_controls(template, remove_existing_controls, draw_daylight_areas_for_debugging = false) ⇒ Hash
add a list of valid choices for template argument
add exception for retail spaces
add exception 2 for skylights with VT < 0.4
add exception 3 for CZ 8 where lighting < 200W
stop skipping non-vertical walls
stop skipping non-horizontal roofs
Determine the illuminance setpoint for the controls based on space type
rotate sensor to face window (only needed for glare calcs)
This method is super complicated because of all the polygon/geometry math required. and therefore may not return perfect results. However, it works well in most tested situations. When it fails, it will log warnings/errors for users to see.
Adds daylighting controls (sidelighting and toplighting) per the template
783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 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 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 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 1110 1111 1112 1113 1114 1115 1116 1117 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 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 |
# File 'lib/openstudio-standards/standards/Standards.Space.rb', line 783 def add_daylighting_controls(template, remove_existing_controls, draw_daylight_areas_for_debugging = false) OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', "******For #{name}, adding daylight controls.") # Check for existing daylighting controls # and remove if specified in the input existing_daylighting_controls = daylightingControls unless existing_daylighting_controls.empty? if remove_existing_controls existing_daylighting_controls.each(&:remove) OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.Space', "For #{name}, removed #{existing_daylighting_controls.size} existing daylight controls before adding new controls.") else OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.Space', "For #{name}, daylight controls were already present, no additional controls added.") return false end end # Skip this space if it has no exterior windows or skylights ext_fen_area_m2 = 0 surfaces.each do |surface| next unless surface.outsideBoundaryCondition == 'Outdoors' surface.subSurfaces.each do |sub_surface| next unless sub_surface.subSurfaceType == 'FixedWindow' || sub_surface.subSurfaceType == 'OperableWindow' || sub_surface.subSurfaceType == 'Skylight' || sub_surface.subSurfaceType == 'GlassDoor' ext_fen_area_m2 += sub_surface.netArea end end if ext_fen_area_m2.zero? OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.Space', "For #{name}, daylighting control not applicable because no exterior fenestration is present.") return false end areas = nil req_top_ctrl = false req_pri_ctrl = false req_sec_ctrl = false # Get the area of the space space_area_m2 = floorArea # Get the LPD of the space space_lpd_w_per_m2 = lightingPowerPerFloorArea # Determine the type of control required case template when 'DOE Ref Pre-1980', 'DOE Ref 1980-2004', '90.1-2004', '90.1-2007' # Do nothing, no daylighting controls required OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.Space', "For #{name}, daylighting control not required by this standard.") return false when '90.1-2010' req_top_ctrl = true req_pri_ctrl = true areas = daylighted_areas(template, draw_daylight_areas_for_debugging) ################### OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', "primary_sidelighted_area = #{areas['primary_sidelighted_area']}") ################### # Sidelighting # Check if the primary sidelit area < 250 ft2 if areas['primary_sidelighted_area'] == 0.0 OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', "For #{name}, primary sidelighting control not required because primary sidelighted area = 0ft2 per 9.4.1.4.") req_pri_ctrl = false elsif areas['primary_sidelighted_area'] < OpenStudio.convert(250, 'ft^2', 'm^2').get OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.Space', "For #{name}, primary sidelighting control not required because primary sidelighted area < 250ft2 per 9.4.1.4.") req_pri_ctrl = false else # Check effective sidelighted aperture sidelighted_effective_aperture = sidelighting_effective_aperture(areas['primary_sidelighted_area']) ################### OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', "sidelighted_effective_aperture_pri = #{sidelighted_effective_aperture}") ################### if sidelighted_effective_aperture < 0.1 OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.Space', "For #{name}, primary sidelighting control not required because sidelighted effective aperture < 0.1 per 9.4.1.4 Exception b.") req_pri_ctrl = false end end ################### OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', "toplighted_area = #{areas['toplighted_area']}") ################### # Toplighting # Check if the toplit area < 900 ft2 if areas['toplighted_area'] == 0.0 OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', "For #{name}, toplighting control not required because toplighted area = 0ft2 per 9.4.1.5.") req_top_ctrl = false elsif areas['toplighted_area'] < OpenStudio.convert(900, 'ft^2', 'm^2').get OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.Space', "For #{name}, toplighting control not required because toplighted area < 900ft2 per 9.4.1.5.") req_top_ctrl = false else # Check effective sidelighted aperture sidelighted_effective_aperture = skylight_effective_aperture(areas['toplighted_area']) ################### OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', "sidelighted_effective_aperture_top = #{sidelighted_effective_aperture}") ################### if sidelighted_effective_aperture < 0.006 OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.Space', "For #{name}, toplighting control not required because skylight effective aperture < 0.006 per 9.4.1.5 Exception b.") req_top_ctrl = false end end when '90.1-2013' req_top_ctrl = true req_pri_ctrl = true req_sec_ctrl = true areas = daylighted_areas(template, draw_daylight_areas_for_debugging) # Primary Sidelighting # Check if the primary sidelit area contains less than 150W of lighting if areas['primary_sidelighted_area'] == 0.0 OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', "For #{name}, primary sidelighting control not required because primary sidelighted area = 0ft2 per 9.4.1.1(e).") req_pri_ctrl = false elsif areas['primary_sidelighted_area'] * space_lpd_w_per_m2 < 150.0 OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.Space', "For #{name}, primary sidelighting control not required because less than 150W of lighting are present in the primary daylighted area per 9.4.1.1(e).") req_pri_ctrl = false else # Check the size of the windows if areas['total_window_area'] < OpenStudio.convert(20.0, 'ft^2', 'm^2').get OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.Space', "For #{name}, primary sidelighting control not required because there are less than 20ft2 of window per 9.4.1.1(e) Exception 2.") req_pri_ctrl = false end end # Secondary Sidelighting # Check if the primary and secondary sidelit areas contains less than 300W of lighting if areas['secondary_sidelighted_area'] == 0.0 OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', "For #{name}, secondary sidelighting control not required because secondary sidelighted area = 0ft2 per 9.4.1.1(e).") req_sec_ctrl = false elsif (areas['primary_sidelighted_area'] + areas['secondary_sidelighted_area']) * space_lpd_w_per_m2 < 300 OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.Space', "For #{name}, secondary sidelighting control not required because less than 300W of lighting are present in the combined primary and secondary daylighted areas per 9.4.1.1(e).") req_sec_ctrl = false else # Check the size of the windows if areas['total_window_area'] < OpenStudio.convert(20.0, 'ft^2', 'm^2').get OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.Space', "For #{name}, secondary sidelighting control not required because there are less than 20ft2 of window per 9.4.1.1(e) Exception 2.") req_sec_ctrl = false end end # Toplighting # Check if the toplit area contains less than 150W of lighting if areas['toplighted_area'] == 0.0 OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', "For #{name}, toplighting control not required because toplighted area = 0ft2 per 9.4.1.1(f).") req_top_ctrl = false elsif areas['toplighted_area'] * space_lpd_w_per_m2 < 150 OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.Space', "For #{name}, toplighting control not required because less than 150W of lighting are present in the toplighted area per 9.4.1.1(f).") req_top_ctrl = false end when 'AssetScore' # Same as 90.1-2010 but without effective aperture limits # to avoid needing to perform run to get VLT for layered windows. req_top_ctrl = true req_pri_ctrl = true areas = daylighted_areas(template, draw_daylight_areas_for_debugging) # Sidelighting # Check if the primary sidelit area < 250 ft2 if areas['primary_sidelighted_area'] == 0.0 OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', "For #{name}, primary sidelighting control not required because primary sidelighted area = 0ft2 per 9.4.1.4.") req_pri_ctrl = false elsif areas['primary_sidelighted_area'] < OpenStudio.convert(250, 'ft^2', 'm^2').get OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.Space', "For #{name}, primary sidelighting control not required because primary sidelighted area < 250ft2 per 9.4.1.4.") req_pri_ctrl = false end # Toplighting # Check if the toplit area < 900 ft2 if areas['toplighted_area'] == 0.0 OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', "For #{name}, toplighting control not required because toplighted area = 0ft2 per 9.4.1.5.") req_top_ctrl = false elsif areas['toplighted_area'] < OpenStudio.convert(900, 'ft^2', 'm^2').get OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.Space', "For #{name}, toplighting control not required because toplighted area < 900ft2 per 9.4.1.5.") req_top_ctrl = false end end # End of template case statement # Output the daylight control requirements OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', "For #{name}, toplighting control required = #{req_top_ctrl}") OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', "For #{name}, primary sidelighting control required = #{req_pri_ctrl}") OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', "For #{name}, secondary sidelighting control required = #{req_sec_ctrl}") # Stop here if no lighting controls are required. # Do not put daylighting control points into the space. if !req_top_ctrl && !req_pri_ctrl && !req_sec_ctrl OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', "For #{name}, no daylighting control is required.") return false end # Record a floor in the space for later use floor_surface = nil surfaces.sort.each do |surface| if surface.surfaceType == 'Floor' floor_surface = surface break end end # Find all exterior windows/skylights in the space and record their azimuths and areas windows = {} skylights = {} surfaces.sort.each do |surface| next unless surface.outsideBoundaryCondition == 'Outdoors' && (surface.surfaceType == 'Wall' || surface.surfaceType == 'RoofCeiling') # Skip non-vertical walls and non-horizontal roofs straight_upward = OpenStudio::Vector3d.new(0, 0, 1) surface_normal = surface.outwardNormal if surface.surfaceType == 'Wall' # TODO: stop skipping non-vertical walls unless surface_normal.z.abs < 0.001 unless surface.subSurfaces.empty? OpenStudio.logFree(OpenStudio::Warn, 'openstudio.model.Space', "Cannot currently handle non-vertical walls; skipping windows on #{surface.name} in #{name} for daylight sensor positioning.") next end end elsif surface.surfaceType == 'RoofCeiling' # TODO: stop skipping non-horizontal roofs unless surface_normal.to_s == straight_upward.to_s unless surface.subSurfaces.empty? OpenStudio.logFree(OpenStudio::Warn, 'openstudio.model.Space', "Cannot currently handle non-horizontal roofs; skipping skylights on #{surface.name} in #{name} for daylight sensor positioning.") OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', "---Surface #{surface.name} has outward normal of #{surface_normal.to_s.gsub(/\[|\]/, '|')}; up is #{straight_upward.to_s.gsub(/\[|\]/, '|')}.") next end end end # Find the azimuth of the facade facade = nil group = surface.planarSurfaceGroup if group.is_initialized group = group.get site_transformation = group.buildingTransformation site_vertices = site_transformation * surface.vertices site_outward_normal = OpenStudio.getOutwardNormal(site_vertices) if site_outward_normal.empty? OpenStudio.logFree(OpenStudio::Error, 'openstudio.model.Space', "Could not compute outward normal for #{surface.name.get}") next end site_outward_normal = site_outward_normal.get north = OpenStudio::Vector3d.new(0.0, 1.0, 0.0) azimuth = if site_outward_normal.x < 0.0 360.0 - OpenStudio.radToDeg(OpenStudio.getAngle(site_outward_normal, north)) else OpenStudio.radToDeg(OpenStudio.getAngle(site_outward_normal, north)) end else # The surface is not in a group; should not hit, since # called from Space.surfaces next end # TODO: modify to work for buildings in the southern hemisphere? if azimuth >= 315.0 || azimuth < 45.0 facade = '4-North' elsif azimuth >= 45.0 && azimuth < 135.0 facade = '3-East' elsif azimuth >= 135.0 && azimuth < 225.0 facade = '1-South' elsif azimuth >= 225.0 && azimuth < 315.0 facade = '2-West' end # Label the facade as "Up" if it is a skylight if surface_normal.to_s == straight_upward.to_s facade = '0-Up' end # Loop through all subsurfaces and surface.subSurfaces.sort.each do |sub_surface| next unless sub_surface.outsideBoundaryCondition == 'Outdoors' && (sub_surface.subSurfaceType == 'FixedWindow' || sub_surface.subSurfaceType == 'OperableWindow' || sub_surface.subSurfaceType == 'Skylight') # Find the area net_area_m2 = sub_surface.netArea # Find the head height and sill height of the window vertex_heights_above_floor = [] sub_surface.vertices.each do |vertex| vertex_on_floorplane = floor_surface.plane.project(vertex) vertex_heights_above_floor << (vertex - vertex_on_floorplane).length end head_height_m = vertex_heights_above_floor.max # OpenStudio::logFree(OpenStudio::Info, "openstudio.model.Space", "---head height = #{head_height_m}m, sill height = #{sill_height_m}m") # Log the window properties to use when creating daylight sensors properties = { facade: facade, area_m2: net_area_m2, handle: sub_surface.handle, head_height_m: head_height_m, name: sub_surface.name.get.to_s } if facade == '0-Up' skylights[sub_surface] = properties else windows[sub_surface] = properties end end # next sub-surface end # next surface # Determine the illuminance setpoint for the controls based on space type # From IESNA Handbook 10th Edition - Applications daylight_stpt_lux = 300 # # # space_type = self.space_type # if space_type.empty? # OpenStudio::logFree(OpenStudio::Warn, "openstudio.model.Space", "Space #{space.name} is an unknown space type, assuming Office and 300 Lux daylight setpoint") # else # space_type = space_type.get # std_spc_type = space_type.standardsSpaceType # if std_spc_type.empty? # OpenStudio::logFree(OpenStudio::Warn, "openstudio.model.Space", "Space #{space.name} does not have a defined standards space type, assuming Office and 300 Lux daylight setpoint") # else # std_spc_type = std_spc_type.get # case std_spc_type # when # Storage = 50 # Corridor = 50 # Corridor2 = 50 # when # PatCorridor = 100 # 'Banquet = 100 # Basement = 100 # Cafe = 100 # Lobby = 100 # when # Dining = 150 # GuestRoom = 150 # GuestRoom2 = 150 # GuestRoom3 = 150 # GuestRoom4 = 150 # when # Mechanical = 200 # Retail = 200 # Retail2 = 200 # when # Laundry = 300 # Office = 300 # when # ER_NurseStn = 500 # ICU_Open = 500 # ICU_PatRm = 500 # Kitchen = 500 # Lab = 500 # NurseStn = 500 # ICU_NurseStn = 500 # PatRoom = 500 # PhysTherapy = 500 # Radiology = 500 # when # ER_Exam = 1000 # ER_Trauma = 1000 # ER_Triage = 1000 # when # OR = 2000 # # FullServiceRestaurant.Dining # FullServiceRestaurant # # Hospital.Corridor # Hospital.Dining # Hospital.ER_Exam # Hospital.ER_NurseStn # Hospital.ER_Trauma # Hospital.ER_Triage # Hospital.ICU_NurseStn # Hospital.ICU_Open # Hospital.ICU_PatRm # Hospital.Kitchen # Hospital.Lab # Hospital.Lobby # Hospital.NurseStn # Hospital.Office # Hospital.OR # Hospital.PatCorridor # Hospital.PatRoom # Hospital.PhysTherapy # Hospital.Radiology # # LargeHotel.Banquet # LargeHotel.Basement # LargeHotel.Cafe # LargeHotel.Corridor # LargeHotel.Corridor2 # LargeHotel.GuestRoom # LargeHotel.GuestRoom2 # LargeHotel.GuestRoom3 # LargeHotel.GuestRoom4 # LargeHotel.Kitchen # LargeHotel.Laundry # LargeHotel.Lobby # LargeHotel.Mechanical # LargeHotel.Retail # LargeHotel.Retail2 # LargeHotel.Storage # # MidriseApartment.Apartment # MidriseApartment.Corridor # MidriseApartment.Office # # Office # Office.Attic # Office.BreakRoom # Office.ClosedOffice # Office.Conference # Office.Corridor # Office.Elec/MechRoom # Office.IT_Room # Office.Lobby # Office.OpenOffice # Office.PrintRoom # Office.Restroom # Office.Stair # Office.Storage # Office.Vending # Office.WholeBuilding - Lg Office # Office.WholeBuilding - Md Office # Office.WholeBuilding - Sm Office # # Outpatient.Anesthesia # Outpatient.BioHazard # Outpatient.Cafe # Outpatient.CleanWork # Outpatient.Conference # Outpatient.DressingRoom # Outpatient.Elec/MechRoom # Outpatient.Exam # Outpatient.Hall # Outpatient.IT_Room # Outpatient.Janitor # Outpatient.Lobby # Outpatient.LockerRoom # Outpatient.Lounge # Outpatient.MedGas # Outpatient.MRI # Outpatient.MRI_Control # Outpatient.NurseStation # Outpatient.Office # Outpatient.OR # Outpatient.PACU # Outpatient.PhysicalTherapy # Outpatient.PreOp # Outpatient.ProcedureRoom # Outpatient.Soil Work # Outpatient.Stair # Outpatient.Toilet # Outpatient.Xray # # PrimarySchool.Cafeteria # PrimarySchool.Classroom # PrimarySchool.Corridor # PrimarySchool.Gym # PrimarySchool.Kitchen # PrimarySchool.Library # PrimarySchool.Lobby # PrimarySchool.Mechanical # PrimarySchool.Office # PrimarySchool.Restroom # # QuickServiceRestaurant.Dining # QuickServiceRestaurant.Kitchen # # Retail.Back_Space # Retail.Entry # Retail.Point_of_Sale # Retail.Retail # # SecondarySchool.Auditorium # SecondarySchool.Cafeteria # SecondarySchool.Classroom # SecondarySchool.Corridor # SecondarySchool.Gym # SecondarySchool.Kitchen # SecondarySchool.Library # SecondarySchool.Lobby # SecondarySchool.Mechanical # SecondarySchool.Office # SecondarySchool.Restroom # # SmallHotel.Attic # SmallHotel.Corridor # SmallHotel.Corridor4 # SmallHotel.Elec/MechRoom # SmallHotel.ElevatorCore # SmallHotel.ElevatorCore4 # SmallHotel.Exercise # SmallHotel.GuestLounge # SmallHotel.GuestRoom # SmallHotel.GuestRoom123Occ # SmallHotel.GuestRoom123Vac # SmallHotel.GuestRoom4Occ # SmallHotel.GuestRoom4Vac # SmallHotel.Laundry # SmallHotel.Mechanical # SmallHotel.Meeting # SmallHotel.Office # SmallHotel.PublicRestroom # SmallHotel.StaffLounge # SmallHotel.Stair # SmallHotel.Stair4 # SmallHotel.Storage # SmallHotel.Storage4 # # StripMall.WholeBuilding # # SuperMarket.Deli/Bakery # SuperMarket.DryStorage # SuperMarket.Office # SuperMarket.Sales/Produce # # Warehouse.Bulk # Warehouse.Fine # Warehouse.Office # # # if std_spc_type.match(/post-office/i)# Post Office 500 Lux # daylight_stpt_lux = 500 # elsif std_spc_type.match(/medical-office/i)# Medical Office 3000 Lux # daylight_stpt_lux = 3000 # elsif std_spc_type.match(/office/i)# Office 500 Lux # daylight_stpt_lux = 500 # elsif std_spc_type.match(/education/i)# School 500 Lux # daylight_stpt_lux = 500 # elsif std_spc_type.match(/retail/i)# Retail 1000 Lux # daylight_stpt_lux = 1000 # elsif std_spc_type.match(/warehouse/i)# Warehouse 200 Lux # daylight_stpt_lux = 200 # elsif std_spc_type.match(/hotel/i)# Hotel 300 Lux # daylight_stpt_lux = 300 # elsif std_spc_type.match(/multifamily/i)# Apartment 200 Lux # daylight_stpt_lux = 200 # elsif std_spc_type.match(/courthouse/i)# Courthouse 300 Lux # daylight_stpt_lux = 300 # elsif std_spc_type.match(/library/i)# Library 500 Lux # daylight_stpt_lux = 500 # elsif std_spc_type.match(/community-center/i)# Community Center 300 Lux # daylight_stpt_lux = 300 # elsif std_spc_type.match(/senior-center/i)# Senior Center 1000 Lux # daylight_stpt_lux = 1000 # elsif std_spc_type.match(/city-hall/i)# City Hall 500 Lux # daylight_stpt_lux = 500 # else # OpenStudio::logFree(OpenStudio::Warn, "openstudio.model.Space", "Space #{std_spc_type} is an unknown space type, assuming office and 300 Lux daylight setpoint") # daylight_stpt_lux = 300 # end # end # end # Get the zone that the space is in zone = thermalZone if zone.empty? OpenStudio.logFree(OpenStudio::Error, 'openstudio.model.Space', "Space #{name.get} has no thermal zone") else zone = zone.get end # Sort by priority; first by facade, then by area, # then by name to ensure deterministic in case identical in other ways sorted_windows = windows.sort_by { |_window, vals| [vals[:facade], vals[:area], vals[:name]] } sorted_skylights = skylights.sort_by { |_skylight, vals| [vals[:facade], vals[:area], vals[:name]] } # Report out the sorted skylights for debugging OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', "For #{name}, Skylights:") sorted_skylights.each do |sky, p| OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', "---#{sky.name} #{p[:facade]}, area = #{p[:area_m2].round(2)} m^2") end # Report out the sorted windows for debugging OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', "For #{name}, Windows:") sorted_windows.each do |win, p| OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', "---#{win.name} #{p[:facade]}, area = #{p[:area_m2].round(2)} m^2") end # Add the required controls sensor_1_frac = 0.0 sensor_2_frac = 0.0 sensor_1_window = nil sensor_2_window = nil case template when 'DOE Ref Pre-1980', 'DOE Ref 1980-2004', '90.1-2004', '90.1-2007' # Do nothing, no daylighting controls required when '90.1-2010', 'AssetScore' if req_top_ctrl && req_pri_ctrl # Sensor 1 controls toplighted area sensor_1_frac = areas['toplighted_area'] / space_area_m2 sensor_1_window = sorted_skylights[0] # Sensor 2 controls primary area sensor_2_frac = areas['primary_sidelighted_area'] / space_area_m2 sensor_2_window = sorted_windows[0] elsif req_top_ctrl && !req_pri_ctrl # Sensor 1 controls toplighted area sensor_1_frac = areas['toplighted_area'] / space_area_m2 sensor_1_window = sorted_skylights[0] elsif !req_top_ctrl && req_pri_ctrl if sorted_windows.size == 1 # Sensor 1 controls the whole primary area sensor_1_frac = areas['primary_sidelighted_area'] / space_area_m2 sensor_1_window = sorted_windows[0] else # Sensor 1 controls half the primary area sensor_1_frac = (areas['primary_sidelighted_area'] / space_area_m2) / 2 sensor_1_window = sorted_windows[0] # Sensor 2 controls the other half of primary area sensor_2_frac = (areas['primary_sidelighted_area'] / space_area_m2) / 2 sensor_2_window = sorted_windows[1] end end when '90.1-2013' if req_top_ctrl && req_pri_ctrl && req_sec_ctrl # Sensor 1 controls toplighted area sensor_1_frac = areas['toplighted_area'] / space_area_m2 sensor_1_window = sorted_skylights[0] # Sensor 2 controls primary + secondary area sensor_2_frac = (areas['primary_sidelighted_area'] + areas['secondary_sidelighted_area']) / space_area_m2 sensor_2_window = sorted_windows[0] elsif !req_top_ctrl && req_pri_ctrl && req_sec_ctrl # Sensor 1 controls primary area sensor_1_frac = areas['primary_sidelighted_area'] / space_area_m2 sensor_1_window = sorted_windows[0] # Sensor 2 controls secondary area sensor_2_frac = (areas['secondary_sidelighted_area'] / space_area_m2) sensor_2_window = sorted_windows[0] elsif req_top_ctrl && !req_pri_ctrl && req_sec_ctrl # Sensor 1 controls toplighted area sensor_1_frac = areas['toplighted_area'] / space_area_m2 sensor_1_window = sorted_skylights[0] # Sensor 2 controls secondary area sensor_2_frac = (areas['secondary_sidelighted_area'] / space_area_m2) sensor_2_window = sorted_windows[0] elsif req_top_ctrl && !req_pri_ctrl && !req_sec_ctrl # Sensor 1 controls toplighted area sensor_1_frac = areas['toplighted_area'] / space_area_m2 sensor_1_window = sorted_skylights[0] elsif !req_top_ctrl && req_pri_ctrl && !req_sec_ctrl # Sensor 1 controls primary area sensor_1_frac = areas['primary_sidelighted_area'] / space_area_m2 sensor_1_window = sorted_windows[0] elsif !req_top_ctrl && !req_pri_ctrl && req_sec_ctrl # Sensor 1 controls secondary area sensor_1_frac = areas['secondary_sidelighted_area'] / space_area_m2 sensor_1_window = sorted_windows[0] end end # End of template case statement # Place the sensors and set control fractions # get the zone that the space is in zone = thermalZone if zone.empty? OpenStudio.logFree(OpenStudio::Error, 'openstudio.model.Space', "Space #{name}, cannot determine daylighted areas.") return false else zone = thermalZone.get end # Ensure that total controlled fraction # is never set above 1 (100%) if sensor_1_frac + sensor_2_frac >= 1.0 # Lower sensor_2_frac so that the total # is just slightly lower than 1.0 sensor_2_frac = 1.0 - sensor_1_frac - 0.001 end # Sensors if sensor_1_frac > 0.0 OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.Space', "For #{name}, sensor 1 controls #{(sensor_1_frac * 100).round}% of the zone lighting.") end if sensor_2_frac > 0.0 OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.Space', "For #{name}, sensor 2 controls #{(sensor_2_frac * 100).round}% of the zone lighting.") end # First sensor if sensor_1_window # OpenStudio::logFree(OpenStudio::Info, "openstudio.model.Space", "For #{self.name}, calculating daylighted areas.") # runner.registerInfo("Daylight sensor 1 inside of #{sensor_1_frac.name}") sensor_1 = OpenStudio::Model::DaylightingControl.new(model) sensor_1.setName("#{name} Daylt Sensor 1") sensor_1.setSpace(self) sensor_1.setIlluminanceSetpoint(daylight_stpt_lux) sensor_1.setLightingControlType('Stepped') sensor_1.setNumberofSteppedControlSteps(3) # all sensors 3-step per design # Place sensor depending on skylight or window sensor_vertex = nil if sensor_1_window[1][:facade] == '0-Up' sub_surface = sensor_1_window[0] outward_normal = sub_surface.outwardNormal centroid = OpenStudio.getCentroid(sub_surface.vertices).get ht_above_flr = OpenStudio.convert(3.0, 'ft', 'm').get outward_normal.setLength(sensor_1_window[1][:head_height_m] - ht_above_flr) sensor_vertex = centroid + outward_normal.reverseVector else sub_surface = sensor_1_window[0] window_outward_normal = sub_surface.outwardNormal window_centroid = OpenStudio.getCentroid(sub_surface.vertices).get window_outward_normal.setLength(sensor_1_window[1][:head_height_m]) vertex = window_centroid + window_outward_normal.reverseVector vertex_on_floorplane = floor_surface.plane.project(vertex) floor_outward_normal = floor_surface.outwardNormal floor_outward_normal.setLength(OpenStudio.convert(3.0, 'ft', 'm').get) sensor_vertex = vertex_on_floorplane + floor_outward_normal.reverseVector end sensor_1.setPosition(sensor_vertex) # TODO: rotate sensor to face window (only needed for glare calcs) zone.setPrimaryDaylightingControl(sensor_1) zone.setFractionofZoneControlledbyPrimaryDaylightingControl(sensor_1_frac) end # Second sensor if sensor_2_window # OpenStudio::logFree(OpenStudio::Info, "openstudio.model.Space", "For #{self.name}, calculating daylighted areas.") # runner.registerInfo("Daylight sensor 2 inside of #{sensor_2_frac.name}") sensor_2 = OpenStudio::Model::DaylightingControl.new(model) sensor_2.setName("#{name} Daylt Sensor 2") sensor_2.setSpace(self) sensor_2.setIlluminanceSetpoint(daylight_stpt_lux) sensor_2.setLightingControlType('Stepped') sensor_2.setNumberofSteppedControlSteps(3) # all sensors 3-step per design # Place sensor depending on skylight or window sensor_vertex = nil if sensor_2_window[1][:facade] == '0-Up' sub_surface = sensor_2_window[0] outward_normal = sub_surface.outwardNormal centroid = OpenStudio.getCentroid(sub_surface.vertices).get ht_above_flr = OpenStudio.convert(3.0, 'ft', 'm').get outward_normal.setLength(sensor_2_window[1][:head_height_m] - ht_above_flr) sensor_vertex = centroid + outward_normal.reverseVector else sub_surface = sensor_2_window[0] window_outward_normal = sub_surface.outwardNormal window_centroid = OpenStudio.getCentroid(sub_surface.vertices).get window_outward_normal.setLength(sensor_2_window[1][:head_height_m]) vertex = window_centroid + window_outward_normal.reverseVector vertex_on_floorplane = floor_surface.plane.project(vertex) floor_outward_normal = floor_surface.outwardNormal floor_outward_normal.setLength(OpenStudio.convert(3.0, 'ft', 'm').get) sensor_vertex = vertex_on_floorplane + floor_outward_normal.reverseVector end sensor_2.setPosition(sensor_vertex) # TODO: rotate sensor to face window (only needed for glare calcs) zone.setSecondaryDaylightingControl(sensor_2) zone.setFractionofZoneControlledbySecondaryDaylightingControl(sensor_2_frac) end return true end |
#apply_infiltration_rate(template) ⇒ Double
handle doors and vestibules
Set the infiltration rate for this space to include the impact of air leakage requirements in the standard.
1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 |
# File 'lib/openstudio-standards/standards/Standards.Space.rb', line 1543 def apply_infiltration_rate(template) # Define the total building baseline infiltration rate basic_infil_rate_cfm_per_ft2 = nil infil_type = nil case template when 'DOE Ref Pre-1980', 'DOE Ref 1980-2004' OpenStudio.logFree(OpenStudio::Info, 'openstudio.Standards.Model', "For #{template}, infiltration rates are not defined using this method, no changes have been made to the model.") return true when '90.1-2004', '90.1-2007' basic_infil_rate_cfm_per_ft2 = 1.8 when '90.1-2010', '90.1-2013' basic_infil_rate_cfm_per_ft2 = 1.0 end # Conversion factor # 1 m^3/s*m^2 = 196.85 cfm/ft2 conv_fact = 196.85 # Adjust the infiltration rate to the average pressure # for the prototype buildings. adj_infil_rate_m3_per_s_per_m2 = nil all_ext_infil_m3_per_s_per_m2 = nil case template when 'NECB 2011' # Remove infiltration rates set at the space type. unless spaceType.empty? spaceType.get.spaceInfiltrationDesignFlowRates.each(&:remove) end # Remove infiltration rates set at the space object. spaceInfiltrationDesignFlowRates.each(&:remove) adj_infil_rate_m3_per_s_per_m2 = 0.25 * 0.001 # m3/s/m2 exterior_wall_and_roof_and_subsurface_area = self.exterior_wall_and_roof_and_subsurface_area # To do # Don't create an object if there is no exterior wall area if exterior_wall_and_roof_and_subsurface_area <= 0.0 OpenStudio.logFree(OpenStudio::Info, 'openstudio.Standards.Model', "For #{template}, no exterior wall area was found, no infiltration will be added.") return true end # Calculate the total infiltration, assuming # that it only occurs through exterior walls and roofs (not floors as # explicit stated in the NECB 2011 so overhang/cantilevered floors will # have no effective infiltration) tot_infil_m3_per_s = adj_infil_rate_m3_per_s_per_m2 * exterior_wall_and_roof_and_subsurface_area # Now spread the total infiltration rate over all # exterior surface area (for the E+ input field) this will include the exterior floor if present. all_ext_infil_m3_per_s_per_m2 = tot_infil_m3_per_s / exteriorArea when 'DOE Ref Pre-1980', 'DOE Ref 1980-2004', '90.1-2004', '90.1-2007', '90.1-2010', '90.1-2013' adj_infil_rate_cfm_per_ft2 = adjust_infiltration_to_prototype_building_conditions(basic_infil_rate_cfm_per_ft2) adj_infil_rate_m3_per_s_per_m2 = adj_infil_rate_cfm_per_ft2 / conv_fact # Get the exterior wall area exterior_wall_and_window_area_m2 = exterior_wall_and_window_area # Don't create an object if there is no exterior wall area if exterior_wall_and_window_area_m2 <= 0.0 OpenStudio.logFree(OpenStudio::Info, 'openstudio.Standards.Model', "For #{template}, no exterior wall area was found, no infiltration will be added.") return true end # Calculate the total infiltration, assuming # that it only occurs through exterior walls tot_infil_m3_per_s = adj_infil_rate_m3_per_s_per_m2 * exterior_wall_and_window_area_m2 # Now spread the total infiltration rate over all # exterior surface areas (for the E+ input field) all_ext_infil_m3_per_s_per_m2 = tot_infil_m3_per_s / exteriorArea end OpenStudio.logFree(OpenStudio::Debug, 'openstudio.Standards.Space', "For #{name}, adj infil = #{all_ext_infil_m3_per_s_per_m2.round(8)} m^3/s*m^2.") # Get any infiltration schedule already assigned to this space or its space type # If not, the always on schedule will be applied. infil_sch = nil unless spaceInfiltrationDesignFlowRates.empty? old_infil = spaceInfiltrationDesignFlowRates[0] if old_infil.schedule.is_initialized infil_sch = old_infil.schedule.get end end if infil_sch.nil? && spaceType.is_initialized space_type = spaceType.get unless space_type.spaceInfiltrationDesignFlowRates.empty? old_infil = space_type.spaceInfiltrationDesignFlowRates[0] if old_infil.schedule.is_initialized infil_sch = old_infil.schedule.get end end end if infil_sch.nil? infil_sch = model.alwaysOnDiscreteSchedule end # Create an infiltration rate object for this space infiltration = OpenStudio::Model::SpaceInfiltrationDesignFlowRate.new(model) infiltration.setName("#{name} Infiltration") # infiltration.setFlowperExteriorWallArea(adj_infil_rate_m3_per_s_per_m2) infiltration.setFlowperExteriorSurfaceArea(all_ext_infil_m3_per_s_per_m2) infiltration.setSchedule(infil_sch) infiltration.setConstantTermCoefficient(0.0) infiltration.setTemperatureTermCoefficient 0.0 infiltration.setVelocityTermCoefficient(0.224) infiltration.setVelocitySquaredTermCoefficient(0.0) infiltration.setSpace(self) return true end |
#component_infiltration_rate(template) ⇒ Double
handle floors over unconditioned spaces
make subsurface infil rates part of Surface.component_infiltration_rate?
Determine the component infiltration rate for this space
1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 |
# File 'lib/openstudio-standards/standards/Standards.Space.rb', line 1661 def component_infiltration_rate(template) # Define the total building baseline infiltration rate basic_infil_rate_cfm_per_ft2 = nil infil_type = nil case template when 'DOE Ref Pre-1980', 'DOE Ref 1980-2004' OpenStudio.logFree(OpenStudio::Info, 'openstudio.Standards.Model', "For #{template}, infiltration rates are not defined using this method, no changes have been made to the model.") return true when '90.1-2004', '90.1-2007' basic_infil_rate_cfm_per_ft2 = 1.8 when '90.1-2010', '90.1-2013' basic_infil_rate_cfm_per_ft2 = 1.0 end # Calculate the basic infiltration rate ext_area_m2 = exteriorArea ext_area_ft2 = OpenStudio.convert(ext_area_m2, 'm^2', 'ft^2').get basic_infil_cfm = basic_infil_rate_cfm_per_ft2 * ext_area_ft2 basic_infil_m3_per_s = OpenStudio.convert(basic_infil_cfm, 'cfm', 'm^3/s').get # Calculate the baseline component infiltration rate infil_type = 'baseline' base_comp_infil_m3_per_s = 0.0 surfaces.sort.each do |surface| # This surface base_comp_infil_m3_per_s += surface.component_infiltration_rate(infil_type) # Subsurfaces in this surface # TODO make this part of Surface.component_infiltration_rate? surface.subSurfaces.sort.each do |subsurface| base_comp_infil_m3_per_s += subsurface.component_infiltration_rate(infil_type) end end base_comp_infil_cfm = OpenStudio.convert(base_comp_infil_m3_per_s, 'm^3/s', 'cfm').get # Calculate the advanced component infiltration rate infil_type = 'advanced' adv_comp_infil_m3_per_s = 0.0 surfaces.sort.each do |surface| # This surface adv_comp_infil_m3_per_s += surface.component_infiltration_rate(infil_type) # Subsurfaces in this surface # TODO make this part of Surface.component_infiltration_rate? surface.subSurfaces.sort.each do |subsurface| adv_comp_infil_m3_per_s += subsurface.component_infiltration_rate(infil_type) end end adv_comp_infil_cfm = OpenStudio.convert(adv_comp_infil_m3_per_s, 'm^3/s', 'cfm').get # Calculate the adjusted infiltration rate infil_m3_per_s = basic_infil_m3_per_s - base_comp_infil_m3_per_s + adv_comp_infil_m3_per_s # Adjust the infiltration from 75Pa to 4Pa intial_pressure_pa = 75.0 final_pressure_pa = 4.0 adj_infil_m3_per_s = adjust_infiltration_to_lower_pressure(infil_m3_per_s, intial_pressure_pa, final_pressure_pa) # Calculate the rate per exterior area adj_infil_m3_per_s_per_m2 = adj_infil_m3_per_s / ext_area_m2 OpenStudio.logFree(OpenStudio::Debug, 'openstudio.Standards.Space', "For #{name}, infil = #{adj_infil_m3_per_s_per_m2.round(8)} m^3/s*m^2.") #=> infil = #{comp_infil_rate_m3_per_s.round(2)} m^3/s, ext area = #{tot_ext_area_m2.round} m^2") # OpenStudio::logFree(OpenStudio::Debug, "openstudio.Standards.Space", "For #{self.name}, comp infil = #{comp_infil_rate_cfm_per_ft2.round(4)} cfm/ft2 => infil = #{comp_infil_rate_cfm.round(2)} cfm, ext area = #{tot_ext_area_ft2.round} ft2") # OpenStudio::logFree(OpenStudio::Debug, "openstudio.Standards.Space", "For #{self.name}") return adj_infil_m3_per_s end |
#conditioning_category(template, climate_zone) ⇒ String
add logic to detect indirectly-conditioned spaces
Determines whether the space is conditioned per 90.1, which is based on heating and cooling loads.
1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 |
# File 'lib/openstudio-standards/standards/Standards.Space.rb', line 1892 def conditioning_category(template, climate_zone) # Get the zone this space is inside zone = thermalZone # Assume unconditioned if not assigned to a zone if zone.empty? return 'Unconditioned' end # Get the category from the zone cond_cat = zone.get.conditioning_category(template, climate_zone) return cond_cat end |
#cooled? ⇒ Bool
Determines cooling status. If the space’s zone has a thermostat with a minimum cooling setpoint above 33C (91F), counts as cooled.
1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 |
# File 'lib/openstudio-standards/standards/Standards.Space.rb', line 1934 def cooled? # Get the zone this space is inside zone = thermalZone # Assume uncooled if not assigned to a zone if zone.empty? return false end # Get the category from the zone cld = zone.get.cooled? return cld end |
#daylighted_areas(template, draw_daylight_areas_for_debugging = false) ⇒ Hash
add a list of valid choices for template argument
This method is super complicated because of all the polygon/geometry math required. and therefore may not return perfect results. However, it works well in most tested situations. When it fails, it will log warnings/errors for users to see.
Returns values for the different types of daylighted areas in the space. Definitions for each type of area follow the respective template. TODO stop skipping non-vertical walls
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 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 508 509 510 511 512 513 514 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 |
# File 'lib/openstudio-standards/standards/Standards.Space.rb', line 20 def daylighted_areas(template, draw_daylight_areas_for_debugging = false) ### Begin the actual daylight area calculations ### OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', "For #{name}, calculating daylighted areas.") result = { 'toplighted_area' => 0.0, 'primary_sidelighted_area' => 0.0, 'secondary_sidelighted_area' => 0.0, 'total_window_area' => 0.0, 'total_skylight_area' => 0.0 } total_window_area = 0 total_skylight_area = 0 # Make rendering colors to help debug visually if draw_daylight_areas_for_debugging # Yellow toplit_construction = OpenStudio::Model::Construction.new(model) toplit_color = OpenStudio::Model::RenderingColor.new(model) toplit_color.setRenderingRedValue(255) toplit_color.setRenderingGreenValue(255) toplit_color.setRenderingBlueValue(0) toplit_construction.setRenderingColor(toplit_color) # Red pri_sidelit_construction = OpenStudio::Model::Construction.new(model) pri_sidelit_color = OpenStudio::Model::RenderingColor.new(model) pri_sidelit_color.setRenderingRedValue(255) pri_sidelit_color.setRenderingGreenValue(0) pri_sidelit_color.setRenderingBlueValue(0) pri_sidelit_construction.setRenderingColor(pri_sidelit_color) # Blue sec_sidelit_construction = OpenStudio::Model::Construction.new(model) sec_sidelit_color = OpenStudio::Model::RenderingColor.new(model) sec_sidelit_color.setRenderingRedValue(0) sec_sidelit_color.setRenderingGreenValue(0) sec_sidelit_color.setRenderingBlueValue(255) sec_sidelit_construction.setRenderingColor(sec_sidelit_color) # Light Blue flr_construction = OpenStudio::Model::Construction.new(model) flr_color = OpenStudio::Model::RenderingColor.new(model) flr_color.setRenderingRedValue(0) flr_color.setRenderingGreenValue(255) flr_color.setRenderingBlueValue(255) flr_construction.setRenderingColor(flr_color) end # Move the polygon up slightly for viewability in sketchup up_translation_flr = OpenStudio.createTranslation(OpenStudio::Vector3d.new(0, 0, 0.05)) up_translation_top = OpenStudio.createTranslation(OpenStudio::Vector3d.new(0, 0, 0.1)) up_translation_pri = OpenStudio.createTranslation(OpenStudio::Vector3d.new(0, 0, 0.1)) up_translation_sec = OpenStudio.createTranslation(OpenStudio::Vector3d.new(0, 0, 0.1)) # Get the space's surface group's transformation @space_transformation = transformation # Record a floor in the space for later use floor_surface = nil # Record all floor polygons floor_polygons = [] floor_z = 0.0 surfaces.sort.each do |surface| if surface.surfaceType == 'Floor' floor_surface = surface floor_z = surface.vertices[0].z # floor_polygons << surface.vertices # Hard-set the z for the floor to zero new_floor_polygon = [] surface.vertices.each do |vertex| new_floor_polygon << OpenStudio::Point3d.new(vertex.x, vertex.y, 0.0) end floor_polygons << new_floor_polygon end end # Make sure there is one floor surface if floor_surface.nil? OpenStudio.logFree(OpenStudio::Warn, 'openstudio.model.Space', "Could not find a floor in space #{name.get}, cannot determine daylighted areas.") return result end # Make a set of vertices representing each subsurfaces sidelighteding area # and fold them all down onto the floor of the self. toplit_polygons = [] pri_sidelit_polygons = [] sec_sidelit_polygons = [] surfaces.sort.each do |surface| if surface.outsideBoundaryCondition == 'Outdoors' && surface.surfaceType == 'Wall' # TODO: stop skipping non-vertical walls surface_normal = surface.outwardNormal surface_normal_z = surface_normal.z unless surface_normal_z.abs < 0.001 unless surface.subSurfaces.empty? OpenStudio.logFree(OpenStudio::Warn, 'openstudio.model.Space', "Cannot currently handle non-vertical walls; skipping windows on #{surface.name} in #{name}.") next end end surface.subSurfaces.sort.each do |sub_surface| next unless sub_surface.outsideBoundaryCondition == 'Outdoors' && (sub_surface.subSurfaceType == 'FixedWindow' || sub_surface.subSurfaceType == 'OperableWindow' || sub_surface.subSurfaceType == 'GlassDoor') # OpenStudio::logFree(OpenStudio::Debug, "openstudio.model.Space", "***#{sub_surface.name}***" total_window_area += sub_surface.netArea # Find the head height and sill height of the window vertex_heights_above_floor = [] sub_surface.vertices.each do |vertex| vertex_on_floorplane = floor_surface.plane.project(vertex) vertex_heights_above_floor << (vertex - vertex_on_floorplane).length end sill_height_m = vertex_heights_above_floor.min head_height_m = vertex_heights_above_floor.max # OpenStudio::logFree(OpenStudio::Debug, "openstudio.model.Space", "head height = #{head_height_m.round(2)}m, sill height = #{sill_height_m.round(2)}m") # Find the width of the window rot_origin = nil unless sub_surface.vertices.size == 4 OpenStudio.logFree(OpenStudio::Warn, 'openstudio.model.Space', "A sub-surface in space #{name} has other than 4 vertices; this sub-surface will not be included in the daylighted area calculation.") next end prev_vertex_on_floorplane = nil max_window_width_m = 0 sub_surface.vertices.each do |vertex| vertex_on_floorplane = floor_surface.plane.project(vertex) unless prev_vertex_on_floorplane prev_vertex_on_floorplane = vertex_on_floorplane next end width_m = (prev_vertex_on_floorplane - vertex_on_floorplane).length if width_m > max_window_width_m max_window_width_m = width_m rot_origin = vertex_on_floorplane end end # Determine the extra width to add to the sidelighted area extra_width_m = 0 if template == '90.1-2013' extra_width_m = head_height_m / 2 elsif template == '90.1-2010' extra_width_m = OpenStudio.convert(2, 'ft', 'm').get end # OpenStudio::logFree(OpenStudio::Debug, "openstudio.model.Space", "Adding #{extra_width_m.round(2)}m to the width for the sidelighted area.") # Align the vertices with face coordinate system face_transform = OpenStudio::Transformation.alignFace(sub_surface.vertices) aligned_vertices = face_transform.inverse * sub_surface.vertices # Find the min and max x values min_x_val = 99_999 max_x_val = -99_999 aligned_vertices.each do |vertex| # Min x value if vertex.x < min_x_val min_x_val = vertex.x end # Max x value if vertex.x > max_x_val max_x_val = vertex.x end end # OpenStudio::logFree(OpenStudio::Debug, "openstudio.model.Space", "min_x_val = #{min_x_val.round(2)}, max_x_val = #{max_x_val.round(2)}") # Create polygons that are adjusted # to expand from the window shape to the sidelighteded areas. pri_sidelit_sub_polygon = [] sec_sidelit_sub_polygon = [] aligned_vertices.each do |vertex| # Primary sidelighted area # Move the x vertices outward by the specified amount. if (vertex.x - min_x_val).abs < 0.01 new_x = vertex.x - extra_width_m elsif (vertex.x - max_x_val).abs < 0.01 new_x = vertex.x + extra_width_m else new_x = 99.9 OpenStudio.logFree(OpenStudio::Warn, 'openstudio.model.Space', "A window in space #{name} is non-rectangular; this sub-surface will not be included in the primary daylighted area calculation. #{vertex.x} != #{min_x_val} or #{max_x_val}") end # Zero-out the y for the bottom edge because the # sidelighteding area extends down to the floor. new_y = if vertex.y.zero? vertex.y - sill_height_m else vertex.y end # Set z = 0 so that intersection works. new_z = 0.0 # Make the new vertex new_vertex = OpenStudio::Point3d.new(new_x, new_y, new_z) pri_sidelit_sub_polygon << new_vertex # OpenStudio::logFree(OpenStudio::Info, "openstudio.model.Space", "#{vertex.x.round(2)}, #{vertex.y.round(2)}, #{vertex.z.round(2)} ==> #{new_vertex.x.round(2)}, #{new_vertex.y.round(2)}, #{new_vertex.z.round(2)}") # Secondary sidelighted area # Move the x vertices outward by the specified amount. if (vertex.x - min_x_val).abs < 0.01 new_x = vertex.x - extra_width_m elsif (vertex.x - max_x_val).abs < 0.01 new_x = vertex.x + extra_width_m else new_x = 99.9 OpenStudio.logFree(OpenStudio::Warn, 'openstudio.model.Space', "A window in space #{name} is non-rectangular; this sub-surface will not be included in the secondary daylighted area calculation.") end # Add the head height of the window to all points # sidelighteding area extends down to the floor. new_y = if vertex.y.zero? vertex.y - sill_height_m + head_height_m else vertex.y + head_height_m end # Set z = 0 so that intersection works. new_z = 0.0 # Make the new vertex new_vertex = OpenStudio::Point3d.new(new_x, new_y, new_z) sec_sidelit_sub_polygon << new_vertex end # Realign the vertices with space coordinate system pri_sidelit_sub_polygon = face_transform * pri_sidelit_sub_polygon sec_sidelit_sub_polygon = face_transform * sec_sidelit_sub_polygon # Rotate the sidelighteded areas down onto the floor down_vector = OpenStudio::Vector3d.new(0, 0, -1) outward_normal_vector = sub_surface.outwardNormal rot_vector = down_vector.cross(outward_normal_vector) ninety_deg_in_rad = OpenStudio.degToRad(90) # TODO: change new_rotation = OpenStudio.createRotation(rot_origin, rot_vector, ninety_deg_in_rad) pri_sidelit_sub_polygon = new_rotation * pri_sidelit_sub_polygon sec_sidelit_sub_polygon = new_rotation * sec_sidelit_sub_polygon # Put the polygon vertices into counterclockwise order pri_sidelit_sub_polygon = pri_sidelit_sub_polygon.reverse sec_sidelit_sub_polygon = sec_sidelit_sub_polygon.reverse # Add these polygons to the list pri_sidelit_polygons << pri_sidelit_sub_polygon sec_sidelit_polygons << sec_sidelit_sub_polygon end # Next subsurface elsif surface.outsideBoundaryCondition == 'Outdoors' && surface.surfaceType == 'RoofCeiling' # TODO: stop skipping non-horizontal roofs surface_normal = surface.outwardNormal straight_upward = OpenStudio::Vector3d.new(0, 0, 1) unless surface_normal.to_s == straight_upward.to_s unless surface.subSurfaces.empty? OpenStudio.logFree(OpenStudio::Warn, 'openstudio.model.Space', "Cannot currently handle non-horizontal roofs; skipping skylights on #{surface.name} in #{name}.") OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', "---Surface #{surface.name} has outward normal of #{surface_normal.to_s.gsub(/\[|\]/, '|')}; up is #{straight_upward.to_s.gsub(/\[|\]/, '|')}.") next end end surface.subSurfaces.sort.each do |sub_surface| next unless sub_surface.outsideBoundaryCondition == 'Outdoors' && sub_surface.subSurfaceType == 'Skylight' # OpenStudio::logFree(OpenStudio::Debug, "openstudio.model.Space", "***#{sub_surface.name}***") total_skylight_area += sub_surface.netArea # Project the skylight onto the floor plane polygon_on_floor = [] vertex_heights_above_floor = [] sub_surface.vertices.each do |vertex| vertex_on_floorplane = floor_surface.plane.project(vertex) vertex_heights_above_floor << (vertex - vertex_on_floorplane).length polygon_on_floor << vertex_on_floorplane end # Determine the ceiling height. # Assumes skylight is flush with ceiling. ceiling_height_m = vertex_heights_above_floor.max # Align the vertices with face coordinate system face_transform = OpenStudio::Transformation.alignFace(polygon_on_floor) aligned_vertices = face_transform.inverse * polygon_on_floor # Find the min and max x and y values min_x_val = 99_999 max_x_val = -99_999 min_y_val = 99_999 max_y_val = -99_999 aligned_vertices.each do |vertex| # Min x value if vertex.x < min_x_val min_x_val = vertex.x end # Max x value if vertex.x > max_x_val max_x_val = vertex.x end # Min y value if vertex.y < min_y_val min_y_val = vertex.y end # Max y value if vertex.y > max_x_val max_y_val = vertex.y end end # Figure out how much to expand the window additional_extent_m = 0.7 * ceiling_height_m # Create polygons that are adjusted # to expand from the window shape to the sidelighteded areas. toplit_sub_polygon = [] aligned_vertices.each do |vertex| # Move the x vertices outward by the specified amount. if vertex.x == min_x_val new_x = vertex.x - additional_extent_m elsif vertex.x == max_x_val new_x = vertex.x + additional_extent_m else new_x = 99.9 OpenStudio.logFree(OpenStudio::Warn, 'openstudio.model.Space', "A skylight in space #{name} is non-rectangular; this sub-surface will not be included in the daylighted area calculation.") end # Move the y vertices outward by the specified amount. if vertex.y == min_y_val new_y = vertex.y - additional_extent_m elsif vertex.y == max_y_val new_y = vertex.y + additional_extent_m else new_y = 99.9 OpenStudio.logFree(OpenStudio::Warn, 'openstudio.model.Space', "A skylight in space #{name} is non-rectangular; this sub-surface will not be included in the daylighted area calculation.") end # Set z = 0 so that intersection works. new_z = 0.0 # Make the new vertex new_vertex = OpenStudio::Point3d.new(new_x, new_y, new_z) toplit_sub_polygon << new_vertex end # Realign the vertices with space coordinate system toplit_sub_polygon = face_transform * toplit_sub_polygon # Put the polygon vertices into counterclockwise order toplit_sub_polygon = toplit_sub_polygon.reverse # Add these polygons to the list toplit_polygons << toplit_sub_polygon end # Next subsurface end # End if outdoor wall or roofceiling end # Next surface # Set z=0 for all the polygons so that intersection will work toplit_polygons = polygons_set_z(toplit_polygons, 0.0) pri_sidelit_polygons = polygons_set_z(pri_sidelit_polygons, 0.0) sec_sidelit_polygons = polygons_set_z(sec_sidelit_polygons, 0.0) # Check the initial polygons check_z_zero(floor_polygons, 'floor_polygons', name.get) check_z_zero(toplit_polygons, 'toplit_polygons', name.get) check_z_zero(pri_sidelit_polygons, 'pri_sidelit_polygons', name.get) check_z_zero(sec_sidelit_polygons, 'sec_sidelit_polygons', name.get) # Join, then subtract OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', '***Joining polygons***') # Join toplighted polygons into a single set combined_toplit_polygons = join_polygons(toplit_polygons, 0.01, 'toplit_polygons') # Join primary sidelighted polygons into a single set combined_pri_sidelit_polygons = join_polygons(pri_sidelit_polygons, 0.01, 'pri_sidelit_polygons') # Join secondary sidelighted polygons into a single set combined_sec_sidelit_polygons = join_polygons(sec_sidelit_polygons, 0.01, 'sec_sidelit_polygons') # Join floor polygons into a single set combined_floor_polygons = join_polygons(floor_polygons, 0.01, 'floor_polygons') # Check the joined polygons check_z_zero(combined_floor_polygons, 'combined_floor_polygons', name.get) check_z_zero(combined_toplit_polygons, 'combined_toplit_polygons', name.get) check_z_zero(combined_pri_sidelit_polygons, 'combined_pri_sidelit_polygons', name.get) check_z_zero(combined_sec_sidelit_polygons, 'combined_sec_sidelit_polygons', name.get) # Make a new surface for each of the resulting polygons to visually inspect it # OpenStudio::logFree(OpenStudio::Debug, "openstudio.model.Space", "***Making Surfaces to view in SketchUp***") # combined_toplit_polygons.each do |polygon| # dummy_space = OpenStudio::Model::Space.new(model) # polygon = up_translation_top * polygon # daylt_surf = OpenStudio::Model::Surface.new(polygon, model) # daylt_surf.setConstruction(toplit_construction) # daylt_surf.setSpace(dummy_space) # daylt_surf.setName("Top") # end # combined_pri_sidelit_polygons.each do |polygon| # dummy_space = OpenStudio::Model::Space.new(model) # polygon = up_translation_pri * polygon # daylt_surf = OpenStudio::Model::Surface.new(polygon, model) # daylt_surf.setConstruction(pri_sidelit_construction) # daylt_surf.setSpace(dummy_space) # daylt_surf.setName("Pri") # end # combined_sec_sidelit_polygons.each do |polygon| # dummy_space = OpenStudio::Model::Space.new(model) # polygon = up_translation_sec * polygon # daylt_surf = OpenStudio::Model::Surface.new(polygon, model) # daylt_surf.setConstruction(sec_sidelit_construction) # daylt_surf.setSpace(dummy_space) # daylt_surf.setName("Sec") # end # combined_floor_polygons.each do |polygon| # dummy_space = OpenStudio::Model::Space.new(model) # polygon = up_translation_flr * polygon # daylt_surf = OpenStudio::Model::Surface.new(polygon, model) # daylt_surf.setConstruction(flr_construction) # daylt_surf.setSpace(dummy_space) # daylt_surf.setName("Flr") # end OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', '***Subtracting overlapping areas***') # Subtract lower-priority daylighting areas from higher priority ones pri_minus_top_polygons = a_polygons_minus_b_polygons(combined_pri_sidelit_polygons, combined_toplit_polygons, 'combined_pri_sidelit_polygons', 'combined_toplit_polygons') sec_minus_top_polygons = a_polygons_minus_b_polygons(combined_sec_sidelit_polygons, combined_toplit_polygons, 'combined_sec_sidelit_polygons', 'combined_toplit_polygons') sec_minus_top_minus_pri_polygons = a_polygons_minus_b_polygons(sec_minus_top_polygons, combined_pri_sidelit_polygons, 'sec_minus_top_polygons', 'combined_pri_sidelit_polygons') # Check the subtracted polygons check_z_zero(pri_minus_top_polygons, 'pri_minus_top_polygons', name.get) check_z_zero(sec_minus_top_polygons, 'sec_minus_top_polygons', name.get) check_z_zero(sec_minus_top_minus_pri_polygons, 'sec_minus_top_minus_pri_polygons', name.get) # Make a new surface for each of the resulting polygons to visually inspect it. # First reset the z so the surfaces show up on the correct plane. if draw_daylight_areas_for_debugging combined_toplit_polygons_at_floor = polygons_set_z(combined_toplit_polygons, floor_z) pri_minus_top_polygons_at_floor = polygons_set_z(pri_minus_top_polygons, floor_z) sec_minus_top_minus_pri_polygons_at_floor = polygons_set_z(sec_minus_top_minus_pri_polygons, floor_z) combined_floor_polygons_at_floor = polygons_set_z(combined_floor_polygons, floor_z) OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', '***Making Surfaces to view in SketchUp***') dummy_space = OpenStudio::Model::Space.new(model) combined_toplit_polygons_at_floor.each do |polygon| polygon = up_translation_top * polygon polygon = @space_transformation * polygon daylt_surf = OpenStudio::Model::Surface.new(polygon, model) daylt_surf.setConstruction(toplit_construction) daylt_surf.setSpace(dummy_space) daylt_surf.setName('Top') end pri_minus_top_polygons_at_floor.each do |polygon| polygon = up_translation_pri * polygon polygon = @space_transformation * polygon daylt_surf = OpenStudio::Model::Surface.new(polygon, model) daylt_surf.setConstruction(pri_sidelit_construction) daylt_surf.setSpace(dummy_space) daylt_surf.setName('Pri') end sec_minus_top_minus_pri_polygons_at_floor.each do |polygon| polygon = up_translation_sec * polygon polygon = @space_transformation * polygon daylt_surf = OpenStudio::Model::Surface.new(polygon, model) daylt_surf.setConstruction(sec_sidelit_construction) daylt_surf.setSpace(dummy_space) daylt_surf.setName('Sec') end combined_floor_polygons_at_floor.each do |polygon| polygon = up_translation_flr * polygon polygon = @space_transformation * polygon daylt_surf = OpenStudio::Model::Surface.new(polygon, model) daylt_surf.setConstruction(flr_construction) daylt_surf.setSpace(dummy_space) daylt_surf.setName('Flr') end end OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', '***Calculating Daylighted Areas***') # Get the total floor area total_floor_area_m2 = total_area_of_polygons(combined_floor_polygons) total_floor_area_ft2 = OpenStudio.convert(total_floor_area_m2, 'm^2', 'ft^2').get OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', "total_floor_area_ft2 = #{total_floor_area_ft2.round(1)}") # Toplighted area toplighted_area_m2 = area_a_polygons_overlap_b_polygons(combined_toplit_polygons, combined_floor_polygons, 'combined_toplit_polygons', 'combined_floor_polygons') # Primary sidelighted area primary_sidelighted_area_m2 = area_a_polygons_overlap_b_polygons(pri_minus_top_polygons, combined_floor_polygons, 'pri_minus_top_polygons', 'combined_floor_polygons') # Secondary sidelighted area secondary_sidelighted_area_m2 = area_a_polygons_overlap_b_polygons(sec_minus_top_minus_pri_polygons, combined_floor_polygons, 'sec_minus_top_minus_pri_polygons', 'combined_floor_polygons') # Convert to IP for displaying toplighted_area_ft2 = OpenStudio.convert(toplighted_area_m2, 'm^2', 'ft^2').get primary_sidelighted_area_ft2 = OpenStudio.convert(primary_sidelighted_area_m2, 'm^2', 'ft^2').get secondary_sidelighted_area_ft2 = OpenStudio.convert(secondary_sidelighted_area_m2, 'm^2', 'ft^2').get OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', "toplighted_area_ft2 = #{toplighted_area_ft2.round(1)}") OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', "primary_sidelighted_area_ft2 = #{primary_sidelighted_area_ft2.round(1)}") OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', "secondary_sidelighted_area_ft2 = #{secondary_sidelighted_area_ft2.round(1)}") result['toplighted_area'] = toplighted_area_m2 result['primary_sidelighted_area'] = primary_sidelighted_area_m2 result['secondary_sidelighted_area'] = secondary_sidelighted_area_m2 result['total_window_area'] = total_window_area result['total_skylight_area'] = total_skylight_area return result end |
#design_internal_load ⇒ Double
Determine the design internal load (W) for this space without space multipliers. This include People, Lights, Electric Equipment, and Gas Equipment. It assumes 100% of the wattage is converted to heat, and that the design peak schedule value is 1 (100%).
1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 |
# File 'lib/openstudio-standards/standards/Standards.Space.rb', line 1957 def design_internal_load load_w = 0.0 # People people.each do |people| w_per_person = 125 # Initial assumption act_sch = people.activityLevelSchedule if act_sch.is_initialized if act_sch.get.to_ScheduleRuleset.is_initialized act_sch = act_sch.get.to_ScheduleRuleset.get w_per_person = act_sch.annual_min_max_value['max'] else OpenStudio.logFree(OpenStudio::Warn, 'openstudio.model.Space', "#{name} people activity schedule is not a Schedule:Ruleset. Assuming #{w_per_person}W/person.") end OpenStudio.logFree(OpenStudio::Warn, 'openstudio.model.Space', "#{name} people activity schedule not found. Assuming #{w_per_person}W/person.") end num_ppl = people.getNumberOfPeople(floorArea) ppl_w = num_ppl * w_per_person load_w += ppl_w end # Lights load_w += lightingPower # Electric Equipment load_w += electricEquipmentPower # Gas Equipment load_w += gasEquipmentPower OpenStudio.logFree(OpenStudio::Debug, 'openstudio.model.Space', "#{name} has #{load_w.round}W of design internal loads.") return load_w end |
#exterior_wall_and_roof_and_subsurface_area ⇒ Double
Calculate the area of the exterior walls, including the area of the windows on these walls.
1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 |
# File 'lib/openstudio-standards/standards/Standards.Space.rb', line 1756 def exterior_wall_and_roof_and_subsurface_area area_m2 = 0.0 # Loop through all surfaces in this space surfaces.sort.each do |surface| # Skip non-outdoor surfaces next unless surface.outsideBoundaryCondition == 'Outdoors' # Skip non-walls next unless surface.surfaceType == 'Wall' || surface.surfaceType == 'RoofCeiling' # This surface area_m2 += surface.netArea # Subsurfaces in this surface surface.subSurfaces.sort.each do |subsurface| area_m2 += subsurface.netArea end end return area_m2 end |
#exterior_wall_and_window_area ⇒ Double
Calculate the area of the exterior walls, including the area of the windows on these walls.
1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 |
# File 'lib/openstudio-standards/standards/Standards.Space.rb', line 1732 def exterior_wall_and_window_area area_m2 = 0.0 # Loop through all surfaces in this space surfaces.sort.each do |surface| # Skip non-outdoor surfaces next unless surface.outsideBoundaryCondition == 'Outdoors' # Skip non-walls next unless surface.surfaceType == 'Wall' # This surface area_m2 += surface.netArea # Subsurfaces in this surface surface.subSurfaces.sort.each do |subsurface| area_m2 += subsurface.netArea end end return area_m2 end |
#get_adjacent_space_with_most_shared_wall_area(same_floor = true) ⇒ Object
2051 2052 2053 |
# File 'lib/openstudio-standards/standards/Standards.Space.rb', line 2051 def get_adjacent_space_with_most_shared_wall_area(same_floor = true) return get_adjacent_spaces_with_touching_area(same_floor)[0][0] end |
#get_adjacent_spaces_with_shared_wall_areas(same_floor = true) ⇒ Object
will return a sorted array of array of spaces and connected area (Descending)
1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 |
# File 'lib/openstudio-standards/standards/Standards.Space.rb', line 1996 def get_adjacent_spaces_with_shared_wall_areas(same_floor = true) same_floor_spaces = [] spaces = [] surfaces.each do |surface| adj_surface = surface.adjacentSurface unless adj_surface.empty? model.getSpaces.each do |space| next if space == self space.surfaces.each do |surf| if surf == adj_surface.get spaces << space end end end end end # If looking for only spaces adjacent on the same floor. if same_floor == true raise "Cannot get adjacent spaces of space #{name} since space not set to BuildingStory" if buildingStory.empty? spaces.each do |space| raise "One or more adjecent spaces to space #{name} is not assigned to a BuildingStory. Ensure all spaces are assigned." if space.buildingStory.empty? if space.buildingStory.get == buildingStory.get same_floor_spaces << space end end spaces = same_floor_spaces end # now sort by areas. area_index = [] array_hash = {} return nil if spaces.size.zero? # iterate through each surface in the space surfaces.each do |surface| # get the adjacent surface in another space. adj_surface = surface.adjacentSurface unless adj_surface.empty? # go through each of the adjeacent spaces to find the matching surface/space. spaces.each_with_index do |space, index| next if space == self space.surfaces.each do |surf| if surf == adj_surface.get # initialize array index to zero for first time so += will work. area_index[index] = 0 if area_index[index].nil? area_index[index] += surf.grossArea array_hash[space] = area_index[index] end end end end end sorted_spaces = array_hash.sort_by { |_key, value| value }.reverse return sorted_spaces end |
#heated? ⇒ Bool
Determines heating status. If the space’s zone has a thermostat with a maximum heating setpoint above 5C (41F), counts as heated.
1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 |
# File 'lib/openstudio-standards/standards/Standards.Space.rb', line 1913 def heated? # Get the zone this space is inside zone = thermalZone # Assume unheated if not assigned to a zone if zone.empty? return false end # Get the category from the zone htd = zone.get.heated? return htd end |
#plenum? ⇒ Boolean
Determine if the space is a plenum. Assume it is a plenum if it is a supply or return plenum for an AirLoop, if it is not part of the total floor area, or if the space type name contains the word plenum.
return [Bool] returns true if plenum, false if not
1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 |
# File 'lib/openstudio-standards/standards/Standards.Space.rb', line 1784 def plenum? plenum_status = false # Check if it is designated # as not part of the building # floor area. This method internally # also checks to see if the space's zone # is a supply or return plenum unless partofTotalFloorArea plenum_status = true return plenum_status end # TODO: - update to check if it has internal loads # Check if the space type name # contains the word plenum. space_type = spaceType if space_type.is_initialized space_type = space_type.get if space_type.name.get.to_s.downcase.include?('plenum') plenum_status = true return plenum_status end if space_type.standardsSpaceType.is_initialized if space_type.standardsSpaceType.get.downcase.include?('plenum') plenum_status = true return plenum_status end end end return plenum_status end |
#residential?(template) ⇒ Boolean
Determine if the space is residential based on the space type properties for the space. For spaces with no space type, assume nonresidential. For spaces that are plenums, base the decision on the space type of the space below the largest floor in the plenum.
return [Bool] true if residential, false if nonresidential
1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 |
# File 'lib/openstudio-standards/standards/Standards.Space.rb', line 1826 def residential?(template) is_res = false space_to_check = self # If this space is a plenum, check the space type # of the space below the largest floor in the space if plenum? # Find the largest floor largest_floor_area = 0.0 largest_surface = nil surfaces.each do |surface| next unless surface.surfaceType == 'Floor' && surface.outsideBoundaryCondition == 'Surface' if surface.grossArea > largest_floor_area largest_floor_area = surface.grossArea largest_surface = surface end end if largest_surface.nil? OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Space', "#{name} is a plenum, but could not find a floor with a space below it to determine if plenum should be res or nonres. Assuming nonresidential.") return is_res end # Get the space on the other side of this floor if largest_surface.adjacentSurface.is_initialized adj_surface = largest_surface.adjacentSurface.get if adj_surface.space.is_initialized space_to_check = adj_surface.space.get else OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Space', "#{name} is a plenum, but could not find a space attached to the largest floor's adjacent surface #{adj_surface.name} to determine if plenum should be res or nonres. Assuming nonresidential.") return is_res end else OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Space', "#{name} is a plenum, but could not find a floor with a space below it to determine if plenum should be res or nonres. Assuming nonresidential.") return is_res end end space_type = space_to_check.spaceType if space_type.is_initialized space_type = space_type.get # Get the space type data space_type_properties = space_type.get_standards_data(template) if space_type_properties.nil? OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Space', "Could not find space type properties for #{space_to_check.name}, assuming nonresidential.") is_res = false else is_res = if space_type_properties['is_residential'] == 'Yes' true else false end end else OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Space', "Could not find a space type for #{space_to_check.name}, assuming nonresidential.") is_res = false end return is_res end |
#sidelighting_effective_aperture(primary_sidelighted_area) ⇒ Double
Returns the sidelighting effective aperture sidelighting_effective_aperture = E(window area * window VT) / primary_sidelighted_area
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 596 597 598 599 600 601 602 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 |
# File 'lib/openstudio-standards/standards/Standards.Space.rb', line 548 def sidelighting_effective_aperture(primary_sidelighted_area) # sidelighting_effective_aperture = E(window area * window VT) / primary_sidelighted_area sidelighting_effective_aperture = 9999 num_sub_surfaces = 0 # Loop through all windows and add up area * VT sum_window_area_times_vt = 0 construction_name_to_vt_map = {} surfaces.sort.each do |surface| next unless surface.outsideBoundaryCondition == 'Outdoors' && surface.surfaceType == 'Wall' surface.subSurfaces.sort.each do |sub_surface| next unless sub_surface.outsideBoundaryCondition == 'Outdoors' && (sub_surface.subSurfaceType == 'FixedWindow' || sub_surface.subSurfaceType == 'OperableWindow' || sub_surface.subSurfaceType == 'GlassDoor') num_sub_surfaces += 1 # Get the area area_m2 = sub_surface.netArea # Get the window construction name construction_name = nil construction = sub_surface.construction if construction.is_initialized construction_name = construction.get.name.get.upcase else OpenStudio.logFree(OpenStudio::Warn, 'openstudio.model.Space', "For #{name}, could not determine construction for #{sub_surface.name}, will not be included in sidelighting_effective_aperture calculation.") next end # Store VT for this construction in map if not already looked up if construction_name_to_vt_map[construction_name].nil? sql = model.sqlFile if sql.is_initialized sql = sql.get row_query = "SELECT RowName FROM tabulardatawithstrings WHERE ReportName='EnvelopeSummary' AND ReportForString='Entire Facility' AND TableName='Exterior Fenestration' AND Value='#{construction_name.upcase}'" row_id = sql.execAndReturnFirstString(row_query) if row_id.is_initialized row_id = row_id.get else OpenStudio.logFree(OpenStudio::Warn, 'openstudio.model.Model', "VT row ID not found for construction: #{construction_name}, #{sub_surface.name} will not be included in sidelighting_effective_aperture calculation.") row_id = 9999 end vt_query = "SELECT Value FROM tabulardatawithstrings WHERE ReportName='EnvelopeSummary' AND ReportForString='Entire Facility' AND TableName='Exterior Fenestration' AND ColumnName='Glass Visible Transmittance' AND RowName='#{row_id}'" vt = sql.execAndReturnFirstDouble(vt_query) vt = if vt.is_initialized vt.get end # Record the VT construction_name_to_vt_map[construction_name] = vt else OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.Space', 'Model has no sql file containing results, cannot lookup data.') end end # Get the VT from the map vt = construction_name_to_vt_map[construction_name] if vt.nil? OpenStudio.logFree(OpenStudio::Warn, 'openstudio.model.Space', "For #{name}, could not determine VLT for #{construction_name}, will not be included in sidelighting effective aperture caluclation.") vt = 0 end sum_window_area_times_vt += area_m2 * vt end end # Calculate the effective aperture if sum_window_area_times_vt.zero? sidelighting_effective_aperture = 9999 if num_sub_surfaces > 0 OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Space', "#{name} has no windows where VLT could be determined, sidelighting effective aperture will be higher than it should.") end else sidelighting_effective_aperture = sum_window_area_times_vt / primary_sidelighted_area end OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.Space', "For #{name} sidelighting effective aperture = #{sidelighting_effective_aperture.round(4)}.") return sidelighting_effective_aperture end |
#skylight_effective_aperture(toplighted_area) ⇒ Double
Returns the skylight effective aperture skylight_effective_aperture = E(0.85 * skylight area * skylight VT * WF) / toplighted_area
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 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 |
# File 'lib/openstudio-standards/standards/Standards.Space.rb', line 655 def skylight_effective_aperture(toplighted_area) # skylight_effective_aperture = E(0.85 * skylight area * skylight VT * WF) / toplighted_area skylight_effective_aperture = 0.0 num_sub_surfaces = 0 # Assume that well factor (WF) is 0.9 (all wells are less than 2 feet deep) OpenStudio.logFree(OpenStudio::Info, 'openstudio.model.Space', 'Assuming that all skylight wells are less than 2 feet deep to calculate skylight effective aperture.') wf = 0.9 # Loop through all windows and add up area * VT sum_85pct_times_skylight_area_times_vt_times_wf = 0 construction_name_to_vt_map = {} surfaces.sort.each do |surface| next unless surface.outsideBoundaryCondition == 'Outdoors' && surface.surfaceType == 'RoofCeiling' surface.subSurfaces.sort.each do |sub_surface| next unless sub_surface.outsideBoundaryCondition == 'Outdoors' && sub_surface.subSurfaceType == 'Skylight' num_sub_surfaces += 1 # Get the area area_m2 = sub_surface.netArea # Get the window construction name construction_name = nil construction = sub_surface.construction if construction.is_initialized construction_name = construction.get.name.get.upcase else OpenStudio.logFree(OpenStudio::Warn, 'openstudio.model.Space', "For #{name}, ") next end # Store VT for this construction in map if not already looked up if construction_name_to_vt_map[construction_name].nil? sql = model.sqlFile if sql.is_initialized sql = sql.get row_query = "SELECT RowName FROM tabulardatawithstrings WHERE ReportName='EnvelopeSummary' AND ReportForString='Entire Facility' AND TableName='Exterior Fenestration' AND Value='#{construction_name}'" row_id = sql.execAndReturnFirstString(row_query) if row_id.is_initialized row_id = row_id.get else OpenStudio.logFree(OpenStudio::Warn, 'openstudio.model.Model', "Data not found for query: #{row_query}") next end vt_query = "SELECT Value FROM tabulardatawithstrings WHERE ReportName='EnvelopeSummary' AND ReportForString='Entire Facility' AND TableName='Exterior Fenestration' AND ColumnName='Glass Visible Transmittance' AND RowName='#{row_id}'" vt = sql.execAndReturnFirstDouble(vt_query) vt = if vt.is_initialized vt.get end # Record the VT construction_name_to_vt_map[construction_name] = vt else OpenStudio.logFree(OpenStudio::Error, 'openstudio.model.Model', 'Model has no sql file containing results, cannot lookup data.') end end # Get the VT from the map vt = construction_name_to_vt_map[construction_name] if vt.nil? OpenStudio.logFree(OpenStudio::Warn, 'openstudio.model.Space', "For #{name}, could not determine VLT for #{construction_name}, will not be included in skylight effective aperture caluclation.") vt = 0 end sum_85pct_times_skylight_area_times_vt_times_wf += 0.85 * area_m2 * vt * wf end end # Calculate the effective aperture if sum_85pct_times_skylight_area_times_vt_times_wf.zero? skylight_effective_aperture = 9999 if num_sub_surfaces > 0 OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Space', "#{name} has no skylights where VLT could be determined, skylight effective aperture will be higher than it should.") end else skylight_effective_aperture = sum_85pct_times_skylight_area_times_vt_times_wf / toplighted_area end OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.Space', "#{name} skylight effective aperture = #{skylight_effective_aperture}.") return skylight_effective_aperture end |