12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- # -*- coding: utf-8 -*-
- 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.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
- from app.services.platform import DataPlatformService
- @repeat_every(seconds=60 * 5)
- async def regulate_ahu_freq():
- _PROJECT_ID = 'Pj1101050030'
- _AHU_LIST = [
- 'Eq1101050030b6b2f1db3d6944afa71e213e0d45d565',
- 'Eq1101050030846e0a94670842109f7c8d8db0d44cf5'
- ]
- for ahu in _AHU_LIST:
- await get_freq_controlled(_PROJECT_ID, ahu)
- @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:
- platform = DataPlatformService(client, _PROJECT_ID)
- ahu_list = await platform.get_items_by_category('ATAH')
- for ahu in ahu_list:
- await ahu_switch_control(_PROJECT_ID, ahu)
- @repeat_every(seconds=60 * 15)
- async def regulate_pau_switch():
- _PROJECT_ID = 'Pj1101020002'
- async with AsyncClient() as client:
- platform = DataPlatformService(client, _PROJECT_ID)
- pau_list = await platform.get_items_by_category('ATFU')
- for pau in pau_list:
- await pau_switch_control(_PROJECT_ID, pau)
- @repeat_every(seconds=60 * 15)
- async def regulate_ventilation_fan_switch():
- _PROJECT_ID = 'Pj1101020002'
- async with AsyncClient() as client:
- platform = DataPlatformService(client, _PROJECT_ID)
- eq_list = await platform.get_items_by_category('VTSF')
- for eq in eq_list:
- await ventilation_fan_switch_control(_PROJECT_ID, eq)
|