Browse Source

modify control logic of AHU

highing666 3 years ago
parent
commit
7d9aca4532
1 changed files with 20 additions and 3 deletions
  1. 20 3
      app/controllers/equipment/ahu/supply_air_temperature_set.py

+ 20 - 3
app/controllers/equipment/ahu/supply_air_temperature_set.py

@@ -94,10 +94,27 @@ class ACATAHSupplyAirTemperatureController:
 
         return cold_ratio
 
+    def get_normal_ratio(self):
+        normal = 0
+        for box in self.vav_boxes_list:
+            if abs(box.virtual_realtime_temperature - box.virtual_target_temperature) <= 1:
+                normal += 1
+
+        try:
+            ratio = normal / len(self.vav_boxes_list)
+        except ZeroDivisionError:
+            ratio = np.NAN
+
+        return ratio
+
     def build(self) -> float:
         if not self.is_off_to_on:
-            cold_ratio = self.get_cold_ratio()
-            temperature = self.calculate_by_cold_vav(cold_ratio)
+            normal_ratio = self.get_normal_ratio()
+            if normal_ratio < 0.9:
+                cold_ratio = self.get_cold_ratio()
+                temperature = self.calculate_by_cold_vav(cold_ratio)
+            else:
+                temperature = self.current
         else:
             if self.season == Season.heating:
                 temperature = 27.0
@@ -109,7 +126,7 @@ class ACATAHSupplyAirTemperatureController:
         if self.season == Season.heating:
             temperature = max(20.0, min(30.0, temperature))
         else:
-            temperature = max(18.0, min(30.0, temperature))
+            temperature = max(18.0, min(25.0, temperature))
 
         return temperature