Compare commits

..

No commits in common. "8924d68958c34fa01c9652805fb2be1d2df7be8e" and "e5c4f8a80b3f9babf3e747df93bcc1e9a7b0dbe4" have entirely different histories.

25
main.py
View File

@ -271,6 +271,9 @@ def is_connected():
# PU CONTROL
# --- helpers.py (or in the same file if you want) ---
def validate_state(state: str) -> str:
"""Normalize and validate the requested state."""
state = state.upper()
@ -540,8 +543,7 @@ async def stop_auto_test(pu: int):
async def run_auto_test_1(pu: int = 1):
try:
await send_command_with_delay("PRE-PRODUCTION", pu = pu, delay_s=0, ploop_setpoint=2.5, qperm_setpoint=1200.0)
await asyncio.sleep(180) # Starting time of the machine
await set_patients_with_delay(5, delay_s=10)
await set_patients_with_delay(5, delay_s=190)
await set_patients_with_delay(10, delay_s=20)
await set_patients_with_delay(0, delay_s=20)
await send_command_with_delay("IDLE", pu =pu, delay_s=20, ploop_setpoint=2.5, qperm_setpoint=1200.0)
@ -557,18 +559,31 @@ async def run_auto_test_2():
try:
# Step 1: Run PU1 test
# await run_auto_test_1(1, ploop_setpoint)
# TODO : TODO
# Step 2: PU2 sequence
await send_command_with_delay("PRE-PRODUCTION", pu=2, delay_s=0, ploop_setpoint=ploop_setpoint, qperm_setpoint=1200.0)
# await send_command_with_delay("PRODUCTION", 2, delay_s=180, ploop_setpoint=ploop_setpoint)
await set_patients_with_delay(15, delay_s=60)
await set_patients_with_delay(0, delay_s=60)
await send_command_with_delay("IDLE", pu=2, delay_s=60, ploop_setpoint=ploop_setpoint, qperm_setpoint=1200.0)
await send_command_with_delay("IDLE", pu=1, delay_s=60, ploop_setpoint=ploop_setpoint, qperm_setpoint=1200.0)
logging.info("[AUTO TEST] Finished PU1 + PU2 test")
except asyncio.CancelledError:
logging.info(f"[AUTO TEST] PU 2 task cancelled")
# optional cleanup
raise
async def run_auto_test_3():
async def run_auto_test_3(ploop_setpoint: float):
try:
# Step 1: Run PU1 test
# await run_auto_test_1()
# TODO : TODO
# Step 2: PU2 sequence
await send_command_with_delay("PRE-PRODUCTION", pu=2, delay_s=0, ploop_setpoint=ploop_setpoint, qperm_setpoint=1200.0)
await set_patients_with_delay(15, delay_s=60)
await set_patients_with_delay(0, delay_s=60)
await send_command_with_delay("IDLE", pu=2, delay_s=60, ploop_setpoint=ploop_setpoint, qperm_setpoint=1200.0)
await send_command_with_delay("IDLE", pu=1, delay_s=60, ploop_setpoint=ploop_setpoint, qperm_setpoint=1200.0)
logging.info("[AUTO TEST] Finished PU1 + PU2 test")
except asyncio.CancelledError:
logging.info(f"[AUTO TEST] PU 2 task cancelled")