|
@@ -62,14 +62,14 @@ class OnRatioController:
|
|
def calculate_on_ratio(self, period_time: float, delta_on: float, delta_off: float, last_mode: str) -> float:
|
|
def calculate_on_ratio(self, period_time: float, delta_on: float, delta_off: float, last_mode: str) -> float:
|
|
if self.period_num == 0:
|
|
if self.period_num == 0:
|
|
if last_mode == 'normal':
|
|
if last_mode == 'normal':
|
|
- ratio = 0.9
|
|
|
|
|
|
+ ratio = 0.8
|
|
elif last_mode == 'off':
|
|
elif last_mode == 'off':
|
|
- ratio = 0.1
|
|
|
|
|
|
+ ratio = 0.2
|
|
else:
|
|
else:
|
|
if self.return_air > self.target - 0.75:
|
|
if self.return_air > self.target - 0.75:
|
|
- ratio = 0.1
|
|
|
|
|
|
+ ratio = 0.2
|
|
else:
|
|
else:
|
|
- ratio = 0.9
|
|
|
|
|
|
+ ratio = 0.8
|
|
else:
|
|
else:
|
|
if delta_on <= 0:
|
|
if delta_on <= 0:
|
|
ratio = 0.9
|
|
ratio = 0.9
|
|
@@ -78,11 +78,14 @@ class OnRatioController:
|
|
if delta_off >= 0:
|
|
if delta_off >= 0:
|
|
delta_off = 0.0
|
|
delta_off = 0.0
|
|
ratio = (0.5 * (self.target - self.return_air) / period_time - delta_off) / (delta_on - delta_off)
|
|
ratio = (0.5 * (self.target - self.return_air) / period_time - delta_off) / (delta_on - delta_off)
|
|
|
|
+ if ratio > 0.9:
|
|
|
|
+ ratio = 0.9
|
|
|
|
+ if ratio < 0.1:
|
|
|
|
+ ratio = 0.1
|
|
|
|
+
|
|
if delta_on <= 0:
|
|
if delta_on <= 0:
|
|
ratio = 0.5
|
|
ratio = 0.5
|
|
logger.debug(f'delta target: {0.5 * (self.target - self.return_air)}')
|
|
logger.debug(f'delta target: {0.5 * (self.target - self.return_air)}')
|
|
- if ratio > 0.9:
|
|
|
|
- ratio = 0.9
|
|
|
|
except ZeroDivisionError:
|
|
except ZeroDivisionError:
|
|
ratio = 0.1
|
|
ratio = 0.1
|
|
|
|
|
|
@@ -139,7 +142,7 @@ async def start_on_ratio_mode(device_id: str, target: float, period_time: int):
|
|
_DAILY_OFF_TIME = '220000'
|
|
_DAILY_OFF_TIME = '220000'
|
|
|
|
|
|
period_num = 0
|
|
period_num = 0
|
|
- last_on_ratio = 0.9
|
|
|
|
|
|
+ last_on_ratio = 1.0
|
|
last_mode = 'default'
|
|
last_mode = 'default'
|
|
life_count = 0
|
|
life_count = 0
|
|
while life_count < 2000:
|
|
while life_count < 2000:
|
|
@@ -176,7 +179,7 @@ async def start_on_ratio_mode(device_id: str, target: float, period_time: int):
|
|
await asyncio.sleep(period_time)
|
|
await asyncio.sleep(period_time)
|
|
|
|
|
|
period_num = 0
|
|
period_num = 0
|
|
- last_on_ratio = 0.9
|
|
|
|
|
|
+ last_on_ratio = 1.0
|
|
last_mode = mode
|
|
last_mode = mode
|
|
|
|
|
|
life_count += 1
|
|
life_count += 1
|
|
@@ -184,7 +187,7 @@ async def start_on_ratio_mode(device_id: str, target: float, period_time: int):
|
|
else:
|
|
else:
|
|
await send_instructions(device_id, False, 'off', False)
|
|
await send_instructions(device_id, False, 'off', False)
|
|
period_num = 0
|
|
period_num = 0
|
|
- last_on_ratio = 0.1
|
|
|
|
|
|
+ last_on_ratio = 0.0
|
|
last_mode = 'off'
|
|
last_mode = 'off'
|
|
await asyncio.sleep(period_time)
|
|
await asyncio.sleep(period_time)
|
|
except (KeyError, IndexError, TypeError, HTTPException):
|
|
except (KeyError, IndexError, TypeError, HTTPException):
|