This commit is contained in:
neo-dl 2023-05-18 16:12:40 +02:00
parent 3e246014cc
commit a307bf76ea
6 changed files with 35 additions and 21 deletions

View File

@ -205,14 +205,15 @@ class TecnaMarpossProvasetT3(ModbusComponent):
# READ INFO # READ INFO
info = {r: self.read(r) for r in [ info = {r: self.read(r) for r in [
"Real time test pressure output", "Real time test pressure output",
"Real time differential pressure output", #"Real time differential pressure output",
"Real time pressure line regulator", "Real time pressure line regulator",
"Active alarm flags", "Active alarm flags",
"Active test program number", #"Active test program number",
"Running test: active phase", "Running test: active phase",
"Running test: test type", "Running test: test type",
"Running test: sequence index", "Running test: measured leak"
"Digital inputs status (mask)", #"Running test: sequence index",
#"Digital inputs status (mask)",
# "Digital outputs status (mask)", # "Digital outputs status (mask)",
]} ]}
if self.model == "t3p": if self.model == "t3p":
@ -222,9 +223,11 @@ class TecnaMarpossProvasetT3(ModbusComponent):
"Active not severe alarm flags", "Active not severe alarm flags",
]}) ]})
else: else:
raise NotImplementedError(f"techna t3 model {self.model!r} not implemented.") raise NotImplementedError(f"Tecna t3 model {self.model!r} not implemented.")
if info["Running test: active phase"] == "FINE TEST": # "END TEST, WAITING THE START OF A NEW TEST": if info["Running test: active phase"] == "FINE TEST": # "END TEST, WAITING THE START OF A NEW TEST":
info.update(self.get_test_results()) info.update(self.get_test_results())
for round_me in ["measured leak"]:
info.update({round_me:float(f"{info[round_me]:.2f}")})
self.log.debug(str(info)) self.log.debug(str(info))
super()._get([info]) super()._get([info])
@ -251,13 +254,13 @@ class TecnaMarpossProvasetT3(ModbusComponent):
def get_test_results(self): def get_test_results(self):
self.log.info("getting test results") self.log.info("getting test results")
return {r: self.read(r) for r in [ return {r: self.read(r) for r in [
"Running test: phase backwards time", #"Running test: phase backwards time",
"Running test: filling pressure", "Running test: filling pressure",
"Running test: pressure at the end of settling", "Running test: pressure at the end of settling",
"Running test: burst pressure", #"Running test: burst pressure",
"Running test: measured leak", "Running test: measured leak",
"Running test: calculated leak flow rate", #"Running test: calculated leak flow rate",
"Running test: calculate RVP%", #"Running test: calculate RVP%",
"Running test: result", "Running test: result",
]} ]}

View File

@ -80,7 +80,7 @@ registers = {
"Running test: calculated leak flow rate": [42 - 1, {"dt": "32bit_int", "f": 1507, }], "Running test: calculated leak flow rate": [42 - 1, {"dt": "32bit_int", "f": 1507, }],
"Running test: calculate RVP%": [44 - 1, {"dt": "32bit_int", }], "Running test: calculate RVP%": [44 - 1, {"dt": "32bit_int", }],
"Running test: result": [46 - 1, {"dt": "16bit_uint", "decoding": { "Running test: result": [46 - 1, {"dt": "16bit_uint", "decoding": {
1: "LEAK TEST PASSED (also used in Volume+Leak tests)", 1: "LEAK TEST PASSED",
2: "BURST TEST PASSED WITH BURST", 2: "BURST TEST PASSED WITH BURST",
3: "BURST TEST PASSED WITHOUT BURST", 3: "BURST TEST PASSED WITHOUT BURST",
4: "APERTURE TEST PASSED", 4: "APERTURE TEST PASSED",

View File

@ -59,7 +59,7 @@ registers = {
"Running test: calculated leak flow rate": [42 - 1, {"dt": "32bit_int", "f": 24, }], "Running test: calculated leak flow rate": [42 - 1, {"dt": "32bit_int", "f": 24, }],
"Running test: calculate RVP%": [44 - 1, {"dt": "32bit_int", }], "Running test: calculate RVP%": [44 - 1, {"dt": "32bit_int", }],
"Running test: result": [46 - 1, {"dt": "16bit_uint", "decoding": { "Running test: result": [46 - 1, {"dt": "16bit_uint", "decoding": {
1: "LEAK TEST PASSED (also used in Volume+Leak tests)", 1: "LEAK TEST PASSED",
2: "BURST TEST PASSED WITH BURST", 2: "BURST TEST PASSED WITH BURST",
3: "BURST TEST PASSED WITHOUT BURST", 3: "BURST TEST PASSED WITHOUT BURST",
4: "APERTURE TEST PASSED", 4: "APERTURE TEST PASSED",

View File

@ -455,7 +455,14 @@ class Test(Widget):
self.data[step_name] = {} self.data[step_name] = {}
if data is not None: if data is not None:
data["step"] = model_to_dict(self.step) data["step"] = model_to_dict(self.step)
self.data[step_name][str(len(self.data[step_name]))] = data data["step"].pop("name",None)
# MAKE ARRAY ONLY IF MORE THAN ONE TEST OF SAME TYPE
if len(self.data[step_name])>1:
self.data[step_name][str(len(self.data[step_name]))] = data
else:
self.data[step_name] = data
self.data["overridden"] = self.data["overridden"] or data.get("overridden", False) self.data["overridden"] = self.data["overridden"] or data.get("overridden", False)
self.data["ok"] = self.data["ok"] and data.get("ok", False) self.data["ok"] = self.data["ok"] and data.get("ok", False)
self.next() self.next()

View File

@ -132,16 +132,20 @@ class Test_Leak(Test_Test):
ret = self.components["digital_io"].set_bit_verify(0, 1, 0) ret = self.components["digital_io"].set_bit_verify(0, 1, 0)
else: else:
result = None #result = None
ok = None ok = None
super().get([{
results={"ok":ok}
results.update(data)
super().get({
"time": data.get("time", None), "time": data.get("time", None),
"results": { "results": results
"ok": ok, #"results": {
"result": result, #"ok": ok,
"data": data["tecna_t3"], #"result": result,
}, #"data": data["tecna_t3"],
}], override=override, fail=ok is False) #},
}, override=override, fail=ok is False)
def visualize(self, data=None): def visualize(self, data=None):
if data is None: if data is None:

View File

@ -144,7 +144,7 @@ class Test_Test(Widget):
self.last = { self.last = {
**data, **data,
"overridden": override, "overridden": override,
"duration": f"{duration:.2f}", "duration": float(f"{duration:.2f}"),
"ok": result_ok, "ok": result_ok,
} }
if fail: if fail: