config-dependent autotest tbt

This commit is contained in:
germano 2023-02-26 19:09:46 +01:00
parent 247ac72261
commit 1a5536f4d2
5 changed files with 92 additions and 42 deletions

View File

@ -148,3 +148,21 @@ ricetta_visione: termorestringente_923578.ini
stampa_etichetta_abilitata: x stampa_etichetta_abilitata: x
modello_etichetta: ETA013L.prn modello_etichetta: ETA013L.prn
descrizione: inserire descrizione ricetta descrizione: inserire descrizione ricetta
[autotest_leak]
enabled: true
pre_filling_time: 0
pre_filling_pressure: 1000
filling_time: 5
settling_time: 5
settling_pressure_min_percent: 5
settling_pressure_max_percent: 5
test_time: 10
test_pressure_min_delta: 5
test_pressure: 9000
test_pressure_max_delta: 5
flush_time: 1
flush_pressure: 100
[autotest_resistance]
enabled: false

View File

@ -22,6 +22,12 @@ model: t3l
[neo_pixels] [neo_pixels]
port: COM5 port: COM5
[label_printer]
platform: windows
printer: zd421
[digital_io]
id: USB-5860,BID#0
[recipe] [recipe]
recipe_name_field: codice_ricetta recipe_name_field: codice_ricetta
part_number_field: codice_prodotto part_number_field: codice_prodotto
@ -59,9 +65,17 @@ pressione_svuotamento_2: 100
config_elettrovalvole_2: 2 config_elettrovalvole_2: 2
modello_etichetta: EtichettaR5_Montaggio_1prova.prn modello_etichetta: EtichettaR5_Montaggio_1prova.prn
[label_printer] [autotest_leak]
platform: windows enabled: true
printer: zd421 pre_filling_time: 0
pre_filling_pressure: 1000
[digital_io] filling_time: 15
id: USB-5860,BID#0 settling_time: 15
settling_pressure_min_percent: 5
settling_pressure_max_percent: 5
test_time: 10
test_pressure_min_delta: 5
test_pressure: 15000
test_pressure_max_delta: 5
flush_time: 1
flush_pressure: 100

View File

@ -1,3 +1,4 @@
import copy
import logging import logging
import os import os
import sys import sys
@ -326,6 +327,18 @@ class Test(Widget):
steps.append(Steps(type="wait")) steps.append(Steps(type="wait"))
self.cycle_steps = steps self.cycle_steps = steps
self.check_steps_dependencies(self.cycle_steps) self.check_steps_dependencies(self.cycle_steps)
leak_autotest_steps=[]
if self.config["autotest_leak"]["enabled"]=="true":
l_at_1=copy.deepcopy(self.config["autotest_leak"])
l_at_1.pop("enabled")
l_at_1={a: float(x) for a, x in l_at_1.items()}
l_at_1["autotest"]=True
l_at_2=copy.deepcopy(self.config["autotest_leak"])
l_at_2.pop("enabled")
l_at_2={a: float(x) for a, x in l_at_2.items()}
l_at_2["autotest"]=False
leak_autotest_steps=[Steps(type="leak_1",spec=l_at_1),Steps(type="leak_1",spec=l_at_2)]
self.autotest_cycle_steps = [ self.autotest_cycle_steps = [
*([ *([
Steps(type="resistance", spec={ Steps(type="resistance", spec={
@ -357,40 +370,41 @@ class Test(Widget):
"autotest": True, "autotest": True,
}), }),
] if "resistance" not in self.unsupported_steps else []), ] if "resistance" not in self.unsupported_steps else []),
*([ *(leak_autotest_steps),
Steps(type="leak_1", spec={ # *([
"pre_filling_time": 0, # Steps(type="leak_1", spec={
"pre_filling_pressure": 1000, # "pre_filling_time": 0,
"filling_time": 5, # "pre_filling_pressure": 1000,
"settling_time": 5, # "filling_time": 5,
"settling_pressure_min_percent": 5, # "settling_time": 5,
"settling_pressure_max_percent": 5, # "settling_pressure_min_percent": 5,
"test_time": 10, # "settling_pressure_max_percent": 5,
"test_pressure_min_delta": 5, # "test_time": 10,
"test_pressure": 9000, # "test_pressure_min_delta": 5,
"test_pressure_max_delta": 5, # "test_pressure": 9000,
"flush_time": 1, # "test_pressure_max_delta": 5,
"flush_pressure": 100, # "flush_time": 1,
"autotest": True, # "flush_pressure": 100,
}), # "autotest": True,
] if "leak_1" not in self.unsupported_steps else []), # }),
*([ # ] if "leak_1" not in self.unsupported_steps else []),
Steps(type="leak_1", spec={ # *([
"pre_filling_time": 0, # Steps(type="leak_1", spec={
"pre_filling_pressure": 1000, # "pre_filling_time": 0,
"filling_time": 5, # "pre_filling_pressure": 1000,
"settling_time": 5, # "filling_time": 5,
"settling_pressure_min_percent": 5, # "settling_time": 5,
"settling_pressure_max_percent": 5, # "settling_pressure_min_percent": 5,
"test_time": 10, # "settling_pressure_max_percent": 5,
"test_pressure_min_delta": 5, # "test_time": 10,
"test_pressure": 9000, # "test_pressure_min_delta": 5,
"test_pressure_max_delta": 5, # "test_pressure": 9000,
"flush_time": 1, # "test_pressure_max_delta": 5,
"flush_pressure": 100, # "flush_time": 1,
"autotest": False, # "flush_pressure": 100,
}), # "autotest": False,
] if "leak_1" not in self.unsupported_steps else []), # }),
# ] if "leak_1" not in self.unsupported_steps else []),
Steps(type="done"), Steps(type="done"),
Steps(type="wait"), Steps(type="wait"),
] ]

View File

@ -22,11 +22,15 @@ class Test_Assembly(Widget):
self.img = None self.img = None
self.img_l.setVisible(False) self.img_l.setVisible(False)
def set_text(self, text=None): def set_text(self, text=None,color=None):
if text is not None: if text is not None:
self.text = text self.text = text
self.text_l.setText(str(self.text)) self.text_l.setText(str(self.text))
self.text_l.setVisible(True) self.text_l.setVisible(True)
if color is None:
color = "green"
self.text_l.setStyleSheet(f"background-color: {color};")
else: else:
self.text = None self.text = None
self.text_l.setVisible(False) self.text_l.setVisible(False)

View File

@ -139,7 +139,7 @@ class Test_Leak(Test_Test):
self.parent_assembly_widget().set_text(text="COLLEGARE GLI ATTACCHI PNEUMATICI E PREMERE START PER INIZIARE LA PROVA TENUTA") self.parent_assembly_widget().set_text(text="COLLEGARE GLI ATTACCHI PNEUMATICI E PREMERE START PER INIZIARE LA PROVA TENUTA")
else: else:
if self.parent_assembly_widget is not None: if self.parent_assembly_widget is not None:
self.parent_assembly_widget().set_text(text="AUTOTEST: COLLEGARE GLI ATTACCHI PNEUMATICI CALIBRATI E PREMERE START PER INIZIARE LA PROVA TENUTA DI PROVA") self.parent_assembly_widget().set_text(text="AUTOTEST: COLLEGARE LA FUGA CALIBRATA E PREMERE START PER INIZIARE LA PROVA TENUTA DI PROVA",color="blue")
self.start_b.setEnabled(True) self.start_b.setEnabled(True)
self.stop_b.setEnabled(False) self.stop_b.setEnabled(False)
else: else: