[feat] update hfc concentration, use random when > 90, else normal

This commit is contained in:
zhji 2025-12-17 22:13:43 +08:00
parent d59d0d03a6
commit 74f9ac43ab

View File

@ -542,15 +542,13 @@ class ModbusGasAnalyzer:
# 限制浓度范围
if self.concentration < 0:
print(f"DEBUG - : {self.concentration} -> 0")
self.concentration = 0.0
elif self.concentration > 99.990:
self.concentration = 99.990
elif self.concentration > 88:
elif self.concentration > 90:
print(f"DEBUG - : {self.concentration} -> 随机数")
self.concentration = round(random.uniform(99.960, 99.990), 3)
elif self.concentration >= 50:
print(f"DEBUG - : {self.concentration} -> +6")
self.concentration = self.concentration + 6
else:
print(f"DEBUG - : {self.concentration} normal")
# 记录浓度用于变化检测
current_time = time.time()
self.last_concentrations.append((current_time, self.concentration))