|
@@ -48,6 +48,21 @@ class NewTargetBuilder(metaclass=ABCMeta):
|
|
|
raise NotImplementedError
|
|
|
|
|
|
|
|
|
+class Clipper:
|
|
|
+ """
|
|
|
+ Return a number which is in the range of [min, max].
|
|
|
+ """
|
|
|
+
|
|
|
+ def __init__(self, upper_limit: float = 28.0, lower_limit: float = 22.0):
|
|
|
+ self.upper_limit = upper_limit
|
|
|
+ self.lower_limit = lower_limit
|
|
|
+
|
|
|
+ def cut(self, num: float) -> float:
|
|
|
+ num = min(num, self.upper_limit)
|
|
|
+ num = max(num, self.lower_limit)
|
|
|
+ return num
|
|
|
+
|
|
|
+
|
|
|
class NewTemperatureTargetBuilder(NewTargetBuilder):
|
|
|
"""
|
|
|
Calculate a new temperature target value.
|
|
@@ -70,21 +85,6 @@ class NewTemperatureTargetBuilder(NewTargetBuilder):
|
|
|
return clipper.cut(new_actual_target)
|
|
|
|
|
|
|
|
|
-class Clipper:
|
|
|
- """
|
|
|
- Return a number which is in the range of [min, max].
|
|
|
- """
|
|
|
-
|
|
|
- def __init__(self, upper_limit: float = 28.0, lower_limit: float = 22.0):
|
|
|
- self.upper_limit = upper_limit
|
|
|
- self.lower_limit = lower_limit
|
|
|
-
|
|
|
- def cut(self, num: float) -> float:
|
|
|
- num = min(num, self.upper_limit)
|
|
|
- num = max(num, self.lower_limit)
|
|
|
- return num
|
|
|
-
|
|
|
-
|
|
|
class TemporaryTargetInit:
|
|
|
"""
|
|
|
Initialize temporary temperature target.
|