123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- from typing import List, Optional
- from httpx import AsyncClient
- from loguru import logger
- from app.schemas.equipment import VAVBox
- from app.services.platform import DataPlatformService, InfoCode
- def count_vav_box_weight(realtime: float, target: float) -> float:
- diff = abs(realtime - target)
- if diff > 3:
- weight = 4
- elif diff > 2:
- weight = 3
- elif diff > 1:
- weight = 2
- elif diff > 0:
- weight = 1
- else:
- weight = 0
- return weight * (realtime - target)
- class ACATAHThermalModeController:
- """
- Decide whether to use cooling or heating mode according to space condition controlled by VAV Box.
- Writen by WuXu
- """
- def __init__(self, vav_boxes_list: List[VAVBox]):
- super(ACATAHThermalModeController, self).__init__()
- self.vav_boxes_list = vav_boxes_list
- def build(self) -> str:
- weight = 0.0
- for box in self.vav_boxes_list:
- weight += count_vav_box_weight(box.virtual_realtime_temperature, box.virtual_target_temperature)
- if weight > 0:
- mode = 'cooling'
- elif weight < 0:
- mode = 'heating'
- else:
- mode = 'hold'
- return mode
|