|
@@ -7,6 +7,7 @@ from httpx import AsyncClient
|
|
|
from loguru import logger
|
|
|
|
|
|
from app.controllers.equipment.controller import EquipmentController
|
|
|
+from app.models.domain.devices import ACATFCInstructionsRequest
|
|
|
from app.schemas.equipment import AirValveSpeed, FCU
|
|
|
from app.schemas.space import Space
|
|
|
from app.services.platform import DataPlatformService, InfoCode
|
|
@@ -216,3 +217,30 @@ async def get_fcu_control_result(project_id: str, equipment_id: str) -> Dict:
|
|
|
}
|
|
|
|
|
|
return output
|
|
|
+
|
|
|
+
|
|
|
+@logger.catch()
|
|
|
+async def build_acatfc_instructions(params: ACATFCInstructionsRequest) -> Dict:
|
|
|
+ space = Space(
|
|
|
+ temperature_target=params.space_temperature_target,
|
|
|
+ realtime_temperature=params.space_realtime_temperature
|
|
|
+ )
|
|
|
+ fcu = FCU(
|
|
|
+ space=space,
|
|
|
+ supply_air_temperature=params.supply_air_temperature,
|
|
|
+ water_in_temperature=params.water_in_temperature
|
|
|
+ )
|
|
|
+
|
|
|
+ controller = FCUControllerV2(fcu, Season(params.season))
|
|
|
+ await controller.run()
|
|
|
+ regulated_fcu = controller.get_results()
|
|
|
+
|
|
|
+ instructions = {
|
|
|
+ 'switch_set': 1 if regulated_fcu.running_status else 0,
|
|
|
+ 'speed_set': regulated_fcu.air_valve_speed.value,
|
|
|
+ 'temperature_set': float(round_half_up(regulated_fcu.setting_temperature, 1)),
|
|
|
+ 'mode_set': regulated_fcu.work_mode,
|
|
|
+ 'water_valve_switch_set': 1 if regulated_fcu.running_status else 0
|
|
|
+ }
|
|
|
+
|
|
|
+ return instructions
|