Change percent_open calculation method (#772)

* Change percent_open calculation method

Modified 'percent_open' calculation method :

  - Before : If < min_opening_degree then =min_opening_degree
  - Now : Each % step is calculated (100 - min_opening_degree)/100

* Code aesthetics

* Code aesthetics

* Updated test_overclimate_valve.py
This commit is contained in:
zepala
2025-01-04 08:33:04 +01:00
committed by GitHub
parent e727c0628e
commit 68e05bef31
2 changed files with 14 additions and 7 deletions

View File

@@ -1080,10 +1080,17 @@ class UnderlyingValveRegulation(UnderlyingValve):
)
return
# Send opening_degree
if 0 < self._percent_open < self._min_opening_degree:
self._percent_open = self._min_opening_degree
# Caclulate percent_open
if self._percent_open >= 1:
self._percent_open = round(
self._min_opening_degree
+ (self._percent_open
* (100 - self._min_opening_degree) / 100)
)
else:
self._percent_open = 0
# Send opening_degree
await super().send_percent_open()
# Send closing_degree if set