Skip to content

Commit

Permalink
The calculation of the total envelope resistance has been fixed (#83)
Browse files Browse the repository at this point in the history
* Fix total envelope resistance

* Update python-package.yml
  • Loading branch information
Samuel Letellier-Duchesne authored Jun 23, 2021
1 parent 4a2aae9 commit ad855d1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
python -m pip install pytest-cov pytest-xdist[psutil]
python -m pytest -n auto
python -m pip install pytest-cov
python -m pytest
40 changes: 26 additions & 14 deletions pyumi/shoeboxer/shoebox.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,40 @@ def __init__(self, *args, azimuth=180, **kwargs):

@property
def total_envelope_resistance(self):
"""Get the total envelope resistance [m2-K/W]."""
u_factor = 0
"""Get the total envelope resistance [m2-K/W].
Note:
The envelope is consisted of surfaces that have an outside boundary
condition different then `Adiabatic` or `Surface` or that participate in
the heat exchange with the exterior.
"""
u_factor_times_area = 0
gross_area = 0
for surface in self.getsurfaces():
if surface.Surface_Type.lower() not in ["wall", "roof"]:
# loop over surfaces that have heat exchange
if surface.Outside_Boundary_Condition.lower() in ["adiabatic", "surface"]:
continue
construction = surface.get_referenced_object("Construction_Name")
wall = OpaqueConstruction.from_epbunch(construction)
wall_area = surface.area
surface_construction = OpaqueConstruction.from_epbunch(construction)
surface_area = surface.area
gross_area += surface_area

window_area = 0
# for the surface, loop over subsurfaces (aka windows)
surface_window_area = 0
window_u_factor = 0
for subsurface in surface.subsurfaces:
for subsurface in surface.subsurfaces + surface.subsurfaces:
construction = subsurface.get_referenced_object("Construction_Name")
window = WindowConstruction.from_epbunch(construction)
window_area = subsurface.area
window_u_factor += window.u_factor
wwr = window_area / wall_area
u_factor += (
wall.u_factor * wall_area * (1 - wwr)
+ window_u_factor * window_area * wwr
surface_window_area += subsurface.area
window_u_factor += window.u_factor * subsurface.area

# calculate the u_factor_times_area
u_factor_times_area += (
surface_construction.u_factor * (surface_area - surface_window_area)
+ window_u_factor
)
return 1 / (u_factor / self.total_envelope_area)
return 1 / (u_factor_times_area / gross_area)

@property
def total_envelope_area(self):
Expand Down

0 comments on commit ad855d1

Please sign in to comment.