|
@@ -9,6 +9,7 @@ from app.models.equipment import AirValveSpeed
|
|
|
from app.models.equipment import FCU
|
|
|
from app.models.space import Space
|
|
|
from app.services.transfer import SpaceInfoService, EquipmentInfoService
|
|
|
+from app.services.platform import DataPlatformService
|
|
|
|
|
|
|
|
|
class FCUController(EquipmentController):
|
|
@@ -19,7 +20,7 @@ class FCUController(EquipmentController):
|
|
|
|
|
|
async def get_temperature_target(self) -> float:
|
|
|
target = self._equipment.space.temperature_target
|
|
|
- if target is not np.NAN and target > 0:
|
|
|
+ if not np.isnan(target) and target > 0:
|
|
|
setting_target = target
|
|
|
else:
|
|
|
setting_target = 25.0
|
|
@@ -31,8 +32,10 @@ class FCUController(EquipmentController):
|
|
|
temperature_target = await self.get_temperature_target()
|
|
|
if temperature_target and temperature_target > 0:
|
|
|
self._equipment.air_valve_speed = AirValveSpeed.auto
|
|
|
+ self._equipment.water_valve_status = True
|
|
|
else:
|
|
|
self._equipment.air_valve_speed = AirValveSpeed.off
|
|
|
+ self._equipment.water_valve_status = False
|
|
|
|
|
|
async def run(self):
|
|
|
await self.get_temperature_target()
|
|
@@ -47,13 +50,16 @@ class FCUController(EquipmentController):
|
|
|
async def get_fcu_control_result(project_id: str, equipment_id: str) -> FCU:
|
|
|
async with AsyncClient() as client:
|
|
|
duo_duo = EquipmentInfoService(client, project_id)
|
|
|
+ platform = DataPlatformService(client, project_id)
|
|
|
spaces = await duo_duo.get_space_by_equipment(equipment_id)
|
|
|
for sp in spaces:
|
|
|
transfer = SpaceInfoService(client, project_id, sp.get('id'))
|
|
|
current_target = await transfer.get_current_temperature_target()
|
|
|
+ realtime_temperature = await platform.get_realtime_temperature(sp.get('id'))
|
|
|
temp_space_params = {
|
|
|
'id': sp.get('id'),
|
|
|
- 'temperature_target': current_target
|
|
|
+ 'temperature_target': current_target,
|
|
|
+ 'realtime_temperature': realtime_temperature
|
|
|
}
|
|
|
space = Space(**temp_space_params)
|
|
|
break
|