Skip to content

Commit

Permalink
fix(grouping): Loop over Room group to avoid writing duplicate Rooms
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswmackey committed Jun 12, 2024
1 parent 44dbc57 commit efea01b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion honeybee_doe2/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
DOE2_TOLERANCE = 0.03 # current best guess for DOE-2 absolute tolerance in Feet
DOE2_ANGLE_TOL = 1.0 # current best guess for DOE-2 angle tolerance in degrees
FLOOR_LEVEL_TOL = 0.1 # tolerance for grouping Rooms by floor elevations in Feet
GEO_DEC_COUNT = 6 # number of decimal places that all geometry will be rounded
GEO_DEC_COUNT = 3 # number of decimal places that all geometry will be rounded
RECT_WIN_SUBD = 0.5 # subdivision distance to rectangularize windows in Feet
DOE2_INTERIOR_BCS = ('Surface', 'Adiabatic', 'OtherSideTemperature')
MIN_LAYER_THICKNESS = 0.003 # the minimum thickness for a material to be valid in meters
Expand Down
4 changes: 2 additions & 2 deletions honeybee_doe2/grouping.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def group_rooms_by_doe2_level(rooms, model_tolerance):
else: # otherwise, we need to figure out which Room belongs to which geometry
# first get a set of Point2Ds that are inside each room in plan
room_pts, z_axis = [], Vector3D(0, 0, 1)
for room in rooms:
for room in room_group:
for face in room.faces:
if math.degrees(z_axis.angle(face.normal)) >= 91:
down_geo = face.geometry
Expand All @@ -78,7 +78,7 @@ def group_rooms_by_doe2_level(rooms, model_tolerance):
flr_geo = flr_geo.remove_colinear_vertices(tolerance=DOE2_TOLERANCE)
flr_poly = Polygon2D([Point2D(pt.x, pt.y) for pt in flr_geo.boundary])
flr_rooms = []
for room, room_pt in zip(rooms, room_pts):
for room, room_pt in zip(room_group, room_pts):
if flr_poly.is_point_inside_bound_rect(room_pt):
flr_rooms.append(room)
room_groups.append(flr_rooms)
Expand Down
2 changes: 0 additions & 2 deletions tests/writer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,5 +566,3 @@ def test_model_writer_from_ceil_adj_hbjson():
inp_str = hb_model.to.inp(hb_model, hvac_mapping='AssignedHVAC')
assert inp_str.startswith(START_TEXT)
assert inp_str.endswith(END_TEXT)


0 comments on commit efea01b

Please sign in to comment.