Index: dialin/common/dg_defs.py =================================================================== diff -u -r053580d8dbe39bf313d61b002d8d41a189d95c39 -r41ce85a8c857a07df740da0e83b28a63bc150e15 --- dialin/common/dg_defs.py (.../dg_defs.py) (revision 053580d8dbe39bf313d61b002d8d41a189d95c39) +++ dialin/common/dg_defs.py (.../dg_defs.py) (revision 41ce85a8c857a07df740da0e83b28a63bc150e15) @@ -7,8 +7,8 @@ # # @file dg_defs.py # -# @author (last) Micahel Garthwaite -# @date (last) 22-Feb-2022 +# @author (last) Hung Nguyen +# @date (last) 24-Mar-2022 # @author (original) Peter Lucia # @date (original) 22-Jun-2021 # Index: dialin/common/msg_ids.py =================================================================== diff -u -r79ed3e7d26065bb2f2155be984c4381175299cd7 -r41ce85a8c857a07df740da0e83b28a63bc150e15 --- dialin/common/msg_ids.py (.../msg_ids.py) (revision 79ed3e7d26065bb2f2155be984c4381175299cd7) +++ dialin/common/msg_ids.py (.../msg_ids.py) (revision 41ce85a8c857a07df740da0e83b28a63bc150e15) @@ -324,6 +324,12 @@ MSG_ID_HD_REQ_CURRENT_TREATMENT_PARAMETERS = 0x807B MSG_ID_HD_RES_CURRENT_TREATMENT_PARAMETERS = 0x807C MSG_ID_HD_SET_FANS_RPM_ALARM_START_TIME_OFFSET = 0x807D + MSG_ID_HD_GET_USAGE_INFO_RECORD = 0x807E + MSG_ID_HD_SET_USAGE_INFO_RECORD = 0x807F + MSG_ID_HD_SEND_USAGE_INFO_RECORD = 0x8080 + MSG_ID_HD_SET_BLOOD_LEAK_2_EMB_MODE = 0x8081 + MSG_ID_HD_SET_BLOOD_LEAK_EMB_MODE_COMMAND = 0x8082 + MSG_ID_HD_SEND_BLOOD_LEAK_EMB_MODE_RESPONSE = 0x8083 MSG_ID_DG_TESTER_LOGIN_REQUEST = 0xA000 MSG_ID_DG_ALARM_STATE_OVERRIDE = 0xA001 @@ -406,6 +412,9 @@ MSG_ID_DG_USED_BICARB_VOLUME_ML_OVERRIDE = 0xA050 MSG_ID_FILL_MODE_DATA_PUBLISH_INTERVAL_OVERRIDE = 0xA051 MSG_ID_BAD_FILL_STATES_PUBLISH_INTERVAL_OVERRIDE = 0xA052 + MSG_ID_DG_GET_USAGE_INFO_RECORD = 0xA053 + MSG_ID_DG_SET_USAGE_INFO_RECORD = 0xA054 + MSG_ID_DG_SEND_USAGE_INFO_RECORD = 0xA055 MSG_ID_HD_DEBUG_EVENT = 0xFFF1 MSG_ID_DG_DEBUG_EVENT = 0xFFF2 Index: dialin/dg/dialysate_generator.py =================================================================== diff -u -r79ed3e7d26065bb2f2155be984c4381175299cd7 -r41ce85a8c857a07df740da0e83b28a63bc150e15 --- dialin/dg/dialysate_generator.py (.../dialysate_generator.py) (revision 79ed3e7d26065bb2f2155be984c4381175299cd7) +++ dialin/dg/dialysate_generator.py (.../dialysate_generator.py) (revision 41ce85a8c857a07df740da0e83b28a63bc150e15) @@ -48,6 +48,7 @@ from .voltages import DGVoltages from .events import DGEvents from .sw_configs import DGSoftwareConfigs +from .usage_info_record import DGUsageNVRecord from ..common.msg_defs import MsgIds, MsgFieldPositions from enum import unique from .constants import NO_RESET @@ -189,6 +190,7 @@ self.voltages = DGVoltages(self.can_interface, self.logger) self.events = DGEvents(self.can_interface, self.logger) self.sw_configs = DGSoftwareConfigs(self.can_interface, self.logger) + self.usage_record = DGUsageNVRecord(self.can_interface, self.logger) def get_version(self): """ Index: dialin/utils/conversions.py =================================================================== diff -u -r79ed3e7d26065bb2f2155be984c4381175299cd7 -r41ce85a8c857a07df740da0e83b28a63bc150e15 --- dialin/utils/conversions.py (.../conversions.py) (revision 79ed3e7d26065bb2f2155be984c4381175299cd7) +++ dialin/utils/conversions.py (.../conversions.py) (revision 41ce85a8c857a07df740da0e83b28a63bc150e15) @@ -28,7 +28,7 @@ """ if type(val) != int: raise ValueError("Expected integer but received {0} with type {1}".format(val, type(val))) - return struct.pack(" bytes: Index: tests/dg_nvm_scripts.py =================================================================== diff -u -r79ed3e7d26065bb2f2155be984c4381175299cd7 -r41ce85a8c857a07df740da0e83b28a63bc150e15 --- tests/dg_nvm_scripts.py (.../dg_nvm_scripts.py) (revision 79ed3e7d26065bb2f2155be984c4381175299cd7) +++ tests/dg_nvm_scripts.py (.../dg_nvm_scripts.py) (revision 41ce85a8c857a07df740da0e83b28a63bc150e15) @@ -27,7 +27,7 @@ # It creates a folder called DG_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. - #dg.sw_configs.cmd_get_dg_sw_config_record() + dg.sw_configs.cmd_get_dg_sw_config_record() # Use cmd_set_dg_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 @@ -49,15 +49,15 @@ # It creates a folder called DG_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 you computer. - # dg.calibration_record.cmd_get_dg_calibration_record_report() + #dg.calibration_record.cmd_get_dg_calibration_record_report() # Use cmd_set_dg_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 - # dg.calibration_record.cmd_set_dg_calibration_excel_to_fw('/home/fw/projects/DG_NV_Records/2022-03-31-DG-Record.xlsx') + dg.calibration_record.cmd_set_dg_calibration_excel_to_fw('/home/fw/projects/DG_NV_Records/2022-05-03-DG-Record.xlsx') # For resetting the calibration record to benign values, use the function below - dg.calibration_record.cmd_reset_dg_calibration_record() + #dg.calibration_record.cmd_reset_dg_calibration_record() if __name__ == "__main__": @@ -66,7 +66,10 @@ if dg.cmd_log_in_to_dg(): - run_sw_configs_commands() + #run_sw_configs_commands() - #run_calibration_commands() + run_calibration_commands() + #dg.usage_record.cmd_get_dg_usage_info_record() + #dg.usage_record.cmd_update_dg_usage_info_record('/home/fw/projects/DG_NV_Records/2022-04-22-DG-Record.xlsx') + Index: tests/dg_tests.py =================================================================== diff -u -r79ed3e7d26065bb2f2155be984c4381175299cd7 -r41ce85a8c857a07df740da0e83b28a63bc150e15 --- tests/dg_tests.py (.../dg_tests.py) (revision 79ed3e7d26065bb2f2155be984c4381175299cd7) +++ tests/dg_tests.py (.../dg_tests.py) (revision 41ce85a8c857a07df740da0e83b28a63bc150e15) @@ -39,6 +39,7 @@ from dialin.dg.fans import DGFansNames from dialin.dg.pressures import DGPressures from dialin.dg.conductivity_sensors import ConductivitySensorsEnum +from dialin.dg.voltages import DGMonitoredVoltages from time import sleep from datetime import datetime import sys @@ -78,7 +79,7 @@ .format(HDOpModes(hd.hd_operation_mode).name, hd.hd_operation_sub_mode, hd.alarms.alarm_top, hd.dialysate_outlet_flow.reference_dialysate_outlet_uf_volume, hd.dialysate_outlet_flow.measured_dialysate_outlet_uf_volume, - PreTreatmentWetSelfTesStates(hd.pretreatment.pre_treatment_wet_self_test_state).name, + 0, #PreTreatmentWetSelfTesStates(hd.pretreatment.pre_treatment_wet_self_test_state).name, PostTreatmentStates(hd.post_treatment.post_treatment_sub_mode).name, HDPostTreatmentDrainStates(hd.post_treatment.post_treatment_drain_state).name)) return info @@ -185,12 +186,14 @@ def get_heaters_info(): info = ('Pri_main_DC, {:5.3f}, Pri_state, {}, Trimmer_DC, {:5.3f}, Trimmer_state, {}, ' 'Primary_target_temp, {:5.3f}, Trimmer_target_temp, {:5.3f}, Primary_eff, {:5.3f}, Dia_flow, {:5.3f}, ' - 'Interim_int_temp, {:5.3f}, Heater_RO_flow, {:5.3f}, '. + 'Interim_int_temp, {:5.3f}, Heater_RO_flow, {:5.3f}, Primary_volt, {:5.3f}, Trimmer_volt, {:5.3f}, '. format(dg.heaters.main_primary_heater_duty_cycle, dg.heaters.primary_heater_state, dg.heaters.trimmer_heater_duty_cycle, dg.heaters.trimmer_heater_state, dg.heaters.primary_heaters_target_temperature, dg.heaters.trimmer_heater_target_temperature, dg.heaters.primary_efficiency, dg.heaters.temporary_remove_flow, - dg.heaters.temporary_internal_target, dg.heaters.temporary_target_ro_flow)) + dg.heaters.temporary_internal_target, dg.heaters.temporary_target_ro_flow, + dg.voltages.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_24V_PRIM_HTR_V.value], + dg.voltages.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_24V_TRIM_HTR_V.value])) return info @@ -353,19 +356,17 @@ 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) - #dg.dialysate_fill.cmd_used_bicarb_volume_override(3700.0) - #sleep(1) - + dg.dialysate_fill.cmd_used_bicarb_volume_override(3700.0) + sleep(1) + """ counter = 1 start = False - """ try: while True: @@ -387,21 +388,22 @@ 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 + fill_info + '\r' - """ + temp + heaters + conc_pumps + dg_fans + valves + blood_leak + hd_pumps + fill_info + idle_bad_fill + '\r' + + if hd.alarms.get_alarm_state(97) and start is False: + dg.conductivity_sensors.cmd_conductivity_sensor_override(ConductivitySensorsEnum.CD2.value, 13700.00) + sleep(0.2) + dg.conductivity_sensors.cmd_conductivity_sensor_override(ConductivitySensorsEnum.CD1.value, 11600.00) + start = True + + """ var = str(datetime.now()) + ', ' + hd_run + dg_run + load_cell + drain + ro + conc_pumps + valves + \ idle_bad_fill + fill_info + '\r' -<<<<<<< HEAD - #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 -======= if dg.dg_operation_mode == 6 and dg.dg_operation_sub_mode == 4 and start is False: #dg.conductivity_sensors.cmd_conductivity_sensor_override(ConductivitySensorsEnum.CD2.value, 12000.00) dg.pressures.cmd_pressure_override(dg.pressures.PRESSURE_SENSOR_RO_PUMP_INLET, 14) start = True ->>>>>>> DEN-12224-dg_hd_dev-switches-monitor if start is True: counter += 1 @@ -420,7 +422,7 @@ def collect_hd_treatment(): f = open("/home/fw/projects/dialin/tests/treatment_run_hd.log", "w") - hd.cmd_hd_software_reset_request() + #hd.cmd_hd_software_reset_request() try: while True: @@ -619,19 +621,24 @@ hd.cmd_log_in_to_hd() sleep(1) - # run_heat_disinfect() + #run_heat_disinfect() # run_chemical_disinfect() # run_dg() # cmd_set_disinfect_ui_screen() - collect_treatment_data() + #collect_treatment_data() - # collect_hd_treatment() + #collect_hd_treatment() # test_hd_fans_alarms() # test_dg_fans_alarms() + while True: + print(get_hd_fans_info()) + sleep(1) + #dg.ro_pump.cmd_ro_pump_measured_flow_rate_override(0.0, reset=1) + Index: tests/hd_nvm_scripts.py =================================================================== diff -u -r79ed3e7d26065bb2f2155be984c4381175299cd7 -r41ce85a8c857a07df740da0e83b28a63bc150e15 --- tests/hd_nvm_scripts.py (.../hd_nvm_scripts.py) (revision 79ed3e7d26065bb2f2155be984c4381175299cd7) +++ tests/hd_nvm_scripts.py (.../hd_nvm_scripts.py) (revision 41ce85a8c857a07df740da0e83b28a63bc150e15) @@ -32,10 +32,10 @@ # 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-04-20-HD-SW-CONFIGS-Record.xlsx') + hd.sw_configs.cmd_update_hd_sw_config_record('/home/fw/projects/HD_NV_Records/2022-04-25-HD-SW-CONFIGS-Record.xlsx') # Use this function to reset the configuration records to all be 0 - # hd.sw_configs.cmd_reset_hd_sw_config_record() + #hd.sw_configs.cmd_reset_hd_sw_config_record() def run_calibration_commands(): @@ -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__": @@ -71,3 +71,4 @@ # Comment this function if not needed #run_calibration_commands() +