Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(annualglare): Subtract hours above threshold from total hours #749

Merged
merged 1 commit into from May 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 9 additions & 6 deletions honeybee_radiance/postprocess/annualglare.py
Expand Up @@ -187,22 +187,25 @@ def _glare_autonomy(values, occ_pattern, glare_threshold, total_hours):
occ_pattern: A list of 0 and 1 values for hours of occupancy.
glare_threshold: A fractional number for the threshold of DGP above which
conditions are considered to induce glare. Default: 0.4.
total_occupied_hours: An integer for the total number of occupied hours,
which can be used to avoid having to sum occ pattern each time.
total_hours: An integer for the total number of occupied hours, which can be used
to avoid having to sum occ pattern each time.

Returns:
glare autonomy
"""
def _percentage(in_v, occ_hours):
return round(100.0 * in_v / occ_hours, 2)

ga = 0

ga_above = 0
# count hours above glare threshold
for is_occ, value in zip(occ_pattern, values):
if is_occ == 0:
continue
if value < glare_threshold:
ga += 1
if value > glare_threshold:
ga_above += 1

# get the number of glare free hours
ga = total_hours - ga_above

return _percentage(ga, total_hours)

Expand Down