Compare commits

...

1 Commits

2 changed files with 41 additions and 15 deletions

View File

@ -751,6 +751,7 @@ class Test(Widget):
self.cycle_steps = steps
self.check_steps_dependencies(self.cycle_steps)
leak_autotest_steps = []
# CONFIGURE LEAK AUTOTEST PARAMETERS
if self.config["autotest_leak"]["enabled"] == "true":
l_at_1 = copy.deepcopy(self.config["autotest_leak"])
@ -1010,20 +1011,36 @@ class Test(Widget):
leak_test_2_step_spec = leak_test_2_step.get("spec", {})
leak_test_2_results = leak_test_2.get("results", {})
psetminp_a = leak_test_1_step_spec.get("test_pressure", 0) * (
100 + leak_test_1_step_spec.get("test_pressure_qneg", 0) / 100)
psetmaxp_a = leak_test_1_step_spec.get("settling_pressure_max_percent", 0) * (
100 + leak_test_1_step_spec.get("test_pressure_qpos", 0) / 100)
psetminp2_a = leak_test_2_step_spec.get("settling_pressure_min_percent", 0) * (
100 + leak_test_2_step_spec.get("test_pressure_qneg", 0) / 100)
psetmaxp2_a = leak_test_2_step_spec.get("settling_pressure_max_percent", 0) * (
100 + leak_test_2_step_spec.get("test_pressure_qpos", 0) / 100)
if self.tester_component is not None:
if self.recipe.spec["leak_1"]:
# Verifica preventiva della presenza della specifica della ricetta
has_spec = self.recipe is not None and getattr(self.recipe, 'spec', None) is not None
# Calcolo protetto delle pressioni assolute del test 1
if has_spec and self.recipe.spec.get("leak_1", False):
psetminp_a = leak_test_1_step_spec.get("test_pressure", 0) * (
100 + leak_test_1_step_spec.get("test_pressure_qneg", 0) / 100)
psetmaxp_a = leak_test_1_step_spec.get("settling_pressure_max_percent", 0) * (
100 + leak_test_1_step_spec.get("test_pressure_qpos", 0) / 100)
else:
psetminp_a = "-"
psetmaxp_a = "-"
# Calcolo protetto delle pressioni assolute del test 2
if has_spec and self.recipe.spec.get("leak_2", False):
psetminp2_a = leak_test_2_step_spec.get("settling_pressure_min_percent", 0) * (
100 + leak_test_2_step_spec.get("test_pressure_qneg", 0) / 100)
psetmaxp2_a = leak_test_2_step_spec.get("settling_pressure_max_percent", 0) * (
100 + leak_test_2_step_spec.get("test_pressure_qpos", 0) / 100)
else:
psetminp2_a = "-"
psetmaxp2_a = "-"
# Calcolo del valore di fine misura solo se le fasi sono effettivamente attive
if self.tester_component is not None and has_spec:
if self.recipe.spec.get("leak_1", False) and "Running test: pressure at the end of settling" in leak_test_1_results:
leak_test_1_results["Running test: pressure at the end of measure"] = (
leak_test_1_results["Running test: pressure at the end of settling"]
+ leak_test_1_results["Running test: measured leak"])
if self.recipe.spec["leak_2"]:
if self.recipe.spec.get("leak_2", False) and "Running test: pressure at the end of settling" in leak_test_2_results:
leak_test_2_results["Running test: pressure at the end of measure"] = (
leak_test_2_results["Running test: pressure at the end of settling"]
+ leak_test_2_results["Running test: measured leak"])
@ -1254,11 +1271,19 @@ class Test(Widget):
has_error (bool): True if there is an error, False otherwise.
error_message (str): The error message to add.
"""
# print(f"DEBUG: Modbus error handler called - has_error={has_error}, error_message={error_message}") # Debugging
# Verifica se la ricetta attuale richiede il Tecna
needs_tecna = False
if self.recipe is not None and getattr(self.recipe, 'spec', None):
needs_tecna = (self.recipe.spec.get("leak_1", False) or
self.recipe.spec.get("leak_2", False) or
self.recipe.spec.get("test_freefall_leak", False))
if has_error:
self.add_error(f"Errore Tecna", True) # Add the Modbus error
# Mostra l'errore solo se il Tecna serve alla ricetta, o se non c'è nessuna ricetta caricata
if needs_tecna or self.recipe is None:
self.add_error(f"Errore Tecna", True)
else:
self.remove_error(f"Errore Tecna") # Remove the Modbus error
self.remove_error(f"Errore Tecna")
def update_label_with_args(self, extra_info=None):
"""

View File

@ -233,7 +233,8 @@ class Test_Leak(Test_Test):
self.components[self.tester_component].stop_test()
self.components[self.tester_component].pause()
self.disconnect(self.get_connection)
self.set_digital_out("first_output", 0) # Set low when test stops
if self.step.step_type == "test_freefall_leak":
self.set_digital_out("first_output", 0) # Set low when test stops
super().stop()
self.start_b.setEnabled(False)
self.stop_b.setEnabled(False)