Index: tests/dg_tests.py =================================================================== diff -u -r88b4967ce6b9ac816ac21b26326450de4b540887 -r6f7e1ee38afb4fba5bedfcfcea5f4b5ee631ac95 --- tests/dg_tests.py (.../dg_tests.py) (revision 88b4967ce6b9ac816ac21b26326450de4b540887) +++ tests/dg_tests.py (.../dg_tests.py) (revision 6f7e1ee38afb4fba5bedfcfcea5f4b5ee631ac95) @@ -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 @@ -160,11 +162,11 @@ def get_ro_info(): info = ('RO, {}, PPi, {:5.3f}, PPo, {:5.3f}, PWM, {:5.3f}, Flow, {:5.3f}, Tgt_flow, {:5.3f}, Dia_flow, {:5.3f}, ' - 'Feedback_PWM, {:5.3f}, Raw_flow, {:5.3f}, ' + 'Feedback_PWM, {:5.3f}, flow_with_conc_pumps, {:5.3f}, ' .format(dg.ro_pump.ro_pump_state, dg.pressures.ro_pump_inlet_pressure, dg.pressures.ro_pump_outlet_pressure, dg.ro_pump.pwm_duty_cycle_pct, dg.ro_pump.measured_flow_rate_lpm, dg.ro_pump.target_flow_lpm, dg.dialysate_flow_sensor.flow_rate, - dg.ro_pump.feedback_duty_cycle_pct, dg.ro_pump.measured_raw_flow_rate_mlp)) + dg.ro_pump.feedback_duty_cycle_pct, dg.ro_pump.measured_raw_flow_rate_with_conc_pumps_mlp)) return info @@ -261,6 +263,21 @@ 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}, Total_vol, {: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, + dg.dialysate_fill.total_volume)) + 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 +338,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 +360,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 +591,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)