Skip to content

Commit

Permalink
fix(adaptive): Ensure EN-16798 lower threshold is 1C cooler
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswmackey authored and Chris Mackey committed Jun 1, 2024
1 parent d16c173 commit fce0773
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 16 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ jobs:
with:
python-version: 3.7
- name: set up node # we need node for for semantic release
uses: actions/setup-node@v2.1.2
uses: actions/setup-node@v4
with:
node-version: 14.2.0
node-version: 22.2.0
- name: install python dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -59,8 +59,8 @@ jobs:
- name: run semantic release
id: new_release
run: |
nextRelease="`npx semantic-release@^17.0.0 --dryRun | grep -oP 'Published release \K.*? ' || true`"
npx semantic-release@^17.0.0
nextRelease="`npx semantic-release@^23.1.1 --dryRun | grep -oP 'Published release \K.*? ' || true`"
npx semantic-release@^23.1.1
echo "::set-output name=tag::$nextRelease"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
8 changes: 7 additions & 1 deletion .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/github",
[
"@semantic-release/github",
{
"successComment": false,
"failTitle": false
}
],
[
"@semantic-release/exec",
{
Expand Down
19 changes: 14 additions & 5 deletions ladybug_comfort/chart/adaptive.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,11 +470,20 @@ def comfort_polygon(self):
"""Get a Polygon2D for the comfort range on the chart."""
# start off with the neutral polyline and move it based on the offset
neutral_line = self.neutral_polyline
offset_t = self.comfort_parameter.neutral_offset if not self.use_ip else \
self.DT_TYPE.to_unit([self.comfort_parameter.neutral_offset], 'dF', 'dC')[0]
offset_dist = self.y_dim * offset_t
lower_line = neutral_line.move(Vector2D(0, -offset_dist))
upper_line = neutral_line.move(Vector2D(0, offset_dist))
offset_t_up = self.comfort_parameter.neutral_offset
# lower threshold of EN-16798 is 1 degree cooler than upper threshold
offset_t_low = -self.comfort_parameter.neutral_offset \
if self.comfort_parameter.standard == 'ASHRAE-55' else \
-self.comfort_parameter.neutral_offset - 1
offset_t_up = offset_t_up if not self.use_ip else \
self.DT_TYPE.to_unit([offset_t_up], 'dF', 'dC')[0]
offset_t_low = offset_t_low if not self.use_ip else \
self.DT_TYPE.to_unit([offset_t_low], 'dF', 'dC')[0]

offset_dist_up = self.y_dim * offset_t_up
offset_dist_low = self.y_dim * offset_t_low
upper_line = neutral_line.move(Vector2D(0, offset_dist_up))
lower_line = neutral_line.move(Vector2D(0, offset_dist_low))

# trim the bottom of the polygon if there is a cold_prevail_temp_limit
if self.comfort_parameter.cold_prevail_temp_limit > 10:
Expand Down
4 changes: 2 additions & 2 deletions ladybug_comfort/collection/adaptive.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from ladybug.analysisperiod import AnalysisPeriod

from ladybug.datatype.temperature import Temperature, OperativeTemperature, \
PrevailingOutdoorTemperature
PrevailingOutdoorTemperature, NeutralTemperature
from ladybug.datatype.speed import Speed, AirSpeed
from ladybug.datatype.thermalcondition import ThermalComfort, ThermalCondition
from ladybug.datatype.temperaturedelta import OperativeTemperatureDelta
Expand Down Expand Up @@ -199,7 +199,7 @@ def comfort_parameter(self):
def neutral_temperature(self):
"""Data Collection of the desired neutral temperature in degrees C."""
return self._get_coll('_neutral_temperature_coll', self._neutral_temperature,
OperativeTemperature, 'C')
NeutralTemperature, 'C')

@property
def degrees_from_neutral(self):
Expand Down
14 changes: 10 additions & 4 deletions ladybug_comfort/parameter/adaptive.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,16 @@ def is_comfortable(self, comfort_result, cooling_effect=0):
adaptive_comfort_ashrae55 or adaptive_comfort_en15251 functions.
cooling_effect: Cooling effect from elevated air speed.
"""
return 1 if (comfort_result['to'] >= self._min_operative and
comfort_result['deg_comf'] >= -self.neutral_offset and
comfort_result['deg_comf'] <= self.neutral_offset +
cooling_effect) else 0
if self._standard:
return 1 if (comfort_result['to'] >= self._min_operative and
comfort_result['deg_comf'] >= -self.neutral_offset and
comfort_result['deg_comf'] <= self.neutral_offset +
cooling_effect) else 0
else: # lower threshold of EN-16798 is 1 degree cooler than upper threshold
return 1 if (comfort_result['to'] >= self._min_operative and
comfort_result['deg_comf'] >= -self.neutral_offset - 1 and
comfort_result['deg_comf'] <= self.neutral_offset +
cooling_effect) else 0

def thermal_condition(self, comfort_result, cooling_effect=0):
"""Determine whether conditions are cold, neutral or hot.
Expand Down

0 comments on commit fce0773

Please sign in to comment.