Index: dialin/common/dg_defs.py =================================================================== diff -u -r818d439ae9c03d90902013ae07872e4e58f52890 -r0c84db7884e7943ab5a57044a4670f1595ee60df --- dialin/common/dg_defs.py (.../dg_defs.py) (revision 818d439ae9c03d90902013ae07872e4e58f52890) +++ dialin/common/dg_defs.py (.../dg_defs.py) (revision 0c84db7884e7943ab5a57044a4670f1595ee60df) @@ -66,12 +66,14 @@ DG_FAULT_STATE_START = 0 NUM_OF_DG_FAULT_STATES = 1 + @unique class DGSoloStates(DialinEnum): DG_SOLO_STANDBY_STATE_START = 0, DG_SOLO_IDLE_STATE = 1, NUM_OF_DG_SOLO_STANDBY_STATES = 2 + @unique class DGStandByModeStates(DialinEnum): DG_STANDBY_MODE_STATE_START = 0 # Start standby mode state @@ -81,23 +83,25 @@ DG_STANDBY_MODE_STATE_SAMPLE_WATER = 4 # Sample water state NUM_OF_DG_STANDBY_MODE_STATES = 5 # Number of standby mode states + @unique class DGGenIdleModeStates(DialinEnum): DG_GEN_IDLE_MODE_STATE_START = 0 DG_GEN_IDLE_MODE_STATE_FLUSH_WATER = 1 DG_GEN_IDLE_MODE_STATE_HANDLE_BAD_FILL = 2 NUM_OF_DG_GEN_IDLE_MODE_STATES = 3 + @unique class DGGenIdleModeBadFillSubStates(DialinEnum): DG_HANDLE_BAD_FILL_STATE_START = 0 DG_HANDLE_BAD_FILL_STATE_FIRST_DRAIN = 1 DG_HANDLE_BAD_FILL_STATE_FLUSH_FILL = 2 DG_HANDLE_BAD_FILL_STATE_SECOND_DRAIN = 3 DG_HANDLE_BAD_FILL_STATE_REFILL = 4 - DG_HANDLE_BAD_FILL_STATE_CLEAR_ALARM = 5 NUM_OF_DG_HANDLE_BAD_FILL_STATES = 6 + @unique class DGFillModeStates(DialinEnum): DG_FILL_MODE_STATE_START = 0 # Start fill mode state Index: dialin/common/msg_ids.py =================================================================== diff -u -r818d439ae9c03d90902013ae07872e4e58f52890 -r0c84db7884e7943ab5a57044a4670f1595ee60df --- dialin/common/msg_ids.py (.../msg_ids.py) (revision 818d439ae9c03d90902013ae07872e4e58f52890) +++ dialin/common/msg_ids.py (.../msg_ids.py) (revision 0c84db7884e7943ab5a57044a4670f1595ee60df) @@ -323,6 +323,13 @@ MSG_ID_HD_HEPRIN_BOLUS_TARGET_RATE_OVERRIDE = 0x807A 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 @@ -405,8 +412,10 @@ 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 MSG_ID_ACK_MESSAGE_THAT_REQUIRES_ACK = 0xFFFF Index: dialin/dg/conductivity_sensors.py =================================================================== diff -u -r7fda529ba6cd2ca3c64028735979c0b65b32b306 -r0c84db7884e7943ab5a57044a4670f1595ee60df --- dialin/dg/conductivity_sensors.py (.../conductivity_sensors.py) (revision 7fda529ba6cd2ca3c64028735979c0b65b32b306) +++ dialin/dg/conductivity_sensors.py (.../conductivity_sensors.py) (revision 0c84db7884e7943ab5a57044a4670f1595ee60df) @@ -7,8 +7,8 @@ # # @file conductivity_sensors.py # -# @author (last) Micahel Garthwaite -# @date (last) 17-Feb-2022 +# @author (last) Dara Navaei +# @date (last) 31-Mar-2022 # @author (original) Quang Nguyen # @date (original) 20-Jul-2020 # Index: dialin/dg/dialysate_generator.py =================================================================== diff -u -r818d439ae9c03d90902013ae07872e4e58f52890 -r0c84db7884e7943ab5a57044a4670f1595ee60df --- dialin/dg/dialysate_generator.py (.../dialysate_generator.py) (revision 818d439ae9c03d90902013ae07872e4e58f52890) +++ dialin/dg/dialysate_generator.py (.../dialysate_generator.py) (revision 0c84db7884e7943ab5a57044a4670f1595ee60df) @@ -50,6 +50,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 ..protocols.CAN import DenaliCanMessenger, DenaliMessage, DenaliChannels from ..utils import * @@ -190,6 +191,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 -r790e7d358b38c711fe7f4f2a0a4f16e915066d65 -r0c84db7884e7943ab5a57044a4670f1595ee60df --- dialin/utils/conversions.py (.../conversions.py) (revision 790e7d358b38c711fe7f4f2a0a4f16e915066d65) +++ dialin/utils/conversions.py (.../conversions.py) (revision 0c84db7884e7943ab5a57044a4670f1595ee60df) @@ -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: @@ -173,7 +173,7 @@ @param signed: (bool) convert to signed or unsigned value @return: pair of the [value and incremented index by the length. """ - length = 4 # for a integer + length = 4 # for an integer value = bytearray_to_value("i" if signed else "I", buffer[index:index + length]) return value, index + length Index: tests/dg_nvm_scripts.py =================================================================== diff -u -r818d439ae9c03d90902013ae07872e4e58f52890 -r0c84db7884e7943ab5a57044a4670f1595ee60df --- tests/dg_nvm_scripts.py (.../dg_nvm_scripts.py) (revision 818d439ae9c03d90902013ae07872e4e58f52890) +++ tests/dg_nvm_scripts.py (.../dg_nvm_scripts.py) (revision 0c84db7884e7943ab5a57044a4670f1595ee60df) @@ -15,29 +15,61 @@ ############################################################################ from dialin import DG + +def run_sw_configs_commands(): + # NOTE: For further details, please refer to 'Instructions to Change the Software Configurations Dynamically' in + # the development section of the DevOps OneNote file + + # Comment and un-comment any of the functions that you would like to use or you can use your own scripts. + + # Use cmd_get_dg_sw_config_record() to get the software configurations record in an excel + # This function gets an address to locate the report there (i.e. /home/fw/projects/) + # 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() + + # 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 + # example below + #dg.sw_configs.cmd_update_dg_sw_config_record('/home/fw/projects/DG_NV_Records/2022-04-20-DG-SW-CONFIGS-Record.xlsx') + + # Use this function to reset the configuration records to all be 0 + #dg.sw_configs.cmd_reset_dg_sw_config_record() + + +def run_calibration_commands(): + # NOTE: For further details, please refer to 'Instructions to Calibrate a Device Using the Calibration Report' + # in the development section of the DevOps OneNote file + + # Comment and un-comment any of the functions that you would like to use or you can use your own scripts. + + # Use cmd_get_dg_calibration_record_report() to get the calibration record in an excel + # This function gets an address to locate the report there (i.e. /home/fw/projects/) + # 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() + + # 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-06-15-DG-Record.xlsx') + + # For resetting the calibration record to benign values, use the function below + #dg.calibration_record.cmd_reset_dg_calibration_record() + + if __name__ == "__main__": dg = DG(log_level="DEBUG") if dg.cmd_log_in_to_dg(): - # NOTE: For further details, please refer to 'Instructions to Calibrate a Device Using the Calibration Report' - # in the development section of the DevOps OneNote file + #run_sw_configs_commands() - # Comment and un-comment any of the functions that you would like to use or you can use your own scripts. + run_calibration_commands() - # Use cmd_get_dg_calibration_record_report() to get the calibration record in an excel - # This function gets an address to locate the report there (i.e. /home/fw/projects/) - # 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.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') - # 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') - - # For resetting the calibration record to benign values, use the function below - dg.calibration_record.cmd_reset_dg_calibration_record() - Index: tests/dg_tests.py =================================================================== diff -u -r818d439ae9c03d90902013ae07872e4e58f52890 -r0c84db7884e7943ab5a57044a4670f1595ee60df --- tests/dg_tests.py (.../dg_tests.py) (revision 818d439ae9c03d90902013ae07872e4e58f52890) +++ tests/dg_tests.py (.../dg_tests.py) (revision 0c84db7884e7943ab5a57044a4670f1595ee60df) @@ -17,6 +17,7 @@ from dialin.dg.dialysate_generator import DG from dialin.hd.hemodialysis_device import HD +from dialin.ui.hd_simulator import HDSimulator from dialin.common.dg_defs import DGHeatDisinfectStates, DGHeatDisinfectUIStates from dialin.dg.heat_disinfect import HeatCancellationModes from dialin.common.dg_defs import DGChemicalDisinfectStates, DGChemDisinfectUIStates @@ -26,16 +27,22 @@ from dialin.dg.temperatures import DGTemperaturesNames from dialin.dg.dialysate_generator import DGOperationModes from dialin.hd.temperatures import HDTemperaturesNames +from dialin.dg.concentrate_pumps import DGConcentratePumpsStates from dialin.dg.uv_reactors import ReactorsNames -from dialin.common.hd_defs import HDOpModes, HDOpSubModes +from dialin.common.hd_defs import HDOpModes, HDOpSubModes, PreTreatmentWetSelfTesStates, PostTreatmentStates +from dialin.hd.post_treatment import HDPostTreatmentDrainStates from dialin.common.dg_defs import DGEventList 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.pressures import DGPressures from dialin.dg.conductivity_sensors import ConductivitySensorsEnum +from dialin.dg.voltages import DGMonitoredVoltages +from dialin.hd.valves import HDValves +from dialin.hd.pretreatment import PreTreatmentRsrvrState from time import sleep from datetime import datetime import sys @@ -46,14 +53,15 @@ def get_chemical_disinfect_mode_info(): info = ('State, {}, Overall_elapsed_time, {}, State_elapsed_time, {}, Disinfect_elapsed_time, {}, ' 'Cancellation_mode, {}, R1_level, {:5.3f}, R2_level, {:5.3f}, Current_rinse_count, {}, ' - 'Total_rinse_count, {}, UI_state, {}, ' + 'Total_rinse_count, {}, UI_state, {}, Top_alarm, {}, ' .format(DGChemicalDisinfectStates(dg.chemical_disinfect.chemical_disinfect_state).name, dg.chemical_disinfect.overall_elapsed_time, dg.chemical_disinfect.state_elapsed_time, dg.chemical_disinfect.chemical_disinfect_elapsed_time, ChemCancellationModes(dg.chemical_disinfect.cancellation_mode).name, dg.chemical_disinfect.r1_level, dg.chemical_disinfect.r2_level, dg.chemical_disinfect.current_post_rinse_count, dg.chemical_disinfect.target_post_rinse_count, - DGChemDisinfectUIStates(dg.chemical_disinfect.chemical_disinfect_ui_state).name)) + DGChemDisinfectUIStates(dg.chemical_disinfect.chemical_disinfect_ui_state).name, + hd.alarms.alarm_top)) return info @@ -70,9 +78,15 @@ def get_hd_run_info(): info = ('HD_op_mode, {}, HD_sub_mode, {}, Top_alarm, {}, Target_UF_ml, {:5.3f}, Meas_UF_ml, {:5.3f}, ' + 'Wet_test_state, {}, Post_tx_state, {}, Post_tx_drain_state, {}, Prime_state, {}, Pre_Tx_rsrvr_state, {}, ' .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)) + hd.dialysate_outlet_flow.measured_dialysate_outlet_uf_volume, + 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, + hd.pretreatment.pre_treatment_prime_state, + PreTreatmentRsrvrState(hd.pretreatment.pre_treatment_reservoir_state).name)) return info @@ -99,17 +113,12 @@ def get_dg_reservoirs_info(): info = ('Time_rsrvr_cycle, {}, Time_rsrvr_fill_2_switch, {}, Time_uf_decay, {:5.3f}, Temp_uf_fill, {:5.3f}, ' 'Temp_rsrvr_use_actual, {:5.3f}, Temp_rsrvr_end_fill, {:5.3}, Temp_avg_fill, {:5.3f}, ' - 'Temp_last_fill, {:5.3f}, Time_rsrvr_fill, {:5.3f}, drain_flow, {:5.3f}, load_cell_w, {:5.3f}, start_time, {}, ' - .format(dg.reservoirs.time_reservoir_cycle, - dg.reservoirs.time_reservoir_fill_2_switch, - 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, - 0, 0, 0)) + 'Temp_last_fill, {:5.3f}, Time_rsrvr_fill, ' + .format(dg.reservoirs.time_reservoir_cycle, dg.reservoirs.time_reservoir_fill_2_switch, + 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 @@ -182,12 +191,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 @@ -215,22 +226,22 @@ dg.temperatures.temperatures[DGTemperaturesNames.FPGA_BOARD_SENSOR.name], dg.temperatures.temperatures[DGTemperaturesNames.LOAD_CELL_A1_B1.name], dg.temperatures.temperatures[DGTemperaturesNames.LOAD_CELL_A2_B2.name], - dg.fans.rpm_alarm_time_offset)) + dg.fans.rpm_alarm_time)) return info def get_hd_fans_info(): info = ('HD_Fan_DC, {:5.3f}, Target_HD_RPM, {:5.3f}, Inlet1_RPM, {:5.3f}, HD_Board_temp, {:5.3f}, ' 'HD_Power_supply, {:5.3f}, HD_FPGA_temp, {:5.3f}, PBA_ADC_temp, {:5.3f}, Venous_temp, {:5.3f}, ' - 'Arterial_temp, {:5.3f}, RPM_time_offset, {}, Start_time, {} ' + 'Arterial_temp, {:5.3f}, RPM_time_offset, {}, ' .format(hd.fans.duty_cycle, hd.fans.target_rpm, hd.fans.inlet_1_rpm, hd.temperatures.hd_temperatures[HDTemperaturesNames.THERMISTOR_ONBOARD_NTC.name], hd.temperatures.hd_temperatures[HDTemperaturesNames.THERMISTOR_POWER_SUPPLY_1.name], hd.temperatures.hd_temperatures[HDTemperaturesNames.TEMPSENSOR_FPGA_BOARD.name], hd.temperatures.hd_temperatures[HDTemperaturesNames.TEMPSENSOR_PBA_ADC_SENSOR.name], hd.temperatures.hd_temperatures[HDTemperaturesNames.TEMPSENSOR_VENOUS_PRESS_TEMP.name], hd.temperatures.hd_temperatures[HDTemperaturesNames.TEMPSENSOR_ARTERIAL_PRESS_TEMP.name], - hd.fans.rpm_alarm_time_offset, hd.fans.remove)) + hd.fans.rpm_alarm_time)) return info @@ -242,27 +253,40 @@ def get_concentrate_pumps_info(): info = ('Bicarb_tgt_speed, {:5.3f}, Bicarb_speed, {:5.3f}, Acid_tgt_speed, {:5.3f}, Acid_speed, {:5.3f}, ' - 'CPo, {:5.3f}, CD1, {:5.3f}, CD2, {:5.3f}, ' + 'CPo, {:5.3f}, CD1, {:5.3f}, CD2, {:5.3f}, CP1_state, {}, CP2_state, {}, CPi_status, {}, CPo_status, {}, ' + 'CD1_status, {}, CD2_status, {}, CP1_pulse, {:5.3f}, CP2_pulse, {:5.3f}, ' .format(dg.concentrate_pumps.concentrate_pump_cp2_current_set_speed, 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_cd2)) + 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, + dg.conductivity_sensors.cpi_sensor_status, dg.conductivity_sensors.cpo_sensor_status, + dg.conductivity_sensors.cd1_sensor_status, dg.conductivity_sensors.cd2_sensor_status, + dg.concentrate_pumps.cp1_temp_pulse, dg.concentrate_pumps.cp2_temp_pulse)) return info def get_blood_leak_info(): info = ('Blood_leak_status, {}, Blood_leak_zero_status_counter, {}, Blood_leak_zeroed_status, {}, ' 'Blood_leak_detect_set_point, {}, Blood_leak_detect_level, {}, Blood_leak_st_count, {}, ' - 'Blood_leak_led_intensity, {}, ' + 'Blood_leak_led_intensity, {}, Blood_leak_state, {}, ' .format(hd.blood_leak.get_blood_leak_status(), hd.blood_leak.get_blood_leak_zero_status_counter(), hd.blood_leak.get_blood_leak_zeroed_status(), hd.blood_leak.get_blood_leak_detect_set_point(), hd.blood_leak.get_blood_leak_detect_level(), hd.blood_leak.get_blood_leak_st_count(), - hd.blood_leak.get_blood_leak_led_intensity())) + hd.blood_leak.get_blood_leak_led_intensity(), hd.blood_leak.blood_leak_state)) return info +def get_hd_pumps_info(): + info = ('DialIn_tgt_flow, {}, DialIn_meas_flow, {:5.3f}, ' + .format(hd.dialysate_inlet_flow.target_dialysate_inlet_flow_rate, + hd.dialysate_inlet_flow.measured_dialysate_inlet_flow_rate)) + 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}, ' @@ -337,12 +361,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) + """ + + counter = 1 start = False try: @@ -360,19 +389,34 @@ dg_fans = get_dg_fans_info() 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 + '\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 + 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' - 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) + 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 + if start is True: + counter += 1 + + if 10 < counter < 14: + dg.pressures.cmd_pressure_override(dg.pressures.PRESSURE_SENSOR_RO_PUMP_INLET, 14, reset=1) + """ print(var) f.write(var) sleep(1) @@ -384,7 +428,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: @@ -522,7 +566,7 @@ ack = True if ack: if i == 0 and counter == 50: - hd.fans.cmd_fans_rpm_alarm_start_time_offset_override(86401) + hd.fans.cmd_fans_rpm_alarm_start_time_offset(86300) i += 1 elif alarm_state and i > 0: break @@ -565,7 +609,7 @@ ack = True if ack: if i == 0 and counter == 50: - dg.fans.cmd_fans_rpm_alarm_start_time_offset_override(86390) + dg.fans.cmd_fans_rpm_alarm_start_time_offset(86390) i += 1 elif alarm_state and i > 0: break @@ -583,18 +627,27 @@ 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_temperature_sensors_info()) + #print(hd.hd_debug_events) + # sleep(1) + + ui = HDSimulator() + ui.cmd_send_hd_operation_mode(3, 1) + + Index: tests/hd_nvm_scripts.py =================================================================== diff -u -r818d439ae9c03d90902013ae07872e4e58f52890 -r0c84db7884e7943ab5a57044a4670f1595ee60df --- tests/hd_nvm_scripts.py (.../hd_nvm_scripts.py) (revision 818d439ae9c03d90902013ae07872e4e58f52890) +++ tests/hd_nvm_scripts.py (.../hd_nvm_scripts.py) (revision 0c84db7884e7943ab5a57044a4670f1595ee60df) @@ -14,6 +14,7 @@ # ############################################################################ from dialin import HD +from time import sleep def run_sw_configs_commands(): @@ -32,10 +33,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-03-09-HD-SW-CONFIGS-Record_EP_File.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(): @@ -54,10 +55,10 @@ # 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') + hd.calibration_record.cmd_set_hd_calibration_excel_to_fw('/home/fw/projects/HD_NV_Records/2022-05-17-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 +68,12 @@ 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() + + hd.system_record.cmd_request_hd_system_record() + sleep(1) + print(hd.system_record.get_hd_system_record()) +