Index: tests/dg_tests.py =================================================================== diff -u -rf0cb1f298e3960769e0133172769deb9afe5a393 -rc179a1b072005028cb495911f463b2bfcd9aa1d2 --- tests/dg_tests.py (.../dg_tests.py) (revision f0cb1f298e3960769e0133172769deb9afe5a393) +++ tests/dg_tests.py (.../dg_tests.py) (revision c179a1b072005028cb495911f463b2bfcd9aa1d2) @@ -21,6 +21,7 @@ from dialin.common.dg_defs import DGHeatDisinfectStates, DGHeatDisinfectUIStates from dialin.dg.heat_disinfect import HeatCancellationModes from dialin.common.dg_defs import DGChemicalDisinfectStates, DGChemDisinfectUIStates +from dialin.common.dg_defs import DGChemDisinfectFlushStates, DGChemDisinfectFlushUIStates from dialin.dg.chemical_disinfect import ChemCancellationModes from dialin.dg.drain_pump import DrainPumpStates from dialin.dg.thermistors import ThermistorsNames @@ -67,6 +68,11 @@ hd.alarms.alarm_top)) return info +def get_chemical_disinfect_flush_mode_info(): + info = ('State, {}, Overall_elapsed_time, {}, State_elapsed_time, {}, Drain_vol, {:5.3f}, Top_alarm, {}, ' + .format(DGChemDisinfectFlushStates(dg.chemical_disinfect_flush.flush_state).name, dg.chemical_disinfect_flush.overall_elapsed_time, dg.chemical_disinfect_flush.state_elapsed_time, + dg.chemical_disinfect_flush.flush_drain_line_volume_l, hd.alarms.alarm_top)) + return info def get_heat_disinfect_mode_info(): info = ('State, {}, Overall_elapsed_time, {}, State_elapsed_time, {}, Disinfect_elapsed_time, {}, ' @@ -83,10 +89,8 @@ info = ('State, {}, Overall_elapsed_time, {}, State_elapsed_time, {}, Drain_vol, {:5.3f}, Top_alarm, {}, ' .format(DGFlushStates(dg.flush.flush_state).name, dg.flush.overall_elapsed_time, dg.flush.state_elapsed_time, dg.flush.flush_drain_line_volume_l, hd.alarms.alarm_top)) - return info - def get_hd_run_info(): info = ('HD_op_mode, {}, HD_sub_mode, {}, Top_alarm, {}, Target_UF_ml, {:5.3f}, Meas_UF_ml, {:5.3f}, ' 'Wet_test_state, {}, Post_tx_state, {}, Post_tx_drain_state, {}, Prime_state, {}, Pre_Tx_rsrvr_state, {}, ' @@ -556,9 +560,10 @@ ro = get_ro_info() temp = get_temperature_sensors_info() heaters = get_heaters_info() - fans = get_dg_fans_info() + #fans = get_dg_fans_info() - var = disinfect + load_cell + conc + drain + ro + temp + heaters + fans + valves + '\r' + #var = disinfect + load_cell + conc + drain + ro + temp + heaters + fans + valves + '\r' + var = disinfect + load_cell + conc + drain + ro + temp + heaters + valves + '\r' print(var) f.write(var) @@ -579,7 +584,50 @@ dg.hd_proxy.cmd_start_stop_dg_chemical_disinfect(start=False) f.close() +def run_chem_disinfect_flush_mode(): + complete_counter = 1 + f = open("/home/fw/projects/dialin/tests/chem_disinfect_flush_mode.log", "w") + dg.hd_proxy.cmd_start_stop_dg_chemical_disinfect_flush() + #dg.cmd_dg_software_reset_request() + try: + while True: + flush = get_chemical_disinfect_flush_mode_info() + load_cell = get_load_cells_info() + drain = get_drain_states_info() + ro = get_ro_info() + conc = get_concentrate_pumps_info() + valves = get_dg_valves_states() + + var = flush + load_cell + drain + ro + conc + valves + '\r' + + print(var) + f.write(var) + sleep(1) + + # If the mode came back to standby or standby solo + if dg.dg_operation_mode == 3 or dg.dg_operation_mode == 4: + + if complete_counter == 1: + dg.hd_proxy.cmd_start_stop_dg_chemical_disinfect_flush() + # Write a few more complete states to make sure the complete state items are recorded + if complete_counter == 3: + f.close() + #events = dg.events.get_dg_events(2, 60) + #for event in events: + # print(event) + break + + complete_counter += 1 + + except KeyboardInterrupt: + dg.hd_proxy.cmd_start_stop_dg_chemical_disinfect_flush(start=False) + f.close() + #events = dg.events.get_dg_events(2, 50) + #for event in events: + # print(event) + + def cmd_set_disinfect_ui_screen(): hd = HD() sleep(0.5) @@ -607,7 +655,6 @@ valves = get_dg_valves_states() var = flush + uv_reactors + load_cell + drain + ro + conc + valves + '\r' - print(var) f.write(var) sleep(1) @@ -694,6 +741,8 @@ #run_chemical_disinfect() + run_chem_disinfect_flush_mode() + #run_dg() # cmd_set_disinfect_ui_screen() @@ -702,10 +751,10 @@ #collect_hd_treatment() - while True: + #while True: #print(get_hd_fans_info(), get_dg_fans_info(), get_temperature_sensors_info()) - print(get_dg_valves_states()) - sleep(1) + # print(get_dg_valves_states()) + # sleep(1) #while True: # print(dg.rtc.get_rtc_epoch(), hd.rtc.get_rtc_epoch())