|
@@ -1,6 +1,7 @@
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
-from typing import Dict, List, Optional
|
|
|
+from typing import List, Optional
|
|
|
+
|
|
|
import numpy as np
|
|
|
from httpx import AsyncClient
|
|
|
from loguru import logger
|
|
@@ -21,9 +22,9 @@ class AHUController:
|
|
|
|
|
|
async def build_freq_set(self, supply_air_temperature_set_duration: List, hot_rate: float) -> float:
|
|
|
extent = 5
|
|
|
- if np.isnan(self._equipment.fan_freq_set)\
|
|
|
- or np.isnan(self._system.supply_static_press)\
|
|
|
- or np.isnan(self._system.supply_static_press_set):
|
|
|
+ if (np.isnan(self._equipment.fan_freq_set)
|
|
|
+ or np.isnan(self._system.supply_static_press)
|
|
|
+ or np.isnan(self._system.supply_static_press_set)):
|
|
|
temp_freq_set = 80.0
|
|
|
else:
|
|
|
pre_fan_freq_set = self._equipment.fan_freq_set
|
|
@@ -37,29 +38,34 @@ class AHUController:
|
|
|
|
|
|
temperature_value_list = np.array([item['value'] for item in supply_air_temperature_set_duration])
|
|
|
freq_upper_limit = 90.0
|
|
|
- if temperature_value_list.size > 0\
|
|
|
- and np.all(temperature_value_list == temperature_value_list[0])\
|
|
|
- and temperature_value_list[0] <= 18.0\
|
|
|
- and hot_rate >= 0.5:
|
|
|
+ if (temperature_value_list.size > 0
|
|
|
+ and np.all(temperature_value_list == temperature_value_list[0])
|
|
|
+ and temperature_value_list[0] <= 18.0
|
|
|
+ and hot_rate >= 0.5):
|
|
|
freq_upper_limit = 100.0
|
|
|
freq_set = min(temp_freq_set, freq_upper_limit)
|
|
|
|
|
|
+ self._equipment.fan_freq_set = freq_set
|
|
|
+
|
|
|
return freq_set
|
|
|
|
|
|
@staticmethod
|
|
|
- async def build_supply_air_temperature(outdoor_temperature: float) -> float:
|
|
|
+ async def build_supply_air_temperature_set(outdoor_temperature: float) -> float:
|
|
|
if outdoor_temperature <= 19.0:
|
|
|
- supply_air_temperature = 22.0
|
|
|
+ supply_air_temperature_set = 22.0
|
|
|
elif outdoor_temperature <= 24.0:
|
|
|
- supply_air_temperature = 21.0
|
|
|
+ supply_air_temperature_set = 21.0
|
|
|
elif outdoor_temperature <= 29.0:
|
|
|
- supply_air_temperature = 20.0
|
|
|
+ supply_air_temperature_set = 20.0
|
|
|
elif outdoor_temperature <= 33.0:
|
|
|
- supply_air_temperature = 19.0
|
|
|
+ supply_air_temperature_set = 19.0
|
|
|
else:
|
|
|
- supply_air_temperature = 18.0
|
|
|
+ supply_air_temperature_set = 18.0
|
|
|
+
|
|
|
+ return supply_air_temperature_set
|
|
|
|
|
|
- return supply_air_temperature
|
|
|
+ def get_result(self) -> AHU:
|
|
|
+ return self._equipment
|
|
|
|
|
|
|
|
|
@logger.catch()
|
|
@@ -110,7 +116,7 @@ async def get_supply_air_temperature_controlled(project_id: str, equipment_id: s
|
|
|
outdoor_temperature = float(realtime_weather.get('temperature'))
|
|
|
|
|
|
ahu_controller = AHUController()
|
|
|
- new_supply_air_temperature_set = await ahu_controller.build_supply_air_temperature(outdoor_temperature)
|
|
|
+ new_supply_air_temperature_set = await ahu_controller.build_supply_air_temperature_set(outdoor_temperature)
|
|
|
# logger.debug(f'{equipment_id} supply air temperature set: {new_supply_air_temperature_set}')
|
|
|
|
|
|
async with AsyncClient() as client:
|