Index: tests/dg_tests.py =================================================================== diff -u -r7fda529ba6cd2ca3c64028735979c0b65b32b306 -r4a30e790387316388d3b8a1603f5c6b4d46ac011 --- tests/dg_tests.py (.../dg_tests.py) (revision 7fda529ba6cd2ca3c64028735979c0b65b32b306) +++ tests/dg_tests.py (.../dg_tests.py) (revision 4a30e790387316388d3b8a1603f5c6b4d46ac011) @@ -33,8 +33,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 @@ -106,6 +108,7 @@ dg.reservoirs.time_uf_decay, dg.reservoirs.temp_uf_fill, dg.reservoirs.temp_reservoir_use_actual, dg.reservoirs.temp_reservoir_end_fill, dg.reservoirs.temp_avg_fill, dg.reservoirs.temp_last_fill, dg.reservoirs.time_rsrvr_fill)) + return info @@ -158,11 +161,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 @@ -272,6 +275,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 @@ -332,6 +350,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() @@ -348,10 +373,19 @@ conc_pumps = get_concentrate_pumps_info() blood_leak = get_blood_leak_info() hd_pumps = get_hd_pumps_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 + hd_pumps + '\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 + hd_pumps + '\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) @@ -570,19 +604,10 @@ # cmd_set_disinfect_ui_screen() - #collect_treatment_data() + collect_treatment_data() # collect_hd_treatment() - #dg.switches.cmd_dg_switch_status_override(0, 0) - #sleep(1) - #dg.switches.cmd_dg_switch_status_override(1, 0) + # test_hd_fans_alarms() - while True: - #print(dg.switches.get_switches_status()) - print(get_hd_fans_info()) - sleep(1) - - test_hd_fans_alarms() - # test_dg_fans_alarms()