|
@@ -7,7 +7,10 @@ from httpx import AsyncClient
|
|
from loguru import logger
|
|
from loguru import logger
|
|
|
|
|
|
from app.controllers.equipment.controller import EquipmentController
|
|
from app.controllers.equipment.controller import EquipmentController
|
|
-from app.models.domain.devices import ACATFCInstructionsRequest
|
|
|
|
|
|
+from app.models.domain.devices import (
|
|
|
|
+ ACATFC2InstructionsRequest,
|
|
|
|
+ ACATFC4InstructionsRequest,
|
|
|
|
+)
|
|
from app.schemas.equipment import AirValveSpeed, FCU
|
|
from app.schemas.equipment import AirValveSpeed, FCU
|
|
from app.schemas.instructions import ACATFCInstructions
|
|
from app.schemas.instructions import ACATFCInstructions
|
|
from app.schemas.space import Space
|
|
from app.schemas.space import Space
|
|
@@ -232,8 +235,8 @@ async def get_fcu_control_result(project_id: str, equipment_id: str) -> Dict:
|
|
|
|
|
|
|
|
|
|
@logger.catch()
|
|
@logger.catch()
|
|
-async def build_acatfc_instructions(
|
|
|
|
- params: ACATFCInstructionsRequest,
|
|
|
|
|
|
+async def build_acatfc2_instructions(
|
|
|
|
+ params: ACATFC2InstructionsRequest,
|
|
) -> ACATFCInstructions:
|
|
) -> ACATFCInstructions:
|
|
space = Space(
|
|
space = Space(
|
|
temperature_target=params.space_temperature_target,
|
|
temperature_target=params.space_temperature_target,
|
|
@@ -254,3 +257,28 @@ async def build_acatfc_instructions(
|
|
)
|
|
)
|
|
|
|
|
|
return instructions
|
|
return instructions
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+@logger.catch()
|
|
|
|
+async def build_acatfc4_instructions(
|
|
|
|
+ params: ACATFC4InstructionsRequest,
|
|
|
|
+) -> ACATFCInstructions:
|
|
|
|
+ space = Space(
|
|
|
|
+ temperature_target=params.space_temperature_target,
|
|
|
|
+ realtime_temperature=params.space_realtime_temperature,
|
|
|
|
+ )
|
|
|
|
+ fcu = FCU(space=space)
|
|
|
|
+
|
|
|
|
+ controller = FCUController(fcu, Season(params.season))
|
|
|
|
+ await controller.run()
|
|
|
|
+ regulated_fcu = controller.get_results()
|
|
|
|
+
|
|
|
|
+ instructions = ACATFCInstructions(
|
|
|
|
+ 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
|