From 74f9ac43ab01a424d8931a241e9246429e967749 Mon Sep 17 00:00:00 2001 From: zhji Date: Wed, 17 Dec 2025 22:13:43 +0800 Subject: [PATCH] [feat] update hfc concentration, use random when > 90, else normal --- python/hfc/hfc.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/python/hfc/hfc.py b/python/hfc/hfc.py index a97fe96..7727300 100644 --- a/python/hfc/hfc.py +++ b/python/hfc/hfc.py @@ -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))