浏览代码

add HCHO logic for ATFU

highing666 2 年之前
父节点
当前提交
eef2581e77
共有 4 个文件被更改,包括 21 次插入2 次删除
  1. 18 1
      app/controllers/equipment/pau/freq_set.py
  2. 1 0
      app/models/domain/devices.py
  3. 1 0
      app/schemas/space.py
  4. 1 1
      docker-compose.yml

+ 18 - 1
app/controllers/equipment/pau/freq_set.py

@@ -33,6 +33,8 @@ class ACATFUFanFreqController:
             else:
                 next_freq_set = self.get_cooling_logic(spaces_params, on_flag)
 
+            next_freq_set = self.hcho_logic(spaces_params, next_freq_set)
+
             next_freq_set = max(20.0, next_freq_set)
             next_freq_set = min(50.0, next_freq_set)
         except TypeError:
@@ -133,8 +135,9 @@ class ACATFUFanFreqController:
 
     def get_heating_logic(self, spaces_params: List[SpaceATFU], on_flag: bool) -> float:
         # The same with cooling logic.
+        freq_set = self.get_cooling_logic(spaces_params, on_flag)
 
-        return self._freq
+        return freq_set
 
     @staticmethod
     def get_avg(spaces_params: List[SpaceATFU]) -> Tuple[float, float]:
@@ -173,6 +176,20 @@ class ACATFUFanFreqController:
 
         return ratio
 
+    @staticmethod
+    def hcho_logic(spaces_params: List[SpaceATFU], next_freq_set: float) -> float:
+        diff = 0.0
+        for space in spaces_params:
+            if space.hcho >= 0.1:
+                diff = 5
+                break
+            elif space.hcho >= 0.08:
+                diff = 3
+            else:
+                diff = 0
+
+        return next_freq_set + diff
+
 
 async def build_acatfu_freq_set(params: ACATFUFreqSetRequest) -> float:
     controller = ACATFUFanFreqController(params.freq, params.fresh_air_temperature, params.season)

+ 1 - 0
app/models/domain/devices.py

@@ -125,6 +125,7 @@ class ACATAHSpace(Space):
 
 class ACATFUSpace(Space):
     realtime_co2: Optional[float]
+    hcho: Optional[float]
 
 
 class ACATVAInstructionsRequestBase(BaseModel):

+ 1 - 0
app/schemas/space.py

@@ -32,3 +32,4 @@ class SpaceATAH(Space):
 
 class SpaceATFU(SpaceBase):
     realtime_co2: Optional[float]
+    hcho: Optional[float]

+ 1 - 1
docker-compose.yml

@@ -2,7 +2,7 @@ version: "3"
 
 services:
   app:
-      image: registry.persagy.com/sagacloud/saga_algo_api:0.5.1
+      image: registry.persagy.com/sagacloud/saga_algo_api:0.5.2
       container_name: saga_algo_api
       ports:
         - "8002:8002"