From 5fcb04f969fdb424b06c68167581d7f4f53552b8 Mon Sep 17 00:00:00 2001 From: gg Date: Mon, 22 Apr 2024 18:38:34 +0200 Subject: [PATCH] -various fixes -st-ten-8 tested ok with new flush blow valves --- README.md | 20 ++-- config/csv_import/st-ten-8.csv | 14 +-- config/machine_settings/defaults.ini | 2 +- config/machine_settings/st-ten-8-no-io.ini | 104 ++++++++++++++++++ config/machine_settings/st-ten-8.ini | 12 +- src/components/os_label_printer.py | 14 +-- src/components/tecna_marposs_provaset_t3.py | 2 +- src/ui/test_instructions/test_instructions.py | 7 +- src/ui/test_leak/test_leak.py | 2 + 9 files changed, 143 insertions(+), 34 deletions(-) create mode 100644 config/machine_settings/st-ten-8-no-io.ini diff --git a/README.md b/README.md index d5c72d7..75af5e7 100644 --- a/README.md +++ b/README.md @@ -5,18 +5,20 @@ CONTROL SOFTWARE FOR ERRECINQUE LEAK TEST SYSTEMS ## Getting started This software is deployed on many different systems, each using one of the following leak test instruments: --Tecna T3L --Tecna T3P --Furness controls FCO730 + +- Tecna T3L +- Tecna T3P +- Furness controls FCO730 In addition to leak testing, the software supports many other functions, depending on which system is deployed: --electrical resistance measurement --vision test --fixture digital I/O management + +- electrical resistance measurement +- vision test +- fixture digital I/O management ## Setup --Clone the repository --On Windows: ./init_win.bat --On Linux: ./init.sh +- Clone the repository +- On Windows: ./init_win.bat +- On Linux: ./init.sh diff --git a/config/csv_import/st-ten-8.csv b/config/csv_import/st-ten-8.csv index 67f4837..4532eda 100644 --- a/config/csv_import/st-ten-8.csv +++ b/config/csv_import/st-ten-8.csv @@ -1,8 +1,8 @@ codice_ricetta,cliente,codice_prodotto,descrizione,tempo_riempimento,tempo_assestamento,tempo_di_test,percentuale_minima_pressione_assestamento,percentuale_massima_pressione_assestamento,pressione_di_test_delta_minimo,pressione_di_test,pressione_di_test_delta_massimo,modello_etichetta,richiedi_inserimento_scarto,istruzione_abilitata,tempo_svuotamento -5803112815,IVECO,5803112815,Daily Automatico,5,10,10,5,5,30,5000,5,ETA30x16_203dpi.prn,x,x,1 -5803112816,IVECO,5803112816,Daily Automatico,5,10,10,5,5,30,5000,5,ETA30x16_203dpi.prn,x,x,1 -000746453 REV.5,FERRARI,000746453 REV.5,TUBO RITORNO OLIO,10,30,20,5,5,25,10000,5,ferrari_stten8.prn,,,1 -MY83-6L701-AB,ASTON MARTIN,MY83-6L701-AB,TRANSMISSION OIL,5,10,10,5,5,30,7000,5,aston_martin.prn,,,1 -MY83-6L694-AB,ASTON MARTIN,MY83-6L694-AB,TRANSMISSION OIL,5,10,10,5,5,30,7000,5,aston_martin.prn,,,1 -MY83-6B747-BA,ASTON MARTIN,MY83-6B747-BA,ENGINE OIL,5,10,10,5,5,30,7000,5,aston_martin.prn,,,1 -MY83-6B748-BA,ASTON MARTIN,MY83-6B748-BA,ENGINE OIL,5,10,10,5,5,30,7000,5,aston_martin.prn,,,1 \ No newline at end of file +5803112815,IVECO,5803112815,Daily Automatico,5,10,10,5,5,30,5000,5,ETA30x16_203dpi.prn,x,x,0 +5803112816,IVECO,5803112816,Daily Automatico,5,10,10,5,5,30,5000,5,ETA30x16_203dpi.prn,x,x,0 +000746453 REV.5,FERRARI,000746453 REV.5,TUBO RITORNO OLIO,10,30,20,5,5,25,10000,5,ferrari_stten8.prn,,,0 +MY83-6L701-AB,ASTON MARTIN,MY83-6L701-AB,TRANSMISSION OIL,5,10,10,5,5,30,7000,5,aston_martin.prn,,,0 +MY83-6L694-AB,ASTON MARTIN,MY83-6L694-AB,TRANSMISSION OIL,5,10,10,5,5,30,7000,5,aston_martin.prn,,,0 +MY83-6B747-BA,ASTON MARTIN,MY83-6B747-BA,ENGINE OIL,5,10,10,5,5,30,7000,5,aston_martin.prn,,,0 +MY83-6B748-BA,ASTON MARTIN,MY83-6B748-BA,ENGINE OIL,5,10,10,5,5,30,7000,5,aston_martin.prn,,,0 \ No newline at end of file diff --git a/config/machine_settings/defaults.ini b/config/machine_settings/defaults.ini index 21f6389..6fac74d 100644 --- a/config/machine_settings/defaults.ini +++ b/config/machine_settings/defaults.ini @@ -53,7 +53,7 @@ resize_resolution: 612x512 archive_endpoint: https://r5portal.it/api/st-ten-save/ images_path: data/images poll_time: 60 -hold_time: 1 +hold_time: 30 service_account_json: config/machine_settings/gcloud_default.json bucket_id: st_ten_img diff --git a/config/machine_settings/st-ten-8-no-io.ini b/config/machine_settings/st-ten-8-no-io.ini new file mode 100644 index 0000000..a706a85 --- /dev/null +++ b/config/machine_settings/st-ten-8-no-io.ini @@ -0,0 +1,104 @@ +[machine] +description = ST-TEN-8 DAILY AUTOMATICO (NO I/O DIMA) +instruction_folder = st-ten-8 + +[hardware_config] +archive_synchronizer: present +uvc_camera: absent +label_printer: present +neo_pixels: absent +remote_api: absent +tecna_t3: present +vision_saver: absent +vision: absent +screwdriver: absent +digital_io: absent +digital_io_flush_blow: present +barcode_recipe_selection: present +fixture_id: present +discard_box: present +enforce_piece_removal: yes +external_flush_blow: present # EXTERNAL BOX CONTROLLING MULTI-CHANNEL TEST (IF PRESENT), BLOW-CLEANING AND EXTERNAL FLUSH + +[tecna_t3] +port: COM4 +model: t3p + +[label_printer] +platform: windows +printer: zd421 + +[digital_io] +# OUTPUT MAP FOR FIXTURE CONNECTOR +id_fixture: USB-5862,BID#0 +discard_idx:12 # BIT NUMBER OF THE I/0 MODULE USED FOR DISCARD SENSING + +[digital_io_flush_blow] +id: USB-5860,BID#1 +# OUTPUT MAP FOR EXTERNAL FLUSH/BLOW UNIT +blow_on: 0 # INPUT VALVE TO SERVICE AIR +flush_on: 1 # OUTPUT VALVE TO DIRT COLLECTOR +blow_led:4 # CLEAN INDICATOR +ch1_led:3 # CHANNEL 1 ACTIVE INDICATOR +flush_led:2 # FLUSH INDICATOR + + +[fixture_rfid] +port: COM5 + +[recipe] +recipe_name_field: codice_ricetta +part_number_field: codice_prodotto +label_template_field: modello_etichetta +description_field: descrizione + +[recipes_defaults] +tester_discharge_enable: no +dimensione_lotto_abilitata: x +tempo_pre_riempimento: 0 +pressione_pre_riempimento: 1000 +tempo_riempimento: 15 +tempo_assestamento: 15 +tempo_di_test: 10 +percentuale_minima_pressione_assestamento: 5 +percentuale_massima_pressione_assestamento: 5 +pressione_di_test_delta_minimo: 30 +pressione_di_test: 7000 +pressione_di_test_delta_massimo: 30 +tempo_svuotamento: 0 +pressione_svuotamento: 100 +canale_di_prova: 1 +prova_tenuta_abilitata_2: +tempo_pre_riempimento_2: 0 +pressione_pre_riempimento_2: 1000 +tempo_riempimento_2: 20 +tempo_assestamento_2: 20 +tempo_di_test_2: 10 +percentuale_minima_pressione_assestamento_2: 5 +percentuale_massima_pressione_assestamento_2: 5 +pressione_di_test_delta_minimo_2: 30 +pressione_di_test_2: 15000 +pressione_di_test_delta_massimo_2: 30 +tempo_svuotamento_2: 0 +pressione_svuotamento_2: 100 +canale_di_prova_2: 2 +modello_etichetta: EtichettaR5_Montaggio_1prova.prn +pid_pressure_correction: 105 + +[autotest_leak] +enabled: true +pre_filling_time: 0 +pre_filling_pressure: 1000 +filling_time: 10 +settling_time: 10 +settling_pressure_min_percent: 5 +settling_pressure_max_percent: 5 +test_pressure: 7000 +test_time: 10 +test_pressure_qpos: 10 #Q+ Upper test leak limit +test_pressure_qneg: 30 #Q- Lower test leak limit +test_pressure_tt_qpos: 1 # Q+ Upper test leak limit (tube-tube) +test_pressure_tt_qneg: 5 # Q- Lower test leak limit (tube-tube) +flush_time: 1 +flush_pressure: 100 +relay_config: 1 \ No newline at end of file diff --git a/config/machine_settings/st-ten-8.ini b/config/machine_settings/st-ten-8.ini index a0730d4..3aef841 100644 --- a/config/machine_settings/st-ten-8.ini +++ b/config/machine_settings/st-ten-8.ini @@ -13,12 +13,12 @@ vision_saver: absent vision: absent screwdriver: absent digital_io: present -#digital_io_flush_blow: present +digital_io_flush_blow: present barcode_recipe_selection: present fixture_id: present discard_box: present enforce_piece_removal: yes -#external_flush_blow: present # EXTERNAL BOX CONTROLLING MULTI-CHANNEL TEST (IF PRESENT), BLOW-CLEANING AND EXTERNAL FLUSH +external_flush_blow: present # EXTERNAL BOX CONTROLLING MULTI-CHANNEL TEST (IF PRESENT), BLOW-CLEANING AND EXTERNAL FLUSH [tecna_t3] port: COM4 @@ -34,7 +34,7 @@ id_fixture: USB-5862,BID#0 discard_idx:12 # BIT NUMBER OF THE I/0 MODULE USED FOR DISCARD SENSING [digital_io_flush_blow] -id: USB-5860,BID#0 +id: USB-5860,BID#1 # OUTPUT MAP FOR EXTERNAL FLUSH/BLOW UNIT blow_on: 0 # INPUT VALVE TO SERVICE AIR flush_on: 1 # OUTPUT VALVE TO DIRT COLLECTOR @@ -53,7 +53,7 @@ label_template_field: modello_etichetta description_field: descrizione [recipes_defaults] -tester_discharge_enable: yes +tester_discharge_enable: no dimensione_lotto_abilitata: x tempo_pre_riempimento: 0 pressione_pre_riempimento: 1000 @@ -65,7 +65,7 @@ percentuale_massima_pressione_assestamento: 5 pressione_di_test_delta_minimo: 30 pressione_di_test: 7000 pressione_di_test_delta_massimo: 30 -tempo_svuotamento: 1 +tempo_svuotamento: 0 pressione_svuotamento: 100 canale_di_prova: 1 prova_tenuta_abilitata_2: @@ -79,7 +79,7 @@ percentuale_massima_pressione_assestamento_2: 5 pressione_di_test_delta_minimo_2: 30 pressione_di_test_2: 15000 pressione_di_test_delta_massimo_2: 30 -tempo_svuotamento_2: 1 +tempo_svuotamento_2: 0 pressione_svuotamento_2: 100 canale_di_prova_2: 2 modello_etichetta: EtichettaR5_Montaggio_1prova.prn diff --git a/src/components/os_label_printer.py b/src/components/os_label_printer.py index bc27dc4..5e245de 100644 --- a/src/components/os_label_printer.py +++ b/src/components/os_label_printer.py @@ -56,10 +56,11 @@ class Os_Label_Printer(Component): label_file_contents = label_file_contents.replace(key, val) if platform.system().lower() == "windows": try: - printer = win32print.OpenPrinter(self.printer) - job = win32print.StartDocPrinter(printer, 1, ("label", None, "RAW")) - win32print.WritePrinter(printer, bytes(label_file_contents, encoding="utf8", errors="surrogateescape")) - win32print.EndPagePrinter(printer) + if not self.simulate: + printer = win32print.OpenPrinter(self.printer) + job = win32print.StartDocPrinter(printer, 1, ("label", None, "RAW")) + win32print.WritePrinter(printer, bytes(label_file_contents, encoding="utf8", errors="surrogateescape")) + win32print.EndPagePrinter(printer) return label_file_contents except Exception as e: self.log.exception(traceback.format_exc()) @@ -75,10 +76,7 @@ class Os_Label_Printer(Component): label_file = "tmp/label.prn" with open(label_file, "w", errors="surrogateescape") as f: f.write(label_file_contents) - if platform.system().lower() == "windows": - cmd = f'print /d:"{self.printer}" "{label_file}"' - else: - cmd = f'lp -d "{self.printer}" "{label_file}"' + cmd = f'lp -d "{self.printer}" "{label_file}"' if not self.simulate: p = subprocess.run(cmd, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, shell=True) # unsafe if p.returncode != 0: diff --git a/src/components/tecna_marposs_provaset_t3.py b/src/components/tecna_marposs_provaset_t3.py index d2bba1b..201e681 100644 --- a/src/components/tecna_marposs_provaset_t3.py +++ b/src/components/tecna_marposs_provaset_t3.py @@ -271,7 +271,7 @@ class TecnaMarpossProvasetT3(ModbusComponent): recipe_name += b"\x00" * (16 - len(recipe_name)) recipe_barcode = f"j{recipe.part_number}"[:16].encode("ascii") recipe_barcode += b"\x00" * (24 - len(recipe_barcode)) - test_flags = 0b0110100001010100 if (step.spec.get("autotest", False) in ["ko_check"]) else 0b0110000001010100 + test_flags = 0b0110100001010000 if (step.spec.get("autotest", False) in ["ko_check"]) else 0b0110000001010000 pid_mode = int(self.config["recipes_defaults"]["pid_mode"])<<4 test_flags = test_flags | pid_mode pid_ramps=0b0000000000000000 | int(self.config["recipes_defaults"]["pid_level"])<<8 | int(self.config["recipes_defaults"]["pid_speed"])<<12 diff --git a/src/ui/test_instructions/test_instructions.py b/src/ui/test_instructions/test_instructions.py index ae87a6f..0130241 100644 --- a/src/ui/test_instructions/test_instructions.py +++ b/src/ui/test_instructions/test_instructions.py @@ -16,6 +16,7 @@ from lxml import etree class Test_Instructions(Test_Test): def __init__(self,config ,components=None, recipe=None, step=None, run_once=False, reset_on_start=False, enable_override=True,bench_name="generic"): super().__init__(components=components, recipe=recipe, step=step, run_once=run_once, reset_on_start=reset_on_start, enable_override=enable_override) + self.get_connection = None self.bench_name = bench_name self.config = config self.recipe=recipe @@ -43,7 +44,8 @@ class Test_Instructions(Test_Test): self.timer.start(1000) # setup test loop - self.get_connection = self.components["digital_io"].out.connect(self.get) + if "digital_io" in self.components.keys(): + self.get_connection = self.components["digital_io"].out.connect(self.get) if step is not None: svg_path=f"{self.svg_path}{self.recipe}.svg" @@ -165,7 +167,8 @@ class Test_Instructions(Test_Test): #self.done=True #self.done_ok = True self.timer.stop() - self.disconnect(self.get_connection) + if self.get_connection is not None: + self.disconnect(self.get_connection) super().stop() def reset(self): diff --git a/src/ui/test_leak/test_leak.py b/src/ui/test_leak/test_leak.py index 0ea02f3..24b77b1 100644 --- a/src/ui/test_leak/test_leak.py +++ b/src/ui/test_leak/test_leak.py @@ -64,12 +64,14 @@ class Test_Leak(Test_Test): self.display_text("SOFFIAGGIO IN CORSO...") self.set_digital_out("blow_led",True) self.set_digital_out("blow_on",True) + time.sleep(VALVE_TIME) self.set_digital_out("flush_on", True) blow_time=int(self.step.spec.get('ext_blow_time',3)) self.set_digital_out("blow_led", True) time.sleep(blow_time) self.set_digital_out("blow_led", False) self.set_digital_out("blow_on", False) + time.sleep(VALVE_TIME) self.set_digital_out("flush_on", False) if self.parent.config["hardware_config"].get("dual_channel", None) != "present":