Index: tests/dg_tests.py =================================================================== diff -u -r88b4967ce6b9ac816ac21b26326450de4b540887 -r4d5e17118983a1cc04231f4c423588fad24816b4 --- tests/dg_tests.py (.../dg_tests.py) (revision 88b4967ce6b9ac816ac21b26326450de4b540887) +++ tests/dg_tests.py (.../dg_tests.py) (revision 4d5e17118983a1cc04231f4c423588fad24816b4) @@ -32,8 +32,10 @@ from dialin.common.hd_defs import HDEventList from dialin.hd.reservoirs import HDReservoirStates from dialin.dg.reservoirs import DGReservoirsNames +from dialin.common.dg_defs import DGGenIdleModeBadFillSubStates from dialin.common.alarm_defs import AlarmList from dialin.dg.fans import DGFansNames +from dialin.dg.conductivity_sensors import ConductivitySensorsEnum from time import sleep from datetime import datetime import sys @@ -107,7 +109,7 @@ dg.reservoirs.temp_avg_fill, dg.reservoirs.temp_last_fill, dg.reservoirs.time_rsrvr_fill, - dg.reservoirs.drainFlow, dg.reservoirs.previousLoad, dg.reservoirs.startTime)) + 0, 0, 0)) return info @@ -261,6 +263,20 @@ return info +def get_dg_fill_info(): + info = ('Avg_acid_cond, {:5.3f}, Avg_bicarb_cond, {:5.3f}, Is_this_first_fill, {}, Diff_cond_pct, {:5.3f}, ' + 'Used_acid, {:5.3f}, Used_bicarb, {:5.3f}, ' + .format(dg.dialysate_fill.avg_acid, dg.dialysate_fill.avg_bicarb, dg.dialysate_fill.first_fill, + dg.dialysate_fill.pctDiffConduct, dg.dialysate_fill.used_acid, dg.dialysate_fill.used_acid)) + return info + + +def get_dg_idle_bad_fill_info(): + info = ('Bad_fill_state, {}, ' + .format(DGGenIdleModeBadFillSubStates(dg.gen_idle.sub_state).name)) + return info + + def run_dg(): counter = 1 timer = 0.1 @@ -321,6 +337,13 @@ def collect_treatment_data(): f = open("/home/fw/projects/dialin/tests/treatment_run.log", "w") + dg.conductivity_sensors.cmd_conductivity_sensor_override(ConductivitySensorsEnum.CD2.value, 6900.00) + sleep(1) + dg.conductivity_sensors.cmd_conductivity_sensor_override(ConductivitySensorsEnum.CD1.value, 12100.00) + sleep(1) + + start = False + try: while True: hd_run = get_hd_run_info() @@ -336,10 +359,19 @@ dg_fans = get_dg_fans_info() conc_pumps = get_concentrate_pumps_info() blood_leak = get_blood_leak_info() + fill_info = get_dg_fill_info() + idle_bad_fill = get_dg_idle_bad_fill_info() - var = str(datetime.now()) + ', ' + hd_run + dg_run + hd_rsrvrs + dg_rsrvrs + load_cell + drain + ro + \ - temp + heaters + conc_pumps + dg_fans + valves + blood_leak + '\r' + #var = str(datetime.now()) + ', ' + hd_run + dg_run + hd_rsrvrs + dg_rsrvrs + load_cell + drain + ro + \ + # temp + heaters + conc_pumps + dg_fans + valves + blood_leak + '\r' + var = str(datetime.now()) + ', ' + hd_run + dg_run + load_cell + drain + ro + conc_pumps + valves + \ + idle_bad_fill + fill_info + '\r' + + if dg.dg_operation_mode == 6 and dg.dg_operation_sub_mode == 5 and start is False: + dg.conductivity_sensors.cmd_conductivity_sensor_override(ConductivitySensorsEnum.CD2.value, 12000.00) + start = True + print(var) f.write(var) sleep(1) @@ -558,16 +590,10 @@ # cmd_set_disinfect_ui_screen() - # collect_treatment_data() + collect_treatment_data() # collect_hd_treatment() # test_hd_fans_alarms() # test_dg_fans_alarms() - - while True: - #print(get_dg_fans_info()) - for i in range(0, 18): - print(dg.temperatures.get_temperatures_values(i)) - sleep(1)