Skip to content

Commit

Permalink
fix(shw_create_recirc_pipes): Allow custom water-temp, use-hours
Browse files Browse the repository at this point in the history
- Add new water-temp and usage hours attributes to the SHW recirc. components
  • Loading branch information
ed-p-may committed Jun 8, 2023
1 parent 5f8a948 commit 3f28aec
Show file tree
Hide file tree
Showing 10 changed files with 162 additions and 45 deletions.
Binary file modified hbph_installer.gh
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"""
Create new HBPH DHW Recirculation Piping Object.
-
EM October 2, 2022
EM June 8, 2023
Args:
_geometry: (List[Curve]) A list of curves representing the SHW Recirculation
Expand Down Expand Up @@ -63,7 +63,8 @@
_daily_period: (List[float]) The daily operating period in hours.
_water_temp: (List[float]) The temp [C] of the water in the recirculation piping.
Returns:
dhw_recirc_piping_: (List[PhPipeElement]) A list of the new HBPH Piping
objects created. These can be added to HB Rooms using the 'Add PH DHW Piping'
Expand All @@ -85,6 +86,9 @@
ghenv.Component.Name = "HBPH - Create SHW Recirculation Pipes"
DEV = honeybee_ph_rhino._component_info_.set_component_params(ghenv, dev=False)
if DEV:
from honeybee_energy_ph.hvac import hot_water
reload(hot_water)
from honeybee_ph_rhino.gh_compo_io import shw_create_recirc_pipes as gh_compo_io
reload(gh_compo_io)
reload(gh_io)

Expand All @@ -104,6 +108,7 @@
_insul_reflective,
_insul_quality,
_daily_period,
_water_temp,
)
dhw_recirc_piping_ = gh_compo_interface.run()

Expand Down
8 changes: 6 additions & 2 deletions honeybee_grasshopper_ph/src/HBPH - Phius MF Res Calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
This does NOT include the other residential appliances (fridge, cooking, etc..). Be sure to add those
to the Residential Honeybee-Rooms in addition to the elec_equipment_ created by this component.
-
EM March 19, 2023
EM June 8, 2023
Args:
int_light_HE_frac_: (float) default=1.0 | The % (0-1.0) of interior lighting
Expand All @@ -41,7 +41,10 @@
garage_light_HE_frac_: (float) default=1.0 | The % (0-1.0) of garage lighting
that is 'high efficiency'
include_garage_: (bool) Default=False. Set to True to include the standard Phius
garage lighting.
include_elevator_: (bool) Default=False. Set to True to include the standard Phius Elevator
which is based on the number of stories. (<=6-stories Hyrdaulic, <=20-stories Geared Traction, 21+stories Gearless Traction)
-
Expand Down Expand Up @@ -126,6 +129,7 @@
garage_light_HE_frac_,
include_elevator_,
_hb_rooms,
include_garage_,
)

(
Expand Down
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion 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.0.51"
RELEASE_VERSION = "Honeybee-PH v1.0.52"
CATEGORY = "HB-PH"
SUB_CATEGORIES = {
0: "00 | Utils",
Expand Down
132 changes: 104 additions & 28 deletions honeybee_ph_rhino/gh_compo_io/assmbly_import_flixo_mats.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,123 +4,199 @@
"""GHCompo Interface: HBPH - Import Flixo Materials."""

try:
from typing import Optional, List
from typing import Optional, List, Any
except ImportError:
pass # IronPython 2.7

from itertools import izip
try:
from itertools import izip
except ImportError:
izip = zip
from io import open
import os
from io import open as io_open

from honeybee.typing import clean_ep_string
from honeybee_energy.material.opaque import EnergyMaterial
from honeybee_ph_rhino import gh_io

class FlixoDataItem(object):

"""
Represents a data item in Flixo, a software for thermal analysis of building components.
"""

def __init__(self, *args, **kwargs):
# type: (*Any, **Any) -> None
"""
Initializes the object with any number of keyword arguments.
:param kwargs: The keyword arguments to set as attributes of the object.
"""
for k, v in kwargs.items():
setattr(self, str(k), str(v))

@property
def display_name(self):
# type: () -> str
"""
Gets the display name of the data item.
:return: The display name of the data item as a string.
"""
return getattr(self, "Name", "")

@property
def conductivity(self):
# type: () -> Optional[float]
"""
Gets the thermal conductivity of the data item.
:return: The thermal conductivity of the data item as a float, or None if it cannot be converted to a float.
"""
try:
return float(getattr(self, "LambdaHor"))
except:
return None

def __str__(self):
# type: () -> str
"""
Returns a string representation of the object.
:return: A string representation of the object.
"""
return "{}(display_name={})".format(self.__class__.__name__, self.display_name)

def __repr__(self):
# type: () -> str
"""
Returns a string representation of the object.
:return: A string representation of the object.
"""
return str(self)

def ToString(self):
return str(self)
# type: () -> str
"""
Returns a string representation of the object.
:return: A string representation of the object.
"""
return str(self)

class GHCompo_ImportFlixoMaterials(object):
THICKNESS = 1.0 #m
DENSITY = 999.9999
SPEC_HEAT = 999.999
ROUGHNESS = "Rough"
THERM_ABS = 0.9
SOL_ABS = 0.7
VIS_ABS = 0.7
"""
A class for importing materials from Flixo, a software for thermal analysis of building components, into Honeybee.
"""

THICKNESS = 1.0 # type: float
DENSITY = 999.9999 # type: float
SPEC_HEAT = 999.999 # type: float
ROUGHNESS = "Rough" # type: str
THERM_ABS = 0.9 # type: float
SOL_ABS = 0.7 # type: float
VIS_ABS = 0.7 # type: float

def __init__(self, _IGH, _path):
# type: (gh_io.IGH, str) -> None
"""
Initializes the object with an instance of the Grasshopper IGH interface and a path to the Flixo material file.
:param _IGH: An instance of the Grasshopper IGH interface.
:param _path: A path to the Flixo material file as a string.
"""
self.IGH = _IGH
self._path = str(_path)

@property
def path(self):
# type: () -> Optional[str]
"""
Gets the path to the Flixo material file.
:return: The path to the Flixo material file as a string, or None if the file does not exist or is not a CSV file.
"""
if not os.path.exists(self._path):
return None

file_extension = str(os.path.splitext(self._path)[1]).upper()
if not file_extension == ".CSV":
msg = "Error: please input only .CSV files."
self.IGH.warning(msg)
return None

return self._path

def build_headers(self, _headers):
# type: (str) -> List[str]
"""
Builds a list of headers from a semicolon-separated string of headers.
:param _headers: A semicolon-separated string of headers as a string.
:return: A list of headers as a list of strings.
"""
headers_list = _headers.split(";")

headers_ = []
for header_name in headers_list:

counter = len([header_name for h in headers_ if "{}_".format(header_name) in h or header_name in h])
if counter != 0:
header_name = "{}_{}".format(header_name, counter)
headers_.append(header_name)

return headers_

def build_flixo_data_from_inputs(self, _data):
# type: (List[str]) -> List[FlixoDataItem]
"""
Builds a list of Flixo data items from a list of semicolon-separated strings of data.
:param _data: A list of semicolon-separated strings of data as a list of strings.
:return: A list of Flixo data items as a list of FlixoDataItem objects.
"""
flixo_data_items = []
headers = self.build_headers(_data[1])
for item in _data[2:]:
flixo_data_items.append(
FlixoDataItem(
**{k:v for k, v in izip(headers, item.split(";")[1:])}
)
**{k: v for k, v in izip(headers, item.split(";")[1:])}
)
)
return flixo_data_items

def build_hb_materials(self, _flixo_data_items):
# type: (List[FlixoDataItem]) -> List[EnergyMaterial]
"""
Builds a list of Honeybee energy materials from a list of Flixo data items.
:param _flixo_data_items: A list of Flixo data items as a list of FlixoDataItem objects.
:return: A list of Honeybee energy materials as a list of EnergyMaterial objects.
"""
materials_ = []
for fl in sorted(_flixo_data_items, key=lambda f: f.display_name):
if not fl.display_name:
continue

hb_mat = EnergyMaterial(
clean_ep_string(fl.display_name), self.THICKNESS, fl.conductivity, self.DENSITY,
clean_ep_string(fl.display_name), self.THICKNESS, fl.conductivity, self.DENSITY,
self.SPEC_HEAT, self.ROUGHNESS, self.THERM_ABS, self.SOL_ABS, self.VIS_ABS)
materials_.append(hb_mat)
return materials_

def run(self):
# type: () -> List[EnergyMaterial]
"""
Runs the import process and returns a list of Honeybee energy materials.
:return: A list of Honeybee energy materials as a list of EnergyMaterial objects.
"""
if not self.path:
return []

# -- Get the file data
with io_open(self.path) as f:
with open(self.path) as f:
data = f.readlines()

flixo_data_items = self.build_flixo_data_from_inputs(data)
return self.build_hb_materials(flixo_data_items)
return self.build_hb_materials(flixo_data_items)
26 changes: 18 additions & 8 deletions honeybee_ph_rhino/gh_compo_io/prog_Phius_MF_calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,17 @@ def __init__(
_garage_light_HE_frac_,
_include_elevator,
_hb_rooms,
_include_garage=False,
*args,
**kwargs
):
# type: (gh_io.IGH, float, float, float, bool, List[room.Room]) -> None
# type: (gh_io.IGH, float, float, float, bool, List[room.Room], bool, *Any, **Any) -> None
self.IGH = _IGH
self.int_light_HE_frac_ = _int_light_HE_frac_
self.ext_light_HE_frac_ = _ext_light_HE_frac_
self.garage_light_HE_frac_ = _garage_light_HE_frac_
self.include_elevator = _include_elevator
self.include_garage = bool(_include_garage)
self.hb_rooms = _hb_rooms

@property
Expand Down Expand Up @@ -319,6 +323,17 @@ def build_elevator(self):
elevator.energy_demand = elevator.energy_demand / len(self.hb_rooms)
return elevator

def build_garage_lighting(self, _bldg_avg_lighting_garage):
# type: (float) -> ph_equipment.PhCustomAnnualLighting
"""Return a new Garage Lighting object."""
lighting_garage = ph_equipment.PhCustomAnnualLighting(
_defaults=ph_default_equip["PhCustomAnnualLighting"]["PHIUS"]
)
lighting_garage.energy_demand = _bldg_avg_lighting_garage
lighting_garage.comment = "Garage Lighting - Phius MF Calculator"
lighting_garage.in_conditioned_space = False
return lighting_garage

def create_new_MF_elec_equip(
self,
_hb_res_rooms,
Expand Down Expand Up @@ -374,13 +389,8 @@ def create_new_MF_elec_equip(
lighting_ext.comment = "Exterior Lighting - Phius MF Calculator"
elec_equipment_.append(lighting_ext)

lighting_garage = ph_equipment.PhCustomAnnualLighting(
_defaults=ph_default_equip["PhCustomAnnualLighting"]["PHIUS"]
)
lighting_garage.energy_demand = bldg_avg_lighting_garage
lighting_garage.comment = "Garage Lighting - Phius MF Calculator"
lighting_garage.in_conditioned_space = False
elec_equipment_.append(lighting_garage)
if self.include_garage:
elec_equipment_.append(self.build_garage_lighting(bldg_avg_lighting_garage))

if self.include_elevator:
elec_equipment_.append(self.build_elevator())
Expand Down
16 changes: 16 additions & 0 deletions honeybee_ph_rhino/gh_compo_io/prog_find_Phius_program.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@
class GHCompo_FindPhiusProgram(object):
def __init__(self, _IGH, _name, _description, _protocol, _base_program):
# type: (gh_io.IGH, str, str, str, str) -> None
"""Initialize the GHCompo_FindPhiusProgram class.
Args:
_IGH: The Grasshopper input/output handler.
_name: The name of the space to find a program for.
_description: The description of the space to find a program for.
_protocol: The protocol to use for the program.
_base_program: The base program to use for the program.
Returns:
None
"""
self.IGH = _IGH
self.name = _name
self.description = _description
Expand All @@ -35,7 +47,11 @@ def __init__(self, _IGH, _name, _description, _protocol, _base_program):

def run(self):
# type: () -> Optional[List[ProgramType]]
"""Run the GHCompo_FindPhiusProgram class.
Returns:
Optional[List[ProgramType]]: A list of program types.
"""
# -- Get the data from in the Phius data set
if not self.name and not self.description:
msg = "Input a name or a description of the space to find a Program."
Expand Down
Loading

0 comments on commit 3f28aec

Please sign in to comment.