Skip to content

Commit

Permalink
feat(door): Allow Shades to be assigned to Doors
Browse files Browse the repository at this point in the history
This commit brings the library in line with [this PR on honeybee-core](ladybug-tools/honeybee-core#52).
  • Loading branch information
chriswmackey authored and Chris Mackey committed Jan 27, 2020
1 parent c60872f commit 93f61a3
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 10 deletions.
3 changes: 3 additions & 0 deletions honeybee_energy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
Import this into every module where access configurations are needed.
Usage:
.. code-block:: python
from honeybee_energy.config import folders
print(folders.energyplus_path)
print(folders.openstudio_path)
Expand Down
3 changes: 3 additions & 0 deletions honeybee_energy/material/gas.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,9 @@ class EnergyWindowMaterialGasCustom(_EnergyWindowMaterialGasBase):
prandtl
Usage:
.. code-block:: python
co2_gap = EnergyWindowMaterialGasCustom('CO2', 0.0125, 0.0146, 0.000014, 827.73)
co2_gap.specific_heat_ratio = 1.4
co2_gap.molecular_weight = 44
Expand Down
22 changes: 14 additions & 8 deletions honeybee_energy/properties/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,18 @@ def shade_constructions(self):
constructions = []
for shade in self.host.orphaned_shades:
self._check_and_add_obj_construction(shade, constructions)
for room in self.host.rooms:
for room in self.host.rooms: # check all Room Shade constructions
for shade in room.shades:
self._check_and_add_obj_construction(shade, constructions)
for face in room.faces: # check all Face constructions
for face in room.faces: # check all Face Shade constructions
for shade in face.shades:
self._check_and_add_obj_construction(shade, constructions)
for ap in face.apertures: # check all Aperture constructions
for ap in face.apertures: # check all Aperture Shade constructions
for shade in ap.shades:
self._check_and_add_obj_construction(shade, constructions)
for dr in face.doors: # check all Door Shade constructions
for shade in dr.shades:
self._check_and_add_obj_construction(shade, constructions)
return list(set(constructions))

@property
Expand Down Expand Up @@ -212,15 +215,18 @@ def shade_schedules(self):
schedules = []
for shade in self.host.orphaned_shades:
self._check_and_add_shade_schedule(shade, schedules)
for room in self.host.rooms:
for room in self.host.rooms: # check all Room Shade schedules
for shade in room.shades:
self._check_and_add_shade_schedule(shade, schedules)
for face in room.faces: # check all Face schedules
for face in room.faces: # check all Face Shade schedules
for shade in face.shades:
self._check_and_add_shade_schedule(shade, schedules)
for ap in face.apertures: # check all Aperture schedules
for ap in face.apertures: # check all Aperture Shade schedules
for shade in ap.shades:
self._check_and_add_shade_schedule(shade, schedules)
for dr in face.doors: # check all Door Shade schedules
for shade in dr.shades:
self._check_and_add_shade_schedule(shade, schedules)
return list(set(schedules))

@property
Expand Down Expand Up @@ -480,8 +486,8 @@ def apply_properties_from_dict(self, data):
s_dict, constructions, schedules)
for aperture, a_dict in zip(self.host.apertures, ap_e_dicts):
aperture.properties.energy.apply_properties_from_dict(a_dict, constructions)
for aperture, a_dict in zip(self.host.apertures, ap_e_dicts):
aperture.properties.energy.apply_properties_from_dict(a_dict, constructions)
for door, d_dict in zip(self.host.doors, dr_e_dicts):
door.properties.energy.apply_properties_from_dict(d_dict, constructions)

def to_dict(self, include_global_construction_set=True):
"""Return Model energy properties as a dictionary.
Expand Down
3 changes: 3 additions & 0 deletions honeybee_energy/properties/shade.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,13 @@ def duplicate(self, new_host=None):
def _parent_construction_set(host_parent):
"""Recursively search through host parents to find a ConstructionSet."""
if hasattr(host_parent.properties.energy, 'construction_set'):
# we found the room with the construction set
return host_parent.properties.energy.construction_set
elif host_parent.has_parent:
# we found an aperture or face that could have a room with a construction set
return ShadeEnergyProperties._parent_construction_set(host_parent.parent)
else:
# there is no parent room
return None

def ToString(self):
Expand Down
6 changes: 4 additions & 2 deletions honeybee_energy/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ def shade_to_idf(shade):
if shade.has_parent and not isinstance(shade.parent, Room):
if isinstance(shade.parent, Face):
base_srf = shade.parent.name
else: # Aperture for parent
else: # Aperture or Door for parent
try:
base_srf = shade.parent.parent.name
except AttributeError:
base_srf = 'unknown' # aperture without a parent
base_srf = 'unknown' # aperture without a parent (not simulate-able)
values = (shade.name,
base_srf,
trans_sched,
Expand Down Expand Up @@ -430,6 +430,8 @@ def model_to_idf(model, schedule_directory=None,
model_str.append(shade.to.idf(shade))
for dr in face.doors:
model_str.append(dr.to.idf(dr))
for shade in dr.outdoor_shades:
model_str.append(shade.to.idf(shade))
for shade in face.outdoor_shades:
model_str.append(shade.to.idf(shade))
for shade in room.outdoor_shades:
Expand Down

0 comments on commit 93f61a3

Please sign in to comment.