Skip to content

Commit

Permalink
fix(phius-res): Update all Phius Residential Components
Browse files Browse the repository at this point in the history
- Remove older Phius Multi-Family, replace with 'get' compo
- Update all Residential Program components
- Update installer versions
  • Loading branch information
ed-p-may committed Jan 28, 2025
1 parent 9445281 commit 3a94fa6
Show file tree
Hide file tree
Showing 15 changed files with 470 additions and 56 deletions.
Binary file modified hbph_installer.gh
Binary file not shown.
2 changes: 1 addition & 1 deletion honeybee_grasshopper_ph/src/HBPH - Add PH Equipment.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
ghenv.Component.Name = "HBPH - Add PH Equipment"
DEV = honeybee_ph_rhino._component_info_.set_component_params(ghenv, dev=False)
if DEV:
from honeybee_ph_rhino.gh_compo_io.program import add_elec_equip as gh_compo_io
from honeybee_ph_rhino.gh_compo_io.program._deprecated_ import add_elec_equip as gh_compo_io

reload(gh_compo_io)
reload(gh_io)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#
# Honeybee-PH: A Plugin for adding Passive-House data to LadybugTools Honeybee-Energy Models
#
# This component is part of the PH-Tools toolkit <https://github.com/PH-Tools>.
#
# Copyright (c) 2025, PH-Tools and bldgtyp, llc <[email protected]>
# Honeybee-PH is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
# by the Free Software Foundation; either version 3 of the License,
# or (at your option) any later version.
#
# Honeybee-PH is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# For a copy of the GNU General Public License
# see <https://github.com/PH-Tools/honeybee_ph/blob/main/LICENSE>.
#
# @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+>
#
"""
....desc....
-
EM January 28, 2025
Args:
_hb_rooms: (list[Room])
Returns:
"""

import scriptcontext as sc
import Rhino as rh
import rhinoscriptsyntax as rs
import ghpythonlib.components as ghc
import Grasshopper as gh

try:
from honeybee_ph_rhino import gh_compo_io
except ImportError as e:
raise ImportError('\nFailed to import honeybee_ph_rhino:\n\t{}'.format(e))

try:
from ph_gh_component_io import gh_io
except ImportError as e:
raise ImportError('\nFailed to import ph_gh_component_io:\n\t{}'.format(e))


#-------------------------------------------------------------------------------
import honeybee_ph_rhino._component_info_
reload(honeybee_ph_rhino._component_info_)
ghenv.Component.Name = "HBPH - Get Phius Multi-Family Load Data"
DEV = honeybee_ph_rhino._component_info_.set_component_params(ghenv, dev="250128")
if DEV:
from honeybee_ph_rhino.gh_compo_io.program import get_phius_mf_data as gh_compo_io
reload(gh_compo_io)
reload(gh_io)

# ------------------------------------------------------------------------------
# -- GH Interface
IGH = gh_io.IGH( ghdoc, ghenv, sc, rh, rs, ghc, gh )


#-------------------------------------------------------------------------------
# -- Create the new Single-Family Home Program from the Rooms
gh_compo_interface = gh_compo_io.GHCompo_GetPhiusMFLoadData(
IGH,
_hb_rooms,
)
(
res_data_by_story_,
res_totals_,
non_res_program_data_,
non_res_room_data_,
non_res_totals_,
) = gh_compo_interface.run()
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
reload(gh_io)
from honeybee_energy_ph.load import phius_mf
reload(phius_mf)
from honeybee_ph_rhino.gh_compo_io.program import phius_MF_calc as gh_compo_io
from honeybee_ph_rhino.gh_compo_io.program._deprecated_ import phius_MF_calc as gh_compo_io
reload(gh_compo_io)


Expand Down
Binary file not shown.
10 changes: 8 additions & 2 deletions honeybee_ph_rhino/_component_info_.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
These are called when the component is instantiated within the Grasshopper canvas.
"""

RELEASE_VERSION = "Honeybee-PH v1.8.01"
RELEASE_VERSION = "Honeybee-PH v1.8.02"
CATEGORY = "HB-PH"
SUB_CATEGORIES = {
0: "00 | Utils",
Expand Down Expand Up @@ -316,7 +316,7 @@
"Category": CATEGORY,
"SubCategory": 1,
},
"HBPH - Create Program - Single Family Home": {
"HBPH - Set Residential Program": {
"NickName": "Create SFH Program",
"Message": RELEASE_VERSION,
"Category": CATEGORY,
Expand All @@ -334,6 +334,12 @@
"Category": CATEGORY,
"SubCategory": 1,
},
"HBPH - Get Phius Multi-Family Load Data": {
"NickName": "Get Phius MF Data",
"Message": RELEASE_VERSION,
"Category": CATEGORY,
"SubCategory": 1,
},
# -- Windows
"HBPH - Create PH Window Frame Element": {
"NickName": "Create Frame Element",
Expand Down
7 changes: 4 additions & 3 deletions honeybee_ph_rhino/gh_compo_io/program/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from honeybee_ph_rhino.gh_compo_io.program.add_elec_equip import GHCompo_AddElecEquip
from honeybee_ph_rhino.gh_compo_io.program.add_process_equip import GHCompo_AddProcessEquip
from honeybee_ph_rhino.gh_compo_io.program.create_elec_equip import GHCompo_CreateElecEquip
from honeybee_ph_rhino.gh_compo_io.program.create_operating_period import GHCompo_CreateOccPeriod
from honeybee_ph_rhino.gh_compo_io.program.create_single_family import GHCompo_CreatePHProgramSingleFamilyHome
from honeybee_ph_rhino.gh_compo_io.program.create_vent_schd import GHCompo_CreateVentSched
from honeybee_ph_rhino.gh_compo_io.program.find_phius_program import GHCompo_FindPhiusProgram
from honeybee_ph_rhino.gh_compo_io.program.get_res_occupancy import GHCompo_GetResOccupancy
from honeybee_ph_rhino.gh_compo_io.program.phius_MF_calc import GHCompo_CalcPhiusMFLoads
from honeybee_ph_rhino.gh_compo_io.program.set_res_program import GHCompo_CreatePHProgramSingleFamilyHome
from honeybee_ph_rhino.gh_compo_io.program.set_dwelling import GHCompo_SetDwelling
from honeybee_ph_rhino.gh_compo_io.program.set_res_occupancy import GHCompo_SetResOccupancy
# --
from honeybee_ph_rhino.gh_compo_io.program._deprecated_.add_elec_equip import GHCompo_AddElecEquip
from honeybee_ph_rhino.gh_compo_io.program._deprecated_.phius_MF_calc import GHCompo_CalcPhiusMFLoads
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

"""GHCompo Interface: HBPH - Phius MF Res Calculator."""

# TODO: REMOVE THIS MODULE... now just 'get' the data...

from collections import defaultdict

Expand Down Expand Up @@ -33,7 +34,7 @@
raise ImportError("\nFailed to import honeybee_energy_ph:\n\t{}".format(e))

try:
from honeybee_ph_rhino import gh_io
from ph_gh_component_io import gh_io
except ImportError as e:
raise ImportError("\nFailed to import honeybee_ph_rhino:\n\t{}".format(e))

Expand Down Expand Up @@ -104,6 +105,8 @@ def check_inputs(_hb_rooms, _IGH):
)
print(msg)
_IGH.warning(msg)
else:
print("{} Stories found".format(len({rm.story for rm in _hb_rooms})))

# -- Check that al the rooms have "PH-Spaces"
rm_with_error = spaces_error(_hb_rooms)
Expand All @@ -129,7 +132,7 @@ def check_inputs(_hb_rooms, _IGH):


def sort_rooms_by_story(_hb_rooms):
# type (list[room.Room]) -> list[list[room.Room]]
# type: (list[room.Room]) -> list[list[room.Room]]
"""Returns lists of the rooms, organized by their Honeybee 'story'.
Arguments:
Expand All @@ -147,6 +150,14 @@ def sort_rooms_by_story(_hb_rooms):
return [d[story_key] for story_key in sorted(d.keys())]


def room_is_dwelling(_hb_room):
# type: (room.Room) -> bool
"""Return True if the Honeybee-Room is a 'dwelling' (residential)?"""
hb_room_prop_e = getattr(_hb_room.properties, "energy") # type: RoomEnergyProperties
hb_room_prop_e_prop_ph = getattr(hb_room_prop_e.people.properties, "ph") # type: PeoplePhProperties
return hb_room_prop_e_prop_ph.is_residential


# -----------------------------------------------------------------------------
# -- Component Interface

Expand All @@ -173,38 +184,39 @@ def __init__(
self.include_garage = bool(_include_garage)
self.hb_rooms = _hb_rooms

msg = (
"Deprecation Warning: This component should not be used any longer. Please use the new"
"'HBPH - Set Residential Program' component instead."
)
print(msg)
self.IGH.error(msg)
raise Exception(msg)


@property
def num_dwelling_units(self):
# type: () -> int
return sum(
rm.properties.energy.people.properties.ph.number_dwelling_units
for rm in self.hb_rooms
if self._room_is_dwelling(rm)
)
"""Return the total number of dwellings in the list of HB-Rooms."""
ph_dwelling_objs = {r.properties.energy.people.properties.ph.dwellings for r in self.hb_rooms} # type: ignore
print("Found {} unique PH-Dwelling objects".format(len(ph_dwelling_objs)))
return sum(d.num_dwellings for d in ph_dwelling_objs)

@property
def num_of_stories(self):
# type: () -> int
return len({rm.story for rm in self.hb_rooms})

def _room_is_dwelling(self, _hb_room):
# type: (room.Room) -> bool
"""Return True if the Honeybee-Room is a 'dwelling' (residential)?"""
hb_room_prop_e = _hb_room.properties.energy # type: RoomEnergyProperties
hb_room_prop_e_prop_ph = hb_room_prop_e.people.properties.ph # type: PeoplePhProperties
return hb_room_prop_e_prop_ph.is_residential

def calc_res_electric_consumption(self, _hb_res_rooms):
# type: (List[room.Room]) -> Tuple[List[str], float, float, float, float, List[str]]

# ---------------------------------------------------------------------------
# -------------------------------------------------------------------------------
# -- Determine the Input Res Honeybee Room attributes by story

rooms_by_story = sort_rooms_by_story(_hb_res_rooms)
phius_stories = [phius_mf.PhiusResidentialStory(room_list) for room_list in rooms_by_story]
phius_stories = sorted(phius_stories, reverse=True)

# ---------------------------------------------------------------------------
# -------------------------------------------------------------------------------
# -- Calculate the total Res. Elec. Energy Consumption
mel_by_story = [story.mel for story in phius_stories]
lighting_int_by_story = [story.lighting_int for story in phius_stories]
Expand All @@ -216,6 +228,7 @@ def calc_res_electric_consumption(self, _hb_res_rooms):
total_res_ext_lighting = sum(lighting_ext_by_story)
total_res_garage_lighting = sum(lighting_garage_by_story)

# -------------------------------------------------------------------------------
# -- Collect for output preview
res_data_by_story_ = [
",".join(
Expand Down Expand Up @@ -400,8 +413,8 @@ def run(self):
if self.hb_rooms:
# ---------------------------------------------------------------------------
# -- Break out the Res from the non-Res HB-Rooms
hb_res_rooms_ = [rm for rm in self.hb_rooms if self._room_is_dwelling(rm)]
hb_nonres_rooms_ = [rm for rm in self.hb_rooms if not self._room_is_dwelling(rm)]
hb_res_rooms_ = [rm for rm in self.hb_rooms if room_is_dwelling(rm)]
hb_nonres_rooms_ = [rm for rm in self.hb_rooms if not room_is_dwelling(rm)]

if not hb_res_rooms_:
msg = "Warning: No Residential HB-Rooms found?"
Expand Down
Loading

0 comments on commit 3a94fa6

Please sign in to comment.