Browse Source

delete supply air temperature set version 1 control logic of AHU

chenhaiyang 4 years ago
parent
commit
43e49552eb

+ 0 - 35
app/controllers/equipment/ahu/basic.py

@@ -10,7 +10,6 @@ from app.schemas.equipment import AHU
 from app.schemas.system import ACAT
 from app.services.platform import DataPlatformService, InfoCode
 from app.services.transfer import Duoduo
-from app.services.weather import WeatherService
 
 
 class AHUController:
@@ -49,24 +48,6 @@ class AHUController:
 
         return freq_set
 
-    @staticmethod
-    async def build_supply_air_temperature_set(outdoor_temperature: float) -> float:
-        if outdoor_temperature <= 19.0:
-            supply_air_temperature_set = 22.0
-        elif outdoor_temperature <= 24.0:
-            supply_air_temperature_set = 21.0
-        elif outdoor_temperature <= 29.0:
-            supply_air_temperature_set = 20.0
-        elif outdoor_temperature <= 33.0:
-            supply_air_temperature_set = 19.0
-        else:
-            supply_air_temperature_set = 18.0
-
-        return supply_air_temperature_set
-
-    def get_result(self) -> AHU:
-        return self._equipment
-
 
 @logger.catch()
 async def get_freq_controlled(project_id: str, equipment_id: str) -> None:
@@ -106,19 +87,3 @@ async def get_freq_controlled(project_id: str, equipment_id: str) -> None:
     async with AsyncClient() as client:
         platform = DataPlatformService(client, project_id)
         await platform.set_code_value(equipment_id, InfoCode.fan_freq_set, new_freq_set)
-
-
-@logger.catch()
-async def get_supply_air_temperature_controlled(project_id: str, equipment_id: str) -> None:
-    async with AsyncClient() as client:
-        weather_service = WeatherService(client)
-        realtime_weather = await weather_service.get_realtime_weather(project_id)
-        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'{equipment_id} supply air temperature set: {new_supply_air_temperature_set}')
-
-    async with AsyncClient() as client:
-        platform = DataPlatformService(client, project_id)
-        await platform.set_code_value(equipment_id, InfoCode.supply_air_temperature_set, new_supply_air_temperature_set)

+ 1 - 13
app/controllers/equipment/events.py

@@ -3,7 +3,7 @@
 from fastapi_utils.tasks import repeat_every
 from httpx import AsyncClient
 
-from app.controllers.equipment.ahu.basic import get_freq_controlled, get_supply_air_temperature_controlled
+from app.controllers.equipment.ahu.basic import get_freq_controlled
 from app.controllers.equipment.ahu.switch import ahu_switch_control
 from app.controllers.equipment.pau.switch import pau_switch_control
 from app.controllers.equipment.ventilation_fan.switch import ventilation_fan_switch_control
@@ -23,18 +23,6 @@ async def regulate_ahu_freq():
 
 
 @repeat_every(seconds=60 * 15)
-async def regulate_ahu_supply_air_temperature():
-    _PROJECT_ID = 'Pj1101050030'
-    _AHU_LIST = [
-        'Eq1101050030b6b2f1db3d6944afa71e213e0d45d565',
-        'Eq1101050030846e0a94670842109f7c8d8db0d44cf5'
-    ]
-
-    for ahu in _AHU_LIST:
-        await get_supply_air_temperature_controlled(_PROJECT_ID, ahu)
-
-
-@repeat_every(seconds=60 * 15)
 async def regulate_ahu_switch():
     _PROJECT_ID = 'Pj1101020002'
     async with AsyncClient() as client:

+ 0 - 0
app/controllers/equipment/fcu/off_ratio.py


+ 0 - 7
app/controllers/events.py

@@ -1,6 +1,5 @@
 # -*- coding: utf-8 -*-
 
-import pandas as pd
 import scipy.io as sio
 
 from app.core.config import settings
@@ -15,9 +14,3 @@ async def load_q_learning_model():
     winter_model_path = f'{base_path}/app/resources/ml_models/equipment/fcu/q_learning/net_1_winter.mat'
     q_learning_models.update({'summer': sio.loadmat(summer_model_path)['net'][0, 0][0]})
     q_learning_models.update({'winter': sio.loadmat(winter_model_path)['net'][0, 0][0]})
-
-
-async def load_ahu_supply_temperature_set_dict():
-    base_path = settings.PROJECT_DIR
-    data_path = f'{base_path}/app/resources/ml_models/equipment/ahu/supply_temp_set_dict.csv'
-    ahu_supply_air_temp_set_dict.update({'dataframe': pd.read_csv(data_path)})

+ 0 - 2
app/core/events.py

@@ -6,7 +6,6 @@ from fastapi import FastAPI
 
 from app.controllers.equipment.events import (
     regulate_ahu_freq,
-    regulate_ahu_supply_air_temperature,
     regulate_ahu_switch,
     regulate_pau_switch,
     regulate_ventilation_fan_switch
@@ -17,7 +16,6 @@ from app.controllers.events import load_q_learning_model
 def create_start_app_handler(app: Optional[FastAPI] = None) -> Callable:
     async def start_app() -> None:
         await load_q_learning_model()
-        await regulate_ahu_supply_air_temperature()
         await regulate_ahu_freq()
         await regulate_ahu_switch()
         await regulate_pau_switch()