Browse Source

optimize not-heating logic of ATAH

highing666 4 years ago
parent
commit
6ffe3e2747

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

@@ -8,6 +8,7 @@ from app.controllers.equipment.ahu.thermal_mode import count_vav_box_weight, fet
 from app.models.domain.devices import ThermalMode
 from app.schemas.equipment import VAVBox
 from app.services.platform import DataPlatformService, InfoCode
+from app.services.transfer import Duoduo, Season
 from app.services.weather import WeatherService
 from app.utils.date import get_time_str, TIME_FMT
 
@@ -24,7 +25,8 @@ class ACATAHSupplyAirTemperatureController:
             return_air: float,
             thermal_mode: ThermalMode,
             is_off_to_on: bool,
-            is_thermal_mode_switched: bool
+            is_thermal_mode_switched: bool,
+            season: Season
     ):
         super(ACATAHSupplyAirTemperatureController, self).__init__()
         self.vav_boxes_list = vav_boxes_list
@@ -33,6 +35,7 @@ class ACATAHSupplyAirTemperatureController:
         self.thermal_mode = thermal_mode
         self.is_off_to_on = is_off_to_on
         self.is_thermal_mode_switched = is_thermal_mode_switched
+        self.season = season
 
     def calculate_by_cold_vav(self, cold_ratio: float) -> float:
         if self.thermal_mode == ThermalMode.cooling:
@@ -80,9 +83,17 @@ class ACATAHSupplyAirTemperatureController:
             cold_ratio = self.get_cold_ratio()
             temperature = self.calculate_by_cold_vav(cold_ratio)
         else:
-            temperature = 25.0
+            if self.season == Season.heating:
+                temperature = 27.0
+            elif self.season == Season.cooling:
+                temperature = 20.0
+            else:
+                temperature = 25.0
 
-        temperature = max(20.0, min(30.0, temperature))
+        if self.season == Season.heating:
+            temperature = max(20.0, min(30.0, temperature))
+        else:
+            temperature = max(16.0, min(30.0, temperature))
 
         return temperature
 

+ 3 - 3
app/controllers/equipment/vav.py

@@ -90,11 +90,10 @@ class VAVControllerV2(VAVController):
 
     def __init__(self, equipment: VAVBox, weights: List[SpaceWeight], season: Season):
         super(VAVControllerV2, self).__init__(equipment)
-        # self.equipment = equipment
         self.weights = weights
         self.season = season
 
-    async def build_virtual_temperature(self):
+    async def build_virtual_temperature(self) -> None:
         valid_spaces = []
         weights = []
         for sp in self.equipment.spaces:
@@ -107,6 +106,7 @@ class VAVControllerV2(VAVController):
         if valid_spaces:
             weights = sorted(weights, key=lambda x: x.temporary_weight_update_time)
             if weights[-1].temporary_weight_update_time > get_time_str(60 * 60 * 2, flag='ago'):
+                #  If someone has submitted a feedback in past two hours, meet the need.
                 weight_dic = {weight.space_id: 0.0 for weight in weights}
                 weight_dic.update({weights[-1].space_id: weights[-1].temporary_weight})
             else:
@@ -149,7 +149,7 @@ class VAVControllerV2(VAVController):
 
         return self.equipment.virtual_target_temperature, self.equipment.virtual_realtime_temperature
 
-    async def run(self):
+    async def run(self) -> None:
         await self.build_virtual_temperature()
         temperature_set, temperature_realtime = await self.rectify()
         await self.get_supply_air_flow_set(temperature_set, temperature_realtime)