Index: dialin/dg/conductivity_sensors.py =================================================================== diff -u -r3a70bfb451b74106348c064c34f19934aadd9119 -r4d5e17118983a1cc04231f4c423588fad24816b4 --- dialin/dg/conductivity_sensors.py (.../conductivity_sensors.py) (revision 3a70bfb451b74106348c064c34f19934aadd9119) +++ dialin/dg/conductivity_sensors.py (.../conductivity_sensors.py) (revision 4d5e17118983a1cc04231f4c423588fad24816b4) @@ -108,25 +108,27 @@ cd2 = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_5:MsgFieldPositions.END_POS_FIELD_5])) + """ raw_cpi = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_6:MsgFieldPositions.END_POS_FIELD_6])) raw_cpo = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_7:MsgFieldPositions.END_POS_FIELD_7])) raw_cd1 = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_8:MsgFieldPositions.END_POS_FIELD_8])) raw_cd2 = struct.unpack('f', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_9:MsgFieldPositions.END_POS_FIELD_9])) + message['message'][MsgFieldPositions.START_POS_FIELD_9:MsgFieldPositions.END_POS_FIELD_9])) """ + self.ro_rejection_ratio = ro_rejection_ratio[0] self.conductivity_sensor_cpi = cpi[0] self.conductivity_sensor_cpo = cpo[0] self.conductivity_sensor_cd1 = cd1[0] self.conductivity_sensor_cd2 = cd2[0] - self.raw_conductivity_sensor_cpi = raw_cpi[0] - self.raw_conductivity_sensor_cpo = raw_cpo[0] - self.raw_conductivity_sensor_cd1 = raw_cd1[0] - self.raw_conductivity_sensor_cd2 = raw_cd2[0] + #self.raw_conductivity_sensor_cpi = raw_cpi[0] + #self.raw_conductivity_sensor_cpo = raw_cpo[0] + #self.raw_conductivity_sensor_cd1 = raw_cd1[0] + #self.raw_conductivity_sensor_cd2 = raw_cd2[0] def cmd_conductivity_sensor_override(self, sensor: int, conductivity: float, reset: int = NO_RESET) -> int: """ Index: dialin/dg/dialysate_fill.py =================================================================== diff -u -re5058835522499573ba251c093ae3c56deaf2149 -r4d5e17118983a1cc04231f4c423588fad24816b4 --- dialin/dg/dialysate_fill.py (.../dialysate_fill.py) (revision e5058835522499573ba251c093ae3c56deaf2149) +++ dialin/dg/dialysate_fill.py (.../dialysate_fill.py) (revision 4d5e17118983a1cc04231f4c423588fad24816b4) @@ -85,7 +85,7 @@ message['message'][MsgFieldPositions.START_POS_FIELD_1:MsgFieldPositions.END_POS_FIELD_1]))[0] self.avg_bicarb = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_2:MsgFieldPositions.END_POS_FIELD_2]))[0] - self.first_fill = struct.unpack('f', bytearray( + self.first_fill = struct.unpack('i', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_3:MsgFieldPositions.END_POS_FIELD_3]))[0] self.pctDiffConduct = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_4:MsgFieldPositions.END_POS_FIELD_4]))[0] Index: dialin/dg/gen_idle.py =================================================================== diff -u -re5058835522499573ba251c093ae3c56deaf2149 -r4d5e17118983a1cc04231f4c423588fad24816b4 --- dialin/dg/gen_idle.py (.../gen_idle.py) (revision e5058835522499573ba251c093ae3c56deaf2149) +++ dialin/dg/gen_idle.py (.../gen_idle.py) (revision 4d5e17118983a1cc04231f4c423588fad24816b4) @@ -66,7 +66,7 @@ @param message: published bad fill sub-states message @return: none """ - state = struct.unpack('f', bytearray( + state = struct.unpack('i', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_1:MsgFieldPositions.END_POS_FIELD_1])) self.sub_state = state[0] 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) Index: tests/hd_nvm_scripts.py =================================================================== diff -u -r88b4967ce6b9ac816ac21b26326450de4b540887 -r4d5e17118983a1cc04231f4c423588fad24816b4 --- tests/hd_nvm_scripts.py (.../hd_nvm_scripts.py) (revision 88b4967ce6b9ac816ac21b26326450de4b540887) +++ tests/hd_nvm_scripts.py (.../hd_nvm_scripts.py) (revision 4d5e17118983a1cc04231f4c423588fad24816b4) @@ -27,12 +27,12 @@ # It creates a folder called HD_NV_Records in the destination that is called # If no address is provided, the default location is one folder above the dialin folder wherever it is installed # in your computer. - hd.sw_configs.cmd_get_hd_sw_config_record() + #hd.sw_configs.cmd_get_hd_sw_config_record() # Use cmd_update_hd_sw_config_record() set the changes back to firmware # This function requires an address for the excel report. Use the absolute address of your excel report like the # example below - #hd.sw_configs.cmd_update_hd_sw_config_record('/home/fw/projects/HD_NV_Records/2022-02-14-HD-SW-CONFIGS-Record.xlsx') + hd.sw_configs.cmd_update_hd_sw_config_record('/home/fw/projects/HD_NV_Records/2022-03-09-HD-SW-CONFIGS-Record_EP_File.xlsx') # Use this function to reset the configuration records to all be 0 # hd.sw_configs.cmd_reset_hd_sw_config_record() @@ -49,15 +49,15 @@ # It creates a folder called HD_NV_Records in the destination that is called # If no address is provided, the default location is one folder above the dialin folder wherever it is installed # in your computer. - hd.calibration_record.cmd_get_hd_calibration_record_report() + #hd.calibration_record.cmd_get_hd_calibration_record_report() # Use cmd_set_hd_calibration_excel_to_fw() set the changes back to firmware # This function requires an address for the excel report. Use the absolute address of your excel report like the # example below #hd.calibration_record.cmd_set_hd_calibration_excel_to_fw('/home/fw/projects/HD_NV_Records/2022-02-21-HD-Record.xlsx') # For resetting the calibration record to benign values, use the function below - #hd.calibration_record.cmd_reset_hd_calibration_record() + hd.calibration_record.cmd_reset_hd_calibration_record() if __name__ == "__main__": @@ -67,7 +67,7 @@ if hd.cmd_log_in_to_hd(): # Comment this function if not needed - #run_sw_configs_commands() + run_sw_configs_commands() # Comment this function if not needed - run_calibration_commands() + #run_calibration_commands()