|
@@ -5,7 +5,6 @@ import numpy as np
|
|
|
from httpx import AsyncClient
|
|
|
from loguru import logger
|
|
|
|
|
|
-from app.controllers.events import ahu_supply_air_temp_set_dict
|
|
|
from app.schemas.equipment import AHU
|
|
|
from app.schemas.system import ACAT
|
|
|
from app.services.platform import DataPlatformService, InfoCode
|
|
@@ -19,7 +18,6 @@ class AHUController:
|
|
|
super(AHUController, self).__init__()
|
|
|
self._equipment = equipment
|
|
|
self._system = system
|
|
|
- self._supply_air_temperature_command_dict = ahu_supply_air_temp_set_dict.get('dataframe')
|
|
|
|
|
|
async def build_freq_set(self, supply_air_temperature_set_duration: List, hot_rate: float) -> float:
|
|
|
extent = 5
|
|
@@ -38,25 +36,30 @@ class AHUController:
|
|
|
temp_freq_set = pre_fan_freq_set
|
|
|
|
|
|
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:
|
|
|
- freq_set = 100.0
|
|
|
- else:
|
|
|
- freq_set = min(temp_freq_set, 90.0)
|
|
|
+ freq_upper_limit = 100.0
|
|
|
+ freq_set = min(temp_freq_set, freq_upper_limit)
|
|
|
|
|
|
return freq_set
|
|
|
|
|
|
- async def build_supply_air_temperature_set(self, outdoor_temperature: float) -> float:
|
|
|
- command_df = self._supply_air_temperature_command_dict
|
|
|
- temp_command = command_df.loc[command_df['outdoor_temperature'] == outdoor_temperature]['temperature_set']
|
|
|
- if len(temp_command) > 0:
|
|
|
- command = float(temp_command)
|
|
|
+ @staticmethod
|
|
|
+ async def build_supply_air_temperature(outdoor_temperature: float) -> float:
|
|
|
+ if outdoor_temperature <= 19.0:
|
|
|
+ supply_air_temperature = 22.0
|
|
|
+ elif outdoor_temperature <= 24.0:
|
|
|
+ supply_air_temperature = 21.0
|
|
|
+ elif outdoor_temperature <= 29.0:
|
|
|
+ supply_air_temperature = 20.0
|
|
|
+ elif outdoor_temperature <= 33.0:
|
|
|
+ supply_air_temperature = 19.0
|
|
|
else:
|
|
|
- command = 20.0
|
|
|
+ supply_air_temperature = 18.0
|
|
|
|
|
|
- return command
|
|
|
+ return supply_air_temperature
|
|
|
|
|
|
|
|
|
@logger.catch()
|
|
@@ -93,7 +96,7 @@ async def get_freq_controlled(project_id: str, equipment_id: str) -> None:
|
|
|
|
|
|
ahu_controller = AHUController(ahu, acat_system)
|
|
|
new_freq_set = await ahu_controller.build_freq_set(supply_air_temperature_set, hot_rate)
|
|
|
- logger.debug(f'freq set: {new_freq_set}')
|
|
|
+ logger.debug(f'{equipment_id} freq set: {new_freq_set}')
|
|
|
|
|
|
async with AsyncClient() as client:
|
|
|
platform = DataPlatformService(client, project_id)
|
|
@@ -105,11 +108,11 @@ async def get_supply_air_temperature_controlled(project_id: str, equipment_id: s
|
|
|
async with AsyncClient() as client:
|
|
|
weather_service = WeatherService(client)
|
|
|
realtime_weather = await weather_service.get_realtime_weather(project_id)
|
|
|
- outdoor_temperature = realtime_weather.get('temperature')
|
|
|
+ outdoor_temperature = float(realtime_weather.get('temperature'))
|
|
|
|
|
|
ahu_controller = AHUController()
|
|
|
- new_supply_air_temperature_set = await ahu_controller.build_supply_air_temperature_set(outdoor_temperature)
|
|
|
- logger.debug(f'supply air temperature set: {new_supply_air_temperature_set}')
|
|
|
+ new_supply_air_temperature_set = await ahu_controller.build_supply_air_temperature(outdoor_temperature)
|
|
|
+ logger.debug(f'{equipment_id} supply air temperature set: {new_supply_air_temperature_set}')
|
|
|
|
|
|
async with AsyncClient() as client:
|
|
|
platform = DataPlatformService(client, project_id)
|