[feat] update hfc concentration, use random when > 90, else normal
This commit is contained in:
parent
d59d0d03a6
commit
74f9ac43ab
@ -542,15 +542,13 @@ class ModbusGasAnalyzer:
|
|||||||
|
|
||||||
# 限制浓度范围
|
# 限制浓度范围
|
||||||
if self.concentration < 0:
|
if self.concentration < 0:
|
||||||
|
print(f"DEBUG - : {self.concentration} -> 0")
|
||||||
self.concentration = 0.0
|
self.concentration = 0.0
|
||||||
elif self.concentration > 99.990:
|
elif self.concentration > 90:
|
||||||
self.concentration = 99.990
|
|
||||||
elif self.concentration > 88:
|
|
||||||
print(f"DEBUG - : {self.concentration} -> 随机数")
|
print(f"DEBUG - : {self.concentration} -> 随机数")
|
||||||
self.concentration = round(random.uniform(99.960, 99.990), 3)
|
self.concentration = round(random.uniform(99.960, 99.990), 3)
|
||||||
elif self.concentration >= 50:
|
else:
|
||||||
print(f"DEBUG - : {self.concentration} -> +6")
|
print(f"DEBUG - : {self.concentration} normal")
|
||||||
self.concentration = self.concentration + 6
|
|
||||||
# 记录浓度用于变化检测
|
# 记录浓度用于变化检测
|
||||||
current_time = time.time()
|
current_time = time.time()
|
||||||
self.last_concentrations.append((current_time, self.concentration))
|
self.last_concentrations.append((current_time, self.concentration))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user