ソースを参照

modify some annotation of date.py and add some new files

chenhaiyang 4 年 前
コミット
cefbb4c0d1

app/controllers/targets/targets_v1.py → app/controllers/targets/target.py


+ 27 - 0
app/controllers/targets/temperature.py

@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+
+from typing import Dict, Optional
+
+import numpy as np
+import pandas as pd
+
+from app.services.transfer import Season
+from app.schemas.feedback import Feedback
+
+
+class StepSizeCalculator:
+    """
+    Calculate adjustment step size of environment target when a user send feedback.
+    """
+    def __init__(self, weight: Dict):
+        self.weight = weight
+
+    def calculate_step_size(
+            self,
+            space_realtime_temperature: float,
+            space_comfortable_temperature: float,
+            feedback: Feedback
+    ):
+        base_step_size = 1.8 / (1 + np.exp((space_comfortable_temperature - space_realtime_temperature) / 2))
+        return 
+

+ 0 - 7
app/controllers/targets/temperature_v2.py

@@ -1,7 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from app.controllers.controller import Controller
-
-
-class TemperatureTargetControllerV2(Controller):
-

+ 0 - 0
app/schemas/feedback.py


+ 0 - 0
app/schemas/project.py


+ 0 - 0
app/schemas/target.py


+ 2 - 2
app/utils/date.py

@@ -7,10 +7,10 @@ TIME_FMT = 'YYYYMMDDHHmmss'
 
 def get_time_str(delta: int = 0, flag: str = 'now') -> str:
     """
-    Return two beijing time strings.
+    Return a Beijing time strings.
     :param delta: time delta(seconds)
     :param flag:
-    :return: two '%Y%m%d%H%M%S' format strings
+    :return: a '%Y%m%d%H%M%S' format strings
     """
     utc = arrow.utcnow()
     local = utc.to('Asia/Shanghai')