From b44005ed054353cb44356db6dfa38e1ba7e425ca Mon Sep 17 00:00:00 2001 From: matteo porta Date: Wed, 14 Sep 2022 14:47:09 +0200 Subject: [PATCH] wip --- config/machine_settings/defaults.ini | 1 + config/machine_settings/this.ini | 1 + src/components/__init__.py | 2 +- src/components/component.py | 4 +- ...et_t3p.py => tecna_marposs_provaset_t3.py} | 112 ++++-- .../tecna_marposs_provaset_t3l_registers.py | 332 ++++++++++++++++++ .../tecna_marposs_provaset_t3p_registers.py | 13 +- src/main.py | 4 +- src/ui/test_leak/test_leak.py | 2 +- 9 files changed, 434 insertions(+), 37 deletions(-) rename src/components/{tecna_marposs_provaset_t3p.py => tecna_marposs_provaset_t3.py} (57%) create mode 100644 src/components/tecna_marposs_provaset_t3l_registers.py diff --git a/config/machine_settings/defaults.ini b/config/machine_settings/defaults.ini index 0f18529..ab9fa62 100644 --- a/config/machine_settings/defaults.ini +++ b/config/machine_settings/defaults.ini @@ -44,6 +44,7 @@ printer: ttp247 [tecna_t3] +model: t3p ; port: ? baudrate: 115200 admin_pin: 603 diff --git a/config/machine_settings/this.ini b/config/machine_settings/this.ini index f104ee6..18579c6 100644 --- a/config/machine_settings/this.ini +++ b/config/machine_settings/this.ini @@ -10,6 +10,7 @@ vision_saver: present vision: present [tecna_t3] +model: t3l port: /dev/ttyUSB0 [multicomp] diff --git a/src/components/__init__.py b/src/components/__init__.py index 7001f5a..9714360 100644 --- a/src/components/__init__.py +++ b/src/components/__init__.py @@ -7,7 +7,7 @@ from .neo_pixels import NeoPixels from .os_label_printer import Os_Label_Printer from .remote_api import RemoteAPI from .serial_label_printer import Serial_Label_Printer -from .tecna_marposs_provaset_t3p import TecnaMarpossProvasetT3P +from .tecna_marposs_provaset_t3 import TecnaMarpossProvasetT3 from .test_component import TestComponent from .vision import Vision from .vision_saver import VisionSaver diff --git a/src/components/component.py b/src/components/component.py index 6b96cbe..71f716b 100644 --- a/src/components/component.py +++ b/src/components/component.py @@ -31,10 +31,10 @@ class Component(QObject): # self.log.exception(f"self: {self}, reconfigurators: {Component.reconfigurators}, reconfiguration loop") Component.reconfigurators_lock.unlock() try: - ret = f(*arg, **kwargs) + return f(*arg, **kwargs) except Exception: self.log.exception(traceback.format_exc()) - return ret + return None Component.reconfigurators.add(self) Component.reconfigurators_lock.unlock() t_limit = 3 diff --git a/src/components/tecna_marposs_provaset_t3p.py b/src/components/tecna_marposs_provaset_t3.py similarity index 57% rename from src/components/tecna_marposs_provaset_t3p.py rename to src/components/tecna_marposs_provaset_t3.py index aec9237..47bd629 100644 --- a/src/components/tecna_marposs_provaset_t3p.py +++ b/src/components/tecna_marposs_provaset_t3.py @@ -1,6 +1,7 @@ from .component import Component from .modbus_component import ModbusComponent -from .tecna_marposs_provaset_t3p_registers import registers +from .tecna_marposs_provaset_t3l_registers import registers as t3l_registers +from .tecna_marposs_provaset_t3p_registers import registers as t3p_registers # from pymodbus.client.sync import ModbusSerialClient as ModbusClient # import serial @@ -9,9 +10,9 @@ from .tecna_marposs_provaset_t3p_registers import registers # client.read_holding_registers(1, count=1) -class TecnaMarpossProvasetT3P(ModbusComponent): +class TecnaMarpossProvasetT3(ModbusComponent): def __init__(self, config=None, name=None, period=1, lazy=True, paused=False, threaded=True): - super().__init__(config=config, name=name, period=period, lazy=lazy, paused=paused, threaded=threaded, registers=registers) + super().__init__(config=config, name=name, period=period, lazy=lazy, paused=paused, threaded=threaded, registers=None) # pin_registers = { # "admin_pin": "PASSWORD: Administration", # was 1909 @@ -27,6 +28,13 @@ class TecnaMarpossProvasetT3P(ModbusComponent): # "select_pin": self.config.get("select_pin", None), # } # self.unlock_tecna() + self.model = self.config[self.name]["model"].lower() + if self.model == "t3p": + self.registers = t3p_registers + elif self.model == "t3l": + self.registers = t3l_registers + else: + raise NotImplementedError(f"techna t3 model {self.model!r} not implemented.") self.set_measure_units() self.units = self.get_measure_units() self.log.info(f"units: {self.units}") @@ -44,7 +52,7 @@ class TecnaMarpossProvasetT3P(ModbusComponent): _leak_flow_units = {"cm3/min": 0, "cm3/h": 1, } _volume_units = {"litri": 0, "cm3": 1, } _time_units = {"seconds": 0, } - _flow_units = {"liters/min": 0, "liters/h": 1, "m3/h": 2, } + _flow_units = {"liters/min": 0, "liters/h": 1, "m3/h": 2, "cfm": 3} _pressure_units_map = {v: k for k, v in _pressure_units.items()} _leak_units_map = {v: k for k, v in _leak_units.items()} _leak_flow_units_map = {v: k for k, v in _leak_flow_units.items()} @@ -53,30 +61,64 @@ class TecnaMarpossProvasetT3P(ModbusComponent): _flow_units_map = {v: k for k, v in _flow_units.items()} def set_measure_units(self): - for register, [unit, decimals] in { - "MEASURE UNITS: Relative pressure": [self._pressure_units["mbar"], 0], # red, purple - "MEASURE UNITS: Differential (leak) pressure": [self._leak_units["mbar"], 0], # yellow - "MEASURE UNITS: Calculated leak flow rate": [self._leak_flow_units["cm3/min"], 0], # blue - "MEASURE UNITS: Volume": [self._volume_units["litri"], 0], # green - "MEASURE UNITS: Flow rate": [self._flow_units["liters/min"], 0], # orange - }.items(): - self.write(register, (decimals << 8) + unit) + if self.model == "t3p": + for register, [unit, decimals] in { + "MEASURE UNITS: Relative pressure": [self._pressure_units["mbar"], 0], # red, purple + "MEASURE UNITS: Differential (leak) pressure": [self._leak_units["mbar"], 0], # yellow + "MEASURE UNITS: Calculated leak flow rate": [self._leak_flow_units["cm3/min"], 0], # blue + "MEASURE UNITS: Volume": [self._volume_units["litri"], 0], # green + "MEASURE UNITS: Flow rate": [self._flow_units["liters/min"], 0], # orange + }.items(): + self.write(register, (decimals << 8) + unit) + elif self.model == "t3l": + for register, [unit, decimals] in { + "MEASURE UNITS: Relative pressure": [self._pressure_units["mbar"], 0], # red, purple + "MEASURE UNITS: Differential (leak) pressure": [self._leak_units["mbar"], 0], # yellow + "MEASURE UNITS: Calculated leak flow rate": [self._leak_flow_units["cm3/min"], 0], # blue + "MEASURE UNITS: Volume": [self._volume_units["litri"], 0], # green + "MEASURE UNITS: Flow rate": [self._flow_units["liters/min"], 0], # orange + }.items(): + self.write(register, unit) # (decimals << 8) + unit) + else: + raise NotImplementedError(f"techna t3 model {self.model!r} not implemented.") def get_measure_units(self): units = {} - for [register, unit_map, unit_names] in [ - ["Running test: relative pressure format", self._pressure_units_map, ["relative_pressure", "red", "r", 21, ]], # also by documentation color and register number - ["Running test: differential pressure format", self._pressure_units_map, ["differential_pressure", "purple", "p", 22, ]], # also by documentation color and register number - ["Running test: relative pressure format (low resolution)", self._leak_units_map, ["relative_pressure_lr", "yellow", "y", 23, ]], # also by documentation color and register number - ["Running test: calculated leak flow rate format", self._leak_flow_units_map, ["leak_flow", "blue", "b", 24, ]], # also by documentation color and register number - ["Running test: volume format", self._volume_units_map, ["volume", "green", "g", 25, ]], # also by documentation color and register number - ["Running test: time format", self._time_units_map, ["time", "orange", "t", 26, ]], # also by documentation color and register number - ["Running test: flow rate format", self._flow_units_map, ["flow", "white", "o", 27, ]], # also by documentation color and register number - ]: - v = self.read(register) - unit_spec = [10**(-((v >> 8) & 0xff)), unit_map[v & 0xff]] - for unit_name in unit_names: - units[unit_name] = unit_spec + if self.model == "t3p": + for [register, unit_map, unit_names] in [ + ["Running test: relative pressure format", self._pressure_units_map, ["relative_pressure", "red", "r", 21, ]], # also by documentation color and register number + ["Running test: differential pressure format", self._pressure_units_map, ["differential_pressure", "purple", "p", 22, ]], # also by documentation color and register number + ["Running test: relative pressure format (low resolution)", self._leak_units_map, ["relative_pressure_lr", "yellow", "y", 23, ]], # also by documentation color and register number + ["Running test: calculated leak flow rate format", self._leak_flow_units_map, ["leak_flow", "blue", "b", 24, ]], # also by documentation color and register number + ["Running test: volume format", self._volume_units_map, ["volume", "green", "g", 25, ]], # also by documentation color and register number + ["Running test: time format", self._time_units_map, ["time", "orange", "t", 26, ]], # also by documentation color and register number + ["Running test: flow rate format", self._flow_units_map, ["flow", "white", "o", 27, ]], # also by documentation color and register number + ]: + v = self.read(register) + unit_spec = [10**(-((v >> 8) & 0xff)), unit_map[v & 0xff]] + for unit_name in unit_names: + units[unit_name] = unit_spec + elif self.model == "t3l": + for [register, unit_map, unit_names] in [ + [["Running test: relative pressure scale", "Running test: relative pressure decimals"], self._pressure_units_map, ["relative_pressure", "red", "r", 1501, ]], # also by documentation color and register number + [["Running test: differential pressure scale", "Running test: differential pressure decimals"], self._pressure_units_map, ["differential_pressure", "purple", "p", 1503, ]], # also by documentation color and register number + [["Running test: relative pressure scale (low resolution)", "Running test: relative pressure decimals (low resolution)"], self._leak_units_map, ["relative_pressure_lr", "yellow", "y", 1505, ]], # also by documentation color and register number + ["Running test: calculated leak flow rate format", self._leak_flow_units_map, ["leak_flow", "blue", "b", 1507, ]], # also by documentation color and register number + ["Running test: volume format", self._volume_units_map, ["volume", "green", "g", 1508, ]], # also by documentation color and register number + ["Running test: time format", self._time_units_map, ["time", "orange", "t", 1509, ]], # also by documentation color and register number + ["Running test: flow rate format", self._flow_units_map, ["flow", "white", "o", 1510, ]], # also by documentation color and register number + ["Running test: line pressure format", self._pressure_units_map, ["line_pressure", "lp", "l", 1511, ]], # also by documentation color and register number + ]: + if type(register) is list: + v = [self.read(r) for r in register] + unit_spec = [10**(-(v[1] & 0xff)), v[0]] + else: + v = self.read(register) + unit_spec = [10**(-((v >> 8) & 0xff)), unit_map[v & 0xff]] + for unit_name in unit_names: + units[unit_name] = unit_spec + else: + raise NotImplementedError(f"techna t3 model {self.model!r} not implemented.") return units def _convert_from_format(self, data, formatting=None, decoding_map=None): @@ -184,6 +226,14 @@ class TecnaMarpossProvasetT3P(ModbusComponent): "Running test: test type", "Running test: sequence index", ]} + if self.model == "t3p": + pass + elif self.model == "t3l": + info.update({r: self.read(r) for r in [ + "Active not severe alarm flags", + ]}) + else: + raise NotImplementedError(f"techna t3 model {self.model!r} not implemented.") if info["Running test: active phase"] == "FINE TEST": # "END TEST, WAITING THE START OF A NEW TEST": info.update(self.get_test_results()) self.log.debug(str(info)) @@ -220,7 +270,7 @@ class TecnaMarpossProvasetT3P(ModbusComponent): "Test program for read/write operation": table, **{719 - 1 + i: (recipe_name[i * 2 + 1] << 8) + recipe_name[i * 2] for i in range(8)}, "Test type": "Leak Test", - "Test flags": 0b0110000001011100, + "Test flags": 0b0110000001011111, "T0 - Pre-filling time": step.spec["pre_filling_time"], "P0 - Pre-filling pressure": step.spec["pre_filling_pressure"], "T1 - Filling time": step.spec["filling_time"], @@ -234,6 +284,16 @@ class TecnaMarpossProvasetT3P(ModbusComponent): "FST - Discharge time": step.spec["flush_time"], "FSL - Discharge limit": step.spec["flush_pressure"], } + if self.model == "t3p": + pass + elif self.model == "t3l": + spec.update({ + "Use programs or use products": 0, + "Nominal peak pressure": step.spec["test_pressure"], + "Pn - Nominal test pressure": step.spec["test_pressure"], + }) + else: + raise NotImplementedError(f"techna t3 model {self.model!r} not implemented.") self.log.debug(str(spec)) for register, value in spec.items(): self.write(register, value) diff --git a/src/components/tecna_marposs_provaset_t3l_registers.py b/src/components/tecna_marposs_provaset_t3l_registers.py new file mode 100644 index 0000000..85b9b98 --- /dev/null +++ b/src/components/tecna_marposs_provaset_t3l_registers.py @@ -0,0 +1,332 @@ +# WARNING: ALL REGISTER IN THE DOCUMENTATION ARE SHIFTED BY ONE (NUMERATION STARTS BY ONE) +registers = { + "Instrument type": [1 - 1, {"dt": "16bit_uint", }], + "Test counter: FAILED": [2 - 1, {"dt": "32bit_uint", }], + "Test counter: TOTAL TESTS": [4 - 1, {"dt": "32bit_uint", }], + "Life counter: FAILED": [6 - 1, {"dt": "32bit_uint", }], + "Life counter: TOTAL TESTS": [8 - 1, {"dt": "32bit_uint", }], + "Real time test pressure output": [11 - 1, {"dt": "32bit_int", "f": 1501, }], + "Real time differential pressure output": [13 - 1, {"dt": "32bit_int", "f": 1503, }], + "Real time pressure line regulator": [15 - 1, {"dt": "16bit_int", "f": 1511}], + "Active alarm flags": [16 - 1, {"dt": "16bit_uint", }], + # | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | + # | | | | | | | EA | E9 | E8 | | E6 | E5 | E4 | E3 | E2 | E1 | + # E1: Test program error + # E2: Setting parameters memory error + # E3: Sensor calibration memory error + # E4: Emergency + # E5: I2c bus + # E6: Flow sensor + # E8: A/D_FS points + # E9: Sensor comm. Ch1 + # EA: Sensor comm. Ch2 + "Active not severe alarm flags": [21 - 1, {"dt": "16bit_uint", }], + # | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | + # | | | | | | | | | A8 | A7 | A6 | A5 | A4 | A3 | A2 | A1 | + # A1: Discharge alarm (ch 1 for 2 channel model) + # A2: Discharge alarm (ch 2 for 2 channel model) + # A3: Acknowledgment + # A4: Cage closing automation alarm + # A5: Cage opening automation alarm + # A6: Plug closing automation alarm + # A7: Plug opening automation alarm + # A8: I2C no stop + "Running test: relative pressure scale": [1501 - 1, {"dt": "16bit_uint", }], # red + "Running test: relative pressure decimals": [1502 - 1, {"dt": "16bit_uint", }], # red + "Running test: differential pressure scale": [1503 - 1, {"dt": "16bit_uint", }], # purple + "Running test: differential pressure decimals": [1504 - 1, {"dt": "16bit_uint", }], # purple + "Running test: relative pressure scale (low resolution)": [1505 - 1, {"dt": "16bit_uint", }], # yellow + "Running test: relative pressure decimals (low resolution)": [1506 - 1, {"dt": "16bit_uint", }], # yellow + "Running test: calculated leak flow rate format": [1507 - 1, {"dt": "16bit_uint", }], # blue + "Running test: volume format": [1508 - 1, {"dt": "16bit_uint", }], # green + "Running test: time format": [1509 - 1, {"dt": "16bit_uint", }], # orange + "Running test: flow rate format": [1510 - 1, {"dt": "16bit_uint", }], # white + "Running test: line pressure format": [1511 - 1, {"dt": "16bit_uint", }], # lp + # 1531-1540 last test values formats ----- add if needed + "Active test program number": [31 - 1, {"dt": "16bit_uint", }], + "Running test: active phase": [32 - 1, {"dt": "16bit_uint", "decoding": { + 0: "ATTESA START", # "WAITING START", + 10: "CONTROLLO BARCODE", # "CHECK BARCODE", + 20: "ATTESA BARCODE", # "WAITING BARCODE", + 30: "START TEST", + 35: "MOVE TABLE START", + 40: "START CAGE", + 50: "START PLUG", + 60: "START SEQUENCE PROGRAM", + 70: "WAIT DELAY ACKNOWLEDGE COMMAND", + 80: "WAIT DELAY", + 90: "WAIT ACKNOWLEDGE", + 100: "T0 PRE-RIEMPIMENTO", # "T0 PRE-FILL", + 110: "T1 RIEMPIMENTO", # "T1 FILLING", + 120: "T2 ASSESTAMENTO", # "T2 SETTLING", + 130: "T3 MISURA", # "T3 MEASURE", + 140: "WAITING OPERATOR RESULT ACKNOWLEDGE", + 150: "RESULT PRESENT", + 160: "MARKING", + 170: "DISCHARGE", + 180: "END SEQUENCE PROGRAM", + 181: "SEQUENCE DELAY", + 182: "PREPARE SEQUENCE PROGRAM", + 190: "END PLUG", + 200: "END CAGE", + 205: "MOVE TABLE END", + 210: "FINE TEST", # "END TEST, WAITING THE START OF A NEW TEST", + }, }], + "Running test: phase backwards time": [33 - 1, {"dt": "16bit_uint", "f": 1509, }], + "Running test: filling pressure": [34 - 1, {"dt": "32bit_int", "f": 1501, }], + "Running test: pressure at the end of settling": [36 - 1, {"dt": "32bit_int", "f": 1501, }], + "Running test: burst pressure": [38 - 1, {"dt": "32bit_int", "f": 1501, }], + "Running test: measured leak": [40 - 1, {"dt": "32bit_int", "f": 1503, }], + "Running test: calculated leak flow rate": [42 - 1, {"dt": "32bit_int", "f": 1507, }], + "Running test: calculate RVP%": [44 - 1, {"dt": "32bit_int", }], + "Running test: result": [46 - 1, {"dt": "16bit_uint", "decoding": { + 1: "LEAK TEST PASSED (also used in Volume+Leak tests)", + 2: "BURST TEST PASSED WITH BURST", + 3: "BURST TEST PASSED WITHOUT BURST", + 4: "APERTURE TEST PASSED", + 5: "BLOCKAGE TEST PASSED", + 6: "FLOW TEST PASSED", + 7: "LEAK with FLOW TEST PASSED", + 99: "PRODUCT PASSED", + # 100: "LEAK TEST FAILED (T3D: Maximum leak in test port, T3P: Upper limit error with negative Q+ parameter)", + 100: "LEAK TEST FAILED (Upper limit error with negative Q+ parameter)", + # 101: "LEAK TEST FAILED (only in T3P: Upper limit with positive Q+ parameter)", + 101: "LEAK TEST FAILED (Upper limit with positive Q+ parameter)", + # 102: "LEAK TEST FAILED (T3D: Maximum leak in reference port, T3P: Maximum leak)", + 102: "LEAK TEST FAILED (Maximum leak)", + 103: "BURST TEST FAILED (Burst pressure under the minimum)", + 104: "VOLUME TEST FAILED (Maximum RVP tolerance)", + 105: "APERTURE TEST FAILED - MINIMUM (not used)", + 106: "APERTURE TEST FAILED - MAXIMUM (not used)", + 107: "BLOCKAGE TEST FAILED (Maximum pressure)", + 108: "BLOCKAGE TEST FAILED (Minimum pressure)", + 109: "BURST TEST FAILED (Minimum test pressure not reach)", + 110: "FLOW TEST - PRESSURE FAIL - (Pressure out of programmed tolerance)", + 111: "FLOW TEST - FLOW FAIL - (Flow out of programmed tolerance)", + 112: "FAILED - LEAKAGE MAX", + 113: "FAILED - LEAKAGE MIN", + 115: "FAILED MIN CH1", + 116: "FAILED ANOMALY CH2", + 117: "FAILED MIN CH2", + 118: "FAILED BOTH CHANNELS", + 119: "FAILED FLOW MAX", + 120: "FAILED FLOW MIN", + 121: "FAILED PEAK MAX", + 122: "FAILED PEAK MIN", + 123: "(FAILED, SERVICE ONLY)", + 199: "FAILED PRODUCT", + 200: "FAIL T1/T2 PRESSURE UNDER TOLERANCE", + 201: "FAIL T1/T2 PRESSURE OVER TOLERANCE", + 202: "FAIL BLOCKAGE START PRESSURE UNDER TOLERANCE", + 203: "FAIL BLOCKAGE START PRESSURE OVER TOLERANCE", + 204: "FAIL WITH ALARM", + 205: "FAIL RELATIVE PRESSURE OVER SCALE", + 206: "FAIL DIFFERENTIAL PRESSURE OVER SCALE", + 207: "FAIL PRE-FILL VALVE NOT OPENED", + 208: "FAIL INVALID PROGRAM PARAMETERS", + 209: "FAIL CONFIGURATION PARAMETERS", + 210: "FAIL ALL CALIBRATION", + 211: "FAIL I2C COMMUNICATION", + 212: "FAIL EMERGENCY", + 213: "FAIL BYPASS VALVE NOT OPEN", + 214: "FAIL FLOW OUT OF RANGE", + 215: "FAIL FLOW SENSOR ALARM", + 216: "FAIL AD SPI ALARM", + 217: "FAIL (SERVICE ONLY)", + 250: "TEST ABORTED", + }, }], + "Running test: test type": [47 - 1, {"dt": "16bit_uint", "decoding": { + 1: "LEAK", + 2: "BLOCKAGE", + 3: "LEAK + VOLUME CHECK", + 4: "BURST", + 5: "APERTURE (SERVICE ONLY)", + 6: "FLOW RATE", + 7: "LEAK + FLOW", + }, }], + "Running test: sequence index": [48 - 1, {"dt": "16bit_uint", }], + "PRESSURE PLOT: Sampling frequency in 1/10 s": [49 - 1, {"dt": "16bit_uint", }], + "PRESSURE PLOT: Number of available sampling": [50 - 1, {"dt": "16bit_uint", }], + # Note: plot values are available from Modbus register 2001 to 8000 as signed 32 bit values. ----- add if needed + # 81-86 real time clock ----- add if needed + # 64-80 87-92 last test values ----- add if needed + # ------------------------- COMMANDS ------------------------- + "Start test": [101 - 1, {"dt": "16bit_uint", }], + # Write 0 to start the selected program + # Write a different number from 1 to n max programs to start a specific program. + "Reset running test": [102 - 1, {"dt": "16bit_uint", }], + "Activate specific digital output": [103 - 1, {"dt": "16bit_uint", }], + # Write the number from 1 to 16 of the digital output to activate (must be set as Free in Settings) + "Reset specific digital output": [104 - 1, {"dt": "16bit_uint", }], + # Write the number from 1 to 16 of the digital output to reset (must be set as Free in Settings) + "Activate digital output (bit mask)": [105 - 1, {"dt": "16bit_uint", }], + # Write 1 in the bit corresponding to the output to be activated + "Reset digital output (bit mask)": [106 - 1, {"dt": "16bit_uint", }], + # Write 1 in the bit corresponding to the output to be deactivated + "Reset test counter": [107 - 1, {"dt": "16bit_uint", }], + # Write any U16 number to reset tests counters + # ------------------------------------------------------------ + "Language": [601 - 1, {"dt": "16bit_uint", "encoding": { + "ITALIAN": 0, + "ENGLISH": 1, + "FRENCH": 2, + "SIMPLIFIED CHINESE": 3, + "SPANISH": 4, + "NOT AVAILABLE": 5, + "GERMAN": 6, + "JAPANESE": 7, + }, "decoding": { + 0: "ITALIAN", + 1: "ENGLISH", + 2: "FRENCH", + 3: "SIMPLIFIED CHINESE", + 4: "SPANISH", + 5: "NOT AVAILABLE", + 6: "GERMAN", + 7: "JAPANESE", + }, }], + "Source of test program number selection": [602 - 1, {"dt": "16bit_uint", "encoding": { + "FROM PARAMETER (SET BY LCD OR SERIAL LINE)": 0, + "BCD BASE 1, FROM DIGITAL INPUTS (PLC INTERFACE)": 1, + "BCD BASE 0, FROM DIGITAL INPUTS (PLC INTERFACE)": 2, + }, "decoding": { + 0: "FROM PARAMETER (SET BY LCD OR SERIAL LINE)", + 1: "BCD BASE 1, FROM DIGITAL INPUTS (PLC INTERFACE)", + 2: "BCD BASE 0, FROM DIGITAL INPUTS (PLC INTERFACE)", + }, }], + "Selected program": [603 - 1, {"dt": "16bit_uint", }], + # 1- n max programs + "Selected program": [603 - 1, {"dt": "16bit_uint", }], + # 1- n max programs + "Use programs or use products": [604 - 1, {"dt": "16bit_uint", }], + # 0: the Start command will run the active program (see reg. 101 to set the program number) + # 1: the Start command will run the active product (see reg. 101 to set the product number) + "Flag: Instrument settings": [605 - 1, {"dt": "16bit_uint", }], + # | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | + # | | | | | | | | | | PID NR | QE | RF | RP | | DM | SB | + # Bit 0: 1= Start button + # Bit 1: 1= Demo mode + # Bit 3: 1= Reset if test passed + # Bit 4: 1= Reset if test failed + # Bit 5: 1= QLP Extra digit activated + # Bit 6: 1= Leak in pressure per second + # Bit 7: 1= Leak in flow rate unit + "MEASURE UNITS: Relative pressure": [606 - 1, {"dt": "16bit_uint", }], + # 0=mH2O 1=mbar 2=kPa 3=mmHg 4=inH2O 5=psi 6=mmH2O + "MEASURE UNITS: Differential (leak) pressure": [607 - 1, {"dt": "16bit_uint", }], + # 0=mmH2O 1=mbar 2=Pa 3=mmHg 4=inH2O 5=psi + "MEASURE UNITS: Calculated leak flow rate": [608 - 1, {"dt": "16bit_uint", }], + # 0=cm3/min 1=cm3/h + "MEASURE UNITS: Volume": [609 - 1, {"dt": "16bit_uint", }], + # 0=litre 1=cm3 + "MEASURE UNITS: Flow rate": [617 - 1, {"dt": "16bit_uint", }], + # 0=liters/min 1=liters/h 2=m3/h + "Cage automation: closing time": [618 - 1, {"dt": "16bit_uint", "g": 10, }], + # Format: x.x seconds + "Cage automation: opening time": [619 - 1, {"dt": "16bit_uint", "g": 10, }], + # Format: x.x seconds + "Maximum pressure limit": [620 - 1, {"dt": "16bit_uint", "f": 1505, }], + "Plug automation: closing time": [621 - 1, {"dt": "16bit_uint", "g": 10, }], + # Format: x.x seconds + "Plug automation: opening time": [622 - 1, {"dt": "16bit_uint", "g": 10, }], + # Format: x.x seconds + "Marker: result based driving": [623 - 1, {"dt": "16bit_uint", }], + # 0=Only passed + # 1=Only failed + # 2=All + "Marker: driving time": [624 - 1, {"dt": "16bit_uint", "g": 10, }], + # Format: x.x seconds + "PASSWORD: Administration": [631 - 1, {"dt": "32bit_uint"}], + # 1 - 999999 + "PASSWORD: Modify program": [633 - 1, {"dt": "32bit_uint"}], + # 1 - 999999 + "PASSWORD: Select program": [635 - 1, {"dt": "32bit_uint"}], + # 1 - 999999 + "Test program for read/write operation": [700 - 1, {"dt": "16bit_uint", }], + # 1- n max programs + "Test type": [701 - 1, {"dt": "16bit_uint", "encoding": { + "Leak Test": 1, + "Blockage": 2, + "Volume+Leak": 3, + "Burst": 4, + "Aperture": 5, + # "Flow (T3PF)": 6, + "Flow": 6, + # "Leak with Flow (T3PF)": 7, + "Leak with Flow": 7, + }, "decoding": { + 1: "Leak Test", + 2: "Blockage", + 3: "Volume+Leak", + 4: "Burst", + 5: "Aperture", + # 6: "Flow (T3PF)", + 6: "Flow", + # 7: "Leak with Flow (T3PF)", + 7: "Leak with Flow", + }, }], + "Test flags": [702 - 1, {"dt": "16bit_uint", }], + # | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 6 5 4 | 3 | 2 | 1 | 0 | + # | CX | HR | AT | Q- | Q+ | B | Pr- | P0- | PID MODE | T3/Q | | T1/Pr | T0/Pr | + # T0/Pr: Filling mode 0=TIME 1=PRESSURE (*) + # T1/Pr: Filling mode 0=TIME 1=PRESSURE (*) + # T1/Pr (T3LPQ) = 0 - 250 (seconds) + # T3/Q: Fail mode 0=TIME 1=PRESSURE (*) + # PID MODE: 0=FAST 1=MEDIUM 2=SLOW 4 = FIXED 5 = AUTOMATIC 6 = FLOW 7 = LEAK WITH + # ----- + # FLOW + # P0-: 0= P0 pre-filling pressure is positive 1=P0 pre-filling pressure is negative (vacuum) + # Pr-: 0= Pr filling pressure is positive 1=Pr filling pressure is negative (vacuum) + # B: = beep (not used) + # Q+: Negative Q+ parameter + # Q-: Negative Q- parameter + # AT: Pressure tare + # HR: Enable pressure high resolution (depends on the model) (QLP / QHD)(*) + # CX: Test channel - Select used channel (in two channels models in T3P2C) + # (*) = not available on T3LPQ model + "T0 - Pre-filling time": [704 - 1, {"dt": "16bit_uint", "f": 1509, }], + "P0 - Pre-filling pressure": [705 - 1, {"dt": "16bit_uint", "f": 1505, }], + # To set a negative pressure (vacuum) this parameters must be written in absolute value and then set bit P0- in register 702 + "T1 - Filling time": [706 - 1, {"dt": "16bit_uint", "f": 1509, }], + "T2 - Settling time": [707 - 1, {"dt": "16bit_uint", "f": 1509, }], + "T3 - Measure time": [708 - 1, {"dt": "16bit_uint", "f": 1509, }], + "PREL - Nominal test pressure": [709 - 1, {"dt": "16bit_uint", "f": 1505, }], + # To set a negative pressure (vacuum) this parameters must be written in absolute value and then set bit Pr- in register 702 + "PR- - Min pressure tolerance %": [710 - 1, {"dt": "16bit_uint", "g": 10, }], + # Format: x.x % + # NOTE: In blockage test minimum final pressure (format as indicated in register 1505) + "Q+ Upper test leak limit": [711 - 1, {"dt": "16bit_uint", "f": 1503, }], + "Q- Lower test leak limit": [712 - 1, {"dt": "16bit_uint", "f": 1503, }], + "FST - Discharge time": [713 - 1, {"dt": "16bit_uint", "f": 1509, }], + "CV - Volumetric coefficient": [714 - 1, {"dt": "16bit_uint", "f": 1508, }], + "P% Pressure tol. (blockage test)": [717 - 1, {"dt": "16bit_uint", "g": 10, }], + "Nominal peak pressure": [718 - 1, {"dt": "16bit_uint", "f": 1505, }], + # Format: x.x % + "AW: Aperture weight time (AT)": [740 - 1, {"dt": "16bit_uint", }], + "AN: Aperture number": [741 - 1, {"dt": "16bit_uint", }], + # Format x + "Pn - Nominal test pressure": [742 - 1, {"dt": "16bit_uint", "f": 1505, }], + "PB - Burst pressure": [743 - 1, {"dt": "16bit_uint", "f": 1505, }], + "BD - Burst drop / PD - Delta Aperture": [744 - 1, {"dt": "16bit_uint", "f": 1505, }], + "FSL - Discharge limit": [745 - 1, {"dt": "16bit_uint", "f": 1505, }], + "PID: pressure correction": [746 - 1, {"dt": "16bit_uint", "g": 100, }], + # Offset electronic regulator Format: xx.xx% + "PR+ - Max pressure tolerance % (P+)": [747 - 1, {"dt": "16bit_uint", "g": 10, }], + # Format: x.x % + # NOTE: In blockage test maximum final pressure (format as indicated in register 1505) + "AV1: Advanced valve time": [748 - 1, {"dt": "16bit_uint", "g": 10, }], + # Format: x.x seconds + "AV2: Advanced valve time": [749 - 1, {"dt": "16bit_uint", "g": 10, }], + # Format: x.x seconds + "RVP%: volumetric ratio": [750 - 1, {"dt": "16bit_uint", "g": 100, }], + # Format: x.xx (Range from 100.00 to 649.99) + "RVP%: max tolerance": [751 - 1, {"dt": "16bit_uint", "g": 100, }], + # Format: x.xx (Range from 0.10 to 50.00) + "T0 Steps - T0 Step %": [752 - 1, {"dt": "16bit_uint", }], + # | 15 14 13 12 11 10 9 8 | 7 6 5 4 3 2 1 0 | + # | Step % T0 | T0 Steps | + "T1 Steps - T1 Step %": [753 - 1, {"dt": "16bit_uint", }], + # | 15 14 13 12 11 10 9 8 | 7 6 5 4 3 2 1 0 | + # | Step % T1 | T1 Steps | + "Sequence": [754 - 1, {"dt": "16bit_uint", }], +} diff --git a/src/components/tecna_marposs_provaset_t3p_registers.py b/src/components/tecna_marposs_provaset_t3p_registers.py index 9c9195c..2cb94d0 100644 --- a/src/components/tecna_marposs_provaset_t3p_registers.py +++ b/src/components/tecna_marposs_provaset_t3p_registers.py @@ -49,7 +49,7 @@ registers = { 180: "END SEQUENCE PROGRAM", 190: "END PLUG", 200: "END CAGE", - 210: "FINE TEST", # "WAITING THE START OF A NEW TEST", + 210: "FINE TEST", # "END TEST, WAITING THE START OF A NEW TEST", }, }], "Running test: phase backwards time": [33 - 1, {"dt": "16bit_uint", "f": 26, }], "Running test: filling pressure": [34 - 1, {"dt": "32bit_int", "f": 21, }], @@ -178,7 +178,7 @@ registers = { # Format: x.x seconds "Cage automation: opening time": [619 - 1, {"dt": "16bit_uint", "g": 10, }], # Format: x.x seconds - "Maximum pressure limit": [620 - 1, {"dt": "16bit_uint", }], + "Maximum pressure limit": [620 - 1, {"dt": "16bit_uint", "f": 23, }], "Plug automation: closing time": [621 - 1, {"dt": "16bit_uint", "g": 10, }], # Format: x.x seconds "Plug automation: opening time": [622 - 1, {"dt": "16bit_uint", "g": 10, }], @@ -190,8 +190,11 @@ registers = { "Marker: driving time": [624 - 1, {"dt": "16bit_uint", "g": 10, }], # Format: x.x seconds "PASSWORD: Administration": [631 - 1, {"dt": "32bit_uint"}], + # 1 - 999999 "PASSWORD: Modify program": [633 - 1, {"dt": "32bit_uint"}], + # 1 - 999999 "PASSWORD: Select program": [635 - 1, {"dt": "32bit_uint"}], + # 1 - 999999 "Test program for read/write operation": [700 - 1, {"dt": "16bit_uint", }], # 1- n max programs "Test type": [701 - 1, {"dt": "16bit_uint", "encoding": { @@ -216,8 +219,8 @@ registers = { 7: "Leak with Flow", }, }], "Test flags": [702 - 1, {"dt": "16bit_uint", }], - # | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 6 5 4 | 3 | 2 | 1 | 0 | - # | CH | HR | AT | Q- | Q+ | | Pr- | P0- | PID MODE | T3/Q | FSM | T1/Pr | | + # | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 6 5 4 | 3 | 2 | 1 | 0 | + # | CH | HR | AT | Q- | Q+ | | Pr- | P0- | PID MODE | T3/Q | FSM | T1/Pr | T0/Pr | # CH: Select used channel (in two channels models as T3P2C) # HR: Enable pressure high resolution (depends on the model) # AT: Pressure auto tare @@ -258,7 +261,7 @@ registers = { "PV%": [742 - 1, {"dt": "16bit_uint", "g": 10, }], # Set of electronic regulator in blockage test (Format x.x %) "PB - Minimum burst pressure": [743 - 1, {"dt": "16bit_uint", "f": 23, }], - "BD - Burst gap / PD Delta Aperture": [744 - 1, {"dt": "16bit_uint", "f": 23, }], + "BD - Burst gap / PD - Delta Aperture": [744 - 1, {"dt": "16bit_uint", "f": 23, }], "FSL - Discharge limit": [745 - 1, {"dt": "16bit_uint", "f": 23, }], "RP% - Pressure ratio": [746 - 1, {"dt": "16bit_uint", "g": 100, }], # Format; x.xx % diff --git a/src/main.py b/src/main.py index a932cd4..3536ead 100644 --- a/src/main.py +++ b/src/main.py @@ -54,7 +54,7 @@ try: # IMPORT PROJECT ONLY AFTER SETTING UP SIGNAL, FAULTHANDLER AND LOGGHING from components import (ArchiveSynchronizer, GalaxyCamera, Multicomp730424, NeoPixels, Os_Label_Printer, RemoteAPI, - TecnaMarpossProvasetT3P, Vision, VisionSaver) + TecnaMarpossProvasetT3, Vision, VisionSaver) from lib.db import Users from lib.helpers import ConfigReader from PyQt5.QtCore import QObject, QThread, pyqtSignal @@ -83,7 +83,7 @@ try: "multicomp": {"c": Multicomp730424, "k": {"paused": True}}, "neo_pixels": {"c": NeoPixels, "t": False}, "remote_api": {"c": RemoteAPI, "k": {"main": self}}, - "tecna_t3": {"c": TecnaMarpossProvasetT3P, "k": {"paused": True}}, + "tecna_t3": {"c": TecnaMarpossProvasetT3, "k": {"paused": True}}, "vision_saver": {"c": VisionSaver, "t": False}, "vision": {"c": Vision, "k": {"paused": True}}, } diff --git a/src/ui/test_leak/test_leak.py b/src/ui/test_leak/test_leak.py index b330b97..4c706a3 100644 --- a/src/ui/test_leak/test_leak.py +++ b/src/ui/test_leak/test_leak.py @@ -91,7 +91,7 @@ class Test_Leak(Test_Test): if d.get("Running test: active phase", None) in { "WAITING START", "ATTESA START", - "WAITING THE START OF A NEW TEST" + "END TEST, WAITING THE START OF A NEW TEST" "FINE TEST", }: if self.parent_assembly_widget is not None: