Index: tests/dg_tests.py =================================================================== diff -u -r4a0c6600b52ec965a6625a428de986e7040ae2c9 -r0849ee6900414beac70bc5b2016478dd3c8553b6 --- tests/dg_tests.py (.../dg_tests.py) (revision 4a0c6600b52ec965a6625a428de986e7040ae2c9) +++ tests/dg_tests.py (.../dg_tests.py) (revision 0849ee6900414beac70bc5b2016478dd3c8553b6) @@ -8,7 +8,7 @@ # @file dg_tests.py # # @author (last) Dara Navaei -# @date (last) 26-Apr-2023 +# @date (last) 27-Apr-2023 # @author (original) Dara Navaei # @date (original) 16-Jan-2022 # @@ -326,8 +326,8 @@ dg.concentrate_pumps.concentrate_pump_cp2_measured_speed, dg.concentrate_pumps.concentrate_pump_cp1_current_set_speed, dg.concentrate_pumps.concentrate_pump_cp1_measured_speed, - dg.conductivity_sensors.conductivity_sensor_cpo, - dg.conductivity_sensors.conductivity_sensor_cd1, + dg.conductivity_sensors.conductivity_sensor_cpi, + dg.conductivity_sensors.conductivity_sensor_cpo, dg.conductivity_sensors.conductivity_sensor_cd1, dg.conductivity_sensors.conductivity_sensor_cd2, DGConcentratePumpsStates(dg.concentrate_pumps.concentrate_pump_cp1_current_state).name, DGConcentratePumpsStates(dg.concentrate_pumps.concentrate_pump_cp2_current_state).name, @@ -376,7 +376,7 @@ def get_dg_idle_bad_fill_info(): info = ('Bad_fill_state, {}, ' - .format(DGGenIdleModeBadFillSubStates(dg.gen_idle.sub_state).name)) + .format(DGGenIdleModeBadFillSubStates(dg.gen_idle.bad_fill_state).name)) return info @@ -394,63 +394,6 @@ return info -def run_dg(): - counter = 1 - timer = 0.1 - sleep_time = 1 - run_number = 1 - recirc_delay = 1 - f = open("/home/fw/projects/dialin/tests/run_dg.log", "w") - - dg.hd_proxy.cmd_start_stop_dg() - sleep(1) - - dg.heaters.cmd_start_stop_primary_heater() - sleep(0.1) - - try: - while True: - dg_run = get_dg_run_info() - temperature = get_temperature_sensors_info() - heaters = get_heaters_with_no_temp_info() - load_cell = get_load_cells_info() - drain = get_drain_states_info() - ro = get_ro_info() - dg_rsrvrs = get_dg_reservoirs_info() - fans = get_dg_fans_info() - conc = get_concentrate_pumps_info() - valves = get_dg_valves_states() - - var = str(datetime.now()) + ', ' + dg_run + \ - temperature + heaters + load_cell + drain + ro + dg_rsrvrs + conc + fans + valves + '\r' - - print(var) - f.write(var) - - if DGOperationModes(dg.dg_operation_mode).name == DGOperationModes.DG_OP_MODE_GEN_IDLE.name and \ - dg.dg_operation_sub_mode == 2 and counter == 1: - dg.hd_proxy.cmd_drain(tare_load_cell=True) - counter += 1 - timer = 1 - - elif DGOperationModes(dg.dg_operation_mode).name == DGOperationModes.DG_OP_MODE_GEN_IDLE.name and \ - dg.dg_operation_sub_mode == 2 and counter == 2: - counter += 1 - dg.hd_proxy.cmd_fill() - - elif DGOperationModes(dg.dg_operation_mode).name == DGOperationModes.DG_OP_MODE_GEN_IDLE.name and \ - dg.dg_operation_sub_mode == 2 and counter == 3: - counter = 1 - run_number += 1 - - sleep(sleep_time) - - except KeyboardInterrupt: - dg.hd_proxy.cmd_start_stop_dg(start=False) - f.close() - pass - - def collect_treatment_data(): address = os.path.join(os.getcwd(), "treatment_run.log") f = open(address, "w") @@ -465,7 +408,6 @@ dg.dialysate_fill.cmd_used_bicarb_volume_override(3700.0) sleep(1) """ - counter = 1 start = False sleep_time = 1 @@ -665,27 +607,50 @@ # print(event) +def run_test_configs(): + + counter = 1 + reset_val = 0 + print(hex(dg.test_configs.cmd_get_test_config_status(DGTestConfigOptions.TEST_CONFIG_ENABLE_MIXING_WITH_WATER.value))) + + while True: + if counter == 1: + dg.test_configs.cmd_set_test_config(DGTestConfigOptions.TEST_CONFIG_ENABLE_MIXING_WITH_WATER.value, reset=reset_val) + counter += 1 + if counter > 10: + #hd.test_configs.cmd_request_test_config_status_from_fw() + dg.test_configs.cmd_request_test_config_status_from_fw() + + while True: + #print(hex(hd.test_configs.hd_test_configs[HDTestConfigOptions.TEST_CONFIG_USE_WORN_CARTRIDGE.name])) + print(hex(dg.test_configs.dg_test_configs[DGTestConfigOptions.TEST_CONFIG_ENABLE_MIXING_WITH_WATER.name]), reset_val) + #print((dg.test_configs.dg_test_configs), reset_val) + + if counter > 20: + + if reset_val == 1: + reset_val = 0 + else: + reset_val = 1 + counter = 1 + break + counter += 1 + sleep(0.1) + + sleep(0.1) + + if __name__ == "__main__": dg = DG(log_level='DEBUG') + #dg = DG() dg.cmd_log_in_to_dg() sleep(1) hd = HD(log_level='DEBUG') hd.cmd_log_in_to_hd() sleep(1) - """ - print(dg.test_configs.dg_test_configs) - print(hex(dg.test_configs.cmd_get_test_config_status(DGTestConfigOptions.TEST_CONFIG_ENABLE_MIXING_WITH_WATER.value))) - dg.test_configs.cmd_set_test_config(DGTestConfigOptions.TEST_CONFIG_ENABLE_MIXING_WITH_WATER.value, reset=0) - sleep(1) - """ - dg.test_configs.cmd_request_test_config_status_from_fw() + run_test_configs() - while True: - print(hex(dg.test_configs.cmd_get_test_config_status( - DGTestConfigOptions.TEST_CONFIG_ENABLE_MIXING_WITH_WATER.value))) - sleep(1) - #run_heat_disinfect() #run_flush_mode() @@ -698,7 +663,7 @@ # cmd_set_disinfect_ui_screen() - collect_treatment_data() + #collect_treatment_data() #collect_hd_treatment()