# -*- coding: utf-8 -*- ## # Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. # copyright # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, # IN PART OR IN WHOLE, # WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # # file tst_UI_log_verification # date 2022/04/09 # author Bhavana Savanth # author Amol Pandharinath Shinde # author Amrita Debnath # author Sai Chaitanya Ela # author Akshay Rajaram # # NOTE: # This test verifies the logs for the messages provided from dialin.ui.hd_simulator_alarms import HDAlarmsSimulator import logging from dialin.protocols.CAN import DenaliCanMessenger from dialin.ui import HDSimulator from dialin.ui import DGSimulator from dialin.ui import utils from configuration import utility from configuration import config import builtins from dialin.common.msg_ids import MsgIds from dialin.common import msg_defs # from dialin.utils import YES logger= logging.getLogger("INFO") messenger= DenaliCanMessenger('can0') hd_alarm= HDAlarmsSimulator(can_interface=messenger, logger=logger) hd_simulator = HDSimulator() dg_simulator = DGSimulator() NUMBER_OF_OPMODE = 9 NUMBER_OF_TREATMENTMODES = 3 def verify_log(msg_id,msg = None, param = None): utils.waitForGUI(0.2) ack = False if not msg_id in msg_defs.ACK_NOT_REQUIRED: ack = True message_extracted = utility.get_current_log_details(message_ack = ack, message_text = msg) if ack == True: test.verify(config.ACK_REQ_STATUS in message_extracted, "ack request is verified") test.verify(config.ACK_BAK_STATUS in message_extracted, "ack back is verified") message_id_hex = builtins.hex(builtins.int(msg_id)) message_id_str = builtins.str(message_id_hex) test.verify(message_id_str in message_extracted, "message ID is verified") if param != None: test.verify(param in message_extracted, "parameters are verified") test.log(str(message_extracted)) def main(): utils.tstStart(__file__) startApplication(config.AUT_NAME) #HD Broadcast #0x0D00 hd_simulator.cmd_set_treatment_time(200,60,0) verify_log(msg_id = MsgIds.MSG_ID_TREATMENT_TIME.value, msg = "TreatmentTime", param = [200,60,0]) #0x0500 hd_simulator.cmd_set_treatment_blood_flow_rate(flow_set_pt=20, measured_flow=10.5, rot_speed = 112.2 , mot_speed = 120.3, mc_speed = 100.0, mc_current = 12.5, pwm = 32.3, rotor_count = 30) verify_log(msg_id = MsgIds.MSG_ID_BLOOD_FLOW_DATA.value, msg = "BloodFlow", param = [20,10.5,112.2,120.3,100.0,12.5,32.3,30]) #0x0800 hd_simulator.cmd_set_treatment_dialysate_flow_rate(flow_set_pt=20, measured_flow=10.5, rot_speed = 112.2 , mot_speed = 120.3, mc_speed = 100.0, mc_current = 12.5, pwm = 32.3) verify_log(msg_id = MsgIds.MSG_ID_DIALYSATE_FLOW_DATA.value, msg = "DialysateFlow", param = [20,10.5,112.2,120.3,100.0,12.5,32.3]) #0x0900 hd_simulator.cmd_set_pressure_occlusion_data(arterial_prs = 54.5, venous_prs = 20.1, blood_pump_occlusion = 3, dialysate_inlet_pump_occlusion = 2, dialysate_outlet_pump_occlusion = 5) verify_log(msg_id = MsgIds.MSG_ID_PRESSURE_OCCLUSION_DATA.value, msg = "Pressure/Occlusion", param = [54.5,20.1,3,2,5]) #0x0B00 hd_simulator.cmd_set_treatment_ultrafiltration_outlet_flow_data(ref_uf_vol = 77.5, measured_uf_vol = 22.6, rot_speed = 54.0, mot_speed = 66.2, mc_speed = 33.3, mc_current = 21.2, pwm = 322.2) verify_log(msg_id = MsgIds.MSG_ID_DIALYSATE_OUT_FLOW_DATA.value, msg = "OutletFlow",param = [77.5,22.6,54.0,66.2,33.3,21.2,322.2]) #0x1A00 hd_simulator.cmd_set_treatment_parameter_ranges(min_treatment_duration = 300, max_treatment_duration = 500, min_uf_volume = 22.6, max_uf_volume = 34.2, min_dialysate_flow_rate = 3, max_dialysate_flow_rate = 5) verify_log(msg_id = str(MsgIds.MSG_ID_TREATMENT_PARAM_CHANGE_RANGES.value), msg = "TreatmentRanges", param = [300,500,22.6,34.2,3,5]) #0x2F00 hd_simulator.cmd_set_treatment_saline_bolus_data(target = 2, cumulative = 90.0, delivered = 67.2) verify_log(msg_id = MsgIds.MSG_ID_SALINE_BOLUS_DATA.value, msg = "Saline", param = [2,90.0,67.2]) #0x4D00 hd_simulator.cmd_set_treatment_heparin_data(cumulative = 4) verify_log(msg_id = MsgIds.MSG_ID_HD_HEPARIN_DATA_BROADCAST.value, msg = "Heparin", param = [4]) #0x3300 hd_simulator.cmd_send_accelerometer_hd_data(x = 12.3, y = 22.2, z = 4.0, x_max = 14.0, y_max = 30.2, z_max = 10.5, x_tilt = 11.0, y_tilt = 22.1, z_tilt = 5.5) verify_log(msg_id = MsgIds.MSG_ID_HD_ACCELEROMETER_DATA.value, msg = "Accel", param = [12.3,22.2,4.0,14.0,30.2,10.5,11.0,22.1,5.5]) #0x3A00 hd_simulator.cmd_send_hd_general_response(message_id = 58, accepted = 1, reason = 1) verify_log(msg_id = MsgIds.MSG_ID_HD_VALVES_DATA.value, msg = "~HD_Valves_Data") #0x3E00 #hd_simulator.cmd_send_hd_general_response(message_id = 62, accepted = 1, reason = 1) hd_simulator.cmd_send_hd_air_trap_data(lower_level = 1, upper_level = 10) verify_log(msg_id = MsgIds.MSG_ID_HD_AIR_TRAP_DATA.value, msg = "AirTrap", param = [1,10]) #0x6900 hd_simulator.cmd_send_hd_general_response(message_id = 105, accepted = 1, reason = 1) verify_log(msg_id = MsgIds.MSG_ID_HD_SYRINGE_PUMP_DATA.value, msg = "Syringe") #0x6A00 hd_simulator.cmd_send_hd_general_response(message_id = 106, accepted = 1, reason = 1) verify_log(msg_id = MsgIds.MSG_ID_HD_FLUID_LEAK_STATE.value, msg = "~HD_Fluid_Leak_Data") #0x6C00 hd_simulator.cmd_send_hd_blood_leak_data(blood_leak_status = 0, blood_leak_state = 1, blood_leak_zero_status_counter = 2, blood_leak_counter = 3, blood_leak_zeroed_status = 2, blood_leak_detect_set_point = 1, blood_leak_detect_level = 1, blood_leak_st_count = 1, blood_leak_led_intensity = 2, blood_leak_register_counter = 3) verify_log(msg_id = MsgIds.MSG_ID_HD_BLOOD_LEAK_DATA.value, msg = "BloodLeak", param = [0,1,2,3,2,1,1,1,2,3]) #0x9300 hd_simulator.cmd_send_hd_air_bubble_data(venous_air_bubble_status = 2, venous_air_bubble_state = 0) verify_log(msg_id = MsgIds.MSG_ID_HD_BUBBLES_DATA.value, msg = "AirBubble", param = [2,0]) #0x7B00 hd_simulator.cmd_send_hd_general_response(message_id = 123, accepted = 1, reason = 1) verify_log(msg_id = MsgIds.MSG_ID_HD_VOLTAGES_DATA.value, msg = "~HD_Voltages_Data") #0x7D00 hd_simulator.cmd_send_hd_general_response(message_id = 125, accepted = 1, reason = 1) verify_log(msg_id = MsgIds.MSG_ID_HD_ALARM_INFORMATION.value, msg = "~HD_Alarm_Information") #0xA200 hd_simulator.cmd_send_hd_general_response(message_id = 162, accepted = 1, reason = 1) verify_log(msg_id = MsgIds.MSG_ID_HD_SWITCHES_DATA.value, msg = "~HD_Switches_Data") #0x9D00 hd_simulator.cmd_send_hd_general_response(message_id = 157, accepted = 1, reason = 1) verify_log(msg_id = MsgIds.MSG_ID_HD_TEMPERATURES_DATA.value, msg = "~HD_Temperature_Data") #0xA300 hd_simulator.cmd_send_hd_general_response(message_id = 163, accepted = 1, reason = 1) verify_log(msg_id = MsgIds.MSG_ID_HD_FANS_DATA.value, msg = "~HD_Fans_Data") #0xA800 hd_simulator.cmd_send_hd_general_response(message_id = 168, accepted = 1, reason = 1) verify_log(msg_id = MsgIds.MSG_ID_HD_RESERVOIRS_DATA.value, msg = "~HD_Reservoirs_Data") #HD Operation Mode #0x2500 for mode in range(NUMBER_OF_OPMODE): hd_simulator.cmd_send_hd_operation_mode(op_mode = mode, sub_mode = 0) verify_log(msg_id = MsgIds.MSG_ID_HD_OP_MODE.value, msg = "OpMode", param = [mode,0]) #0x5C00 for s_mode in range(NUMBER_OF_OPMODE): hd_simulator.cmd_send_pre_treatment_state_data(sub_mode = s_mode, water_sample_state = 0, consumables_self_test_state = 0, no_cartridge_self_test_state = 0, installation_state = 0, dry_self_test_state = 0, prime_state = 0, recirculate_state = 0, patient_connection_state = 0) verify_log(msg_id = MsgIds.MSG_ID_PRE_TREATMENT_STATE.value, msg = "PreTreatmentStates",param = [s_mode,0,0,0,0,0,0,0,0]) #0x0F00 for s_mode in range(NUMBER_OF_TREATMENTMODES): hd_simulator.cmd_set_treatment_states_data(sub_mode = s_mode, uf_state = 0, saline_state = 0, heparin_state = 0, rinseback_state = 0, recirculate_state = 0, blood_prime_state = 0, treatment_end_state = 0, treatment_stop_state = 0, dialysis_state = 0) verify_log(msg_id = MsgIds.MSG_ID_TREATMENT_STATE.value, msg = "TreatmentStates", param = [s_mode,0,0,0,0,0,0,0,0,0]) #0x7700 #for s_mode in range(3): hd_simulator.cmd_send_hd_general_response(message_id = 119, accepted = 1, reason = 1) verify_log(msg_id = MsgIds.MSG_ID_HD_POST_TREATMENT_STATE.value, msg = "PostTreatmentStates") #0x7E00 for s_mode in range(NUMBER_OF_TREATMENTMODES): hd_simulator.cmd_send_hd_disinfection_state(sub_mode = s_mode, flush_mode = 0, heat_mode = 0, chemical_mode = 0) verify_log(msg_id = MsgIds.MSG_ID_HD_DISINFECT_STANDBY_DATA.value, msg = "DisinfectStates", param = [s_mode,0,0,0]) #0x9A00 UI-HD #0x9B00 # hd_simulator.cmd_send_hd_disinfect_response(accepted = True, reason =1) hd_simulator.cmd_send_hd_general_response(message_id = 155, accepted = 1, reason = 1) verify_log(msg_id = MsgIds.MSG_ID_HD_SET_STANDBY_DISINFECT_SUB_MODE_RESPONSE.value, msg = "~HD_Set_Standby_Disinfect_State_Response") #RINSEBACK #0x5200 UI-HD #0x5300 hd_simulator.cmd_send_treatment_adjust_rinseback_response(accepted = 1, reason = 0) verify_log(msg_id = MsgIds.MSG_ID_HD_RINSEBACK_CMD_RESPONSE.value, msg = "AdjustRinseback", param = [1,0]) #0x5400 #0x5500 hd_simulator.cmd_send_treatment_adjust_recirculate_response(accepted = 1, reason = 0) verify_log(msg_id = MsgIds.MSG_ID_HD_RECIRC_CMD_RESPONSE.value, msg = "AdjustRecirculate", param = [1,0]) #0x5600 hd_simulator.cmd_send_treatment_rinseback_data(target_vol = 2.4, current_vol = 1.9, flow_rate = 1, timeout = 4, timeout_countdown = 8, is_completed = False) verify_log(msg_id = MsgIds.MSG_ID_HD_RINSEBACK_PROGRESS.value, msg = "Rinseback", param = [2.4,1.9,1,4,8,False]) #0x5A00 hd_simulator.cmd_send_treatment_recirculate_data(timeout_total = 200, timeout_count_down = 100) verify_log(msg_id = MsgIds.MSG_ID_HD_RECIRC_PROGRESS.value, msg = "Recirculate", param = [200,100]) #Treatment End(sub-mode) #0x5800 hd_simulator.cmd_send_treatment_adjust_end_response(accepted = 1, reason = 0) verify_log(msg_id = MsgIds.MSG_ID_HD_TX_END_CMD_RESPONSE.value, msg = "AdjustTxEnd", param = [1,0]) #Treatment Blood Prime(sub-mode) #0x5900 #there is an additional parameter in the log hd_simulator.cmd_send_treatment_blood_prime_data(target = 22.2, current = 33.3) verify_log(msg_id = MsgIds.MSG_ID_HD_BLOOD_PRIME_PROGRESS.value, msg = "BloodPrime", param = [22.2,33.3]) #Treatment Stop(sub-mode) #0x4900 hd_simulator.cmd_send_hd_general_response(message_id = 73, accepted = 1, reason = 1) verify_log(msg_id = MsgIds.MSG_ID_HD_TREATMENT_STOP_TIMER_DATA.value, msg = "Stop") #RTC #0x0A00 hd_simulator.cmd_send_hd_general_response(message_id = 10, accepted = 1, reason = 1) verify_log(msg_id = MsgIds.MSG_ID_RTC_EPOCH.value, msg = "~HD_RTC_Epoch_Data") #0x6E00 hd_simulator.cmd_send_set_rtc_response(response = 1, reason = 0) verify_log(msg_id = MsgIds.MSG_ID_HD_UI_SET_RTC_RESPONSE.value, msg = "AdjustHDDateTime", param = [1,0]) #0x7000 dg_simulator.cmd_send_set_rtc_response(response = 1, reason = 0) verify_log(msg_id = MsgIds.MSG_ID_DG_UI_SET_RTC_RESPONSE.value, msg = "AdjustDGDateTime", param = [1,0]) #Power #0x0100 hd_simulator.cmd_send_poweroff_button_pressed() verify_log(msg_id = MsgIds.MSG_ID_OFF_BUTTON_PRESS.value, msg = "PowerOff") #0x0E00 hd_simulator.cmd_send_broadcast_poweroff_imminent() verify_log(msg_id = MsgIds.MSG_ID_POWER_OFF_WARNING.value, msg = "ShuttingDown") #Events #0xA400 hd_simulator.cmd_send_hd_general_response(message_id=164, accepted=1, reason=1) verify_log(msg_id = MsgIds.MSG_ID_HD_EVENT.value, msg = "General") #0xA500 dg_simulator.cmd_send_dg_general_response(message_id=165, accepted=1, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_EVENT.value) #Power-On Self-Test [POST] #0x8E00 hd_simulator.cmd_send_hd_post(item = 1, passed = True, done = False) verify_log(msg_id = MsgIds.MSG_ID_HD_POST_SINGLE_TEST_RESULT.value, msg = "POSTItem", param = [1,1]) #0x8F00 hd_simulator.cmd_send_hd_post(item = 1, passed = False, done = True) verify_log(msg_id = MsgIds.MSG_ID_HD_POST_FINAL_TEST_RESULT.value, msg = "POSTDone", param = [0]) #0x9000 dg_simulator.cmd_send_dg_post(item = 1, passed = True, done = False) verify_log(msg_id = MsgIds.MSG_ID_DG_POST_SINGLE_TEST_RESULT.value, msg = "POSTItem", param = [1,1]) #0x9100 dg_simulator.cmd_send_dg_post(item = 1, passed = False, done = True) verify_log(msg_id = MsgIds.MSG_ID_DG_POST_FINAL_TEST_RESULT.value, msg = "POSTDone", param = [0]) #0x9C00 hd_simulator.cmd_send_hd_general_response(message_id=156, accepted=1, reason=1) verify_log(msg_id = MsgIds.MSG_ID_HD_DG_POST_RESULT_REQUEST.value) #Versions #0x1D00 hd_simulator.cmd_send_version_hd_data(major=1, minor=1, micro=0, build=4, fpga_id=5, fpga_major=1, fpga_minor=2, fpga_lab=3, compatibility_rev=6) verify_log(msg_id = MsgIds.MSG_ID_HD_VERSION.value, msg = "VersionRsp", param = [1,1,0,4,5,1,2,3,6]) #0x1E00 dg_simulator.cmd_send_version_dg_data(major=1, minor=1, micro=0, build=4, fpga_id=5, fpga_major=1, fpga_minor=2, fpga_lab=3, compatibility_rev=6) verify_log(msg_id = MsgIds.MSG_ID_DG_VERSION.value, msg = "Version", param = [1,1,0,4,5,1,2,3,6]) #TODO: message is not displaying in log after API call #0x9900 hd_simulator.cmd_send_serial_hd_data(serial = 'AGHHG1234GHJ') verify_log(msg_id = MsgIds.MSG_ID_HD_SERIAL_NUMBER.value, msg = "Serial") #0x8800 dg_simulator.cmd_send_serial_dg_data(serial = 'AGHHG1234GHJ') verify_log(msg_id = MsgIds.MSG_ID_DG_SERIAL_NUMBER.value, msg = "Serial") #0x9E00 hd_simulator.cmd_send_hd_request_ui_version() verify_log(msg_id = MsgIds.MSG_ID_HD_UI_VERSION_INFO_REQUEST.value, msg = "VersionReq") #DG Broadcast Data #0x1F00 #Message is not getting logged, therefore parameter verification is also failing dg_simulator.cmd_set_dg_ro_pump_data(set_pt_pressure = 0, flow_rate = 1.0, pwm = 2.0) verify_log(msg_id = MsgIds.MSG_ID_RO_PUMP_DATA.value, msg = "ROPump", param = [0, 1.0, 2.0]) #0x2000 dg_simulator.cmd_set_dg_pressures_data(ro_inlet_pressure = 0.0, ro_outlet_pressure = 1.0, drain_inlet_pressure = 2.0, drain_outlet_pressure = 3.0) verify_log(msg_id = MsgIds.MSG_ID_DG_PRESSURES_DATA.value, msg = "Pressures", param = [0.0, 1.0, 2.0, 3.0]) #0x2400 #Message is not getting logged, therefore parameter verification is also failing dg_simulator.cmd_set_dg_drain_pump_data(set_pt_pwm = 1, dac_value = 2) verify_log(msg_id = MsgIds.MSG_ID_DRAIN_PUMP_DATA.value, msg = "DrainPump", param = [1, 2]) #0x2700 #Message is not getting logged, therefore parameter verification is also failing dg_simulator.cmd_set_dg_operation_mode(dg_op_mode = 1) verify_log(msg_id = MsgIds.MSG_ID_DG_OP_MODE.value, msg = "OpMode", param = [1]) #0x2800 dg_simulator.cmd_set_dg_reservoir_data(active_reservoir = 0, fill_to_vol_ml = 1, drain_to_vol_ml = 2) verify_log(msg_id = MsgIds.MSG_ID_DG_RESERVOIRS_DATA.value, msg = "Reservoir", param = [0, 1, 2]) #0x2A00 #there is a parameter mismatch here as the log contains a series of boolean values instead of one integer dg_simulator.cmd_set_dg_valves_states(valves_states = 3) verify_log(msg_id = MsgIds.MSG_ID_DG_VALVES_STATES.value, msg = "ValvesStates", param = [3]) #0x2C00 #there is a parameter mismatch here as the log contains a 3 float values [0.0,0.0,0.0] instead of 3 given integers dg_simulator.cmd_set_dg_heaters_data(main_primary_dc = 1, small_primary_dc = 2, trimmer_dc = 3) verify_log(msg_id = MsgIds.MSG_ID_DG_HEATERS_DATA.value, msg = "Heaters", param = [1, 2, 3]) #0x0C00 dg_simulator.cmd_set_dg_load_cell_readings_data(reservoir1_primary = 1.0, reservoir1_backup = 2.0,reservoir2_primary = 3.0, reservoir2_backup = 4.0) verify_log(msg_id = MsgIds.MSG_ID_LOAD_CELL_READINGS.value, msg = "LoadCell", param = [1.0,2.0,3.0,4.0]) #0x2D00 dg_simulator.cmd_set_dg_temperatures_data(inlet_primary_heater = 1.0, outlet_primary_heater = 2.0, conductivity_sensor1 = 3.0, conductivity_sensor2 = 4.0, outlet_redundancy = 5.0, inlet_dialysate = 6.0, primary_heater_thermocouple = 7.0, trimmer_heater_thermocouple = 8.0, primary_heater_cold_junction = 9.0, trimmer_heater_cold_junction = 10.0, primary_heater_internal_temp = 11.0, trimmer_heater_internal_temp = 12.0) verify_log(msg_id = MsgIds.MSG_ID_DG_TEMPERATURE_DATA.value, msg = "Temperatures", param = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0]) #0x3100 dg_simulator.cmd_send_dg_conductivity_data(ro_rejection_ratio = 1.0, cpi_conductivity = 2.0, cpo_conductivity = 3.0, cd1_conductivity = 4.0, cd2_conductivity = 5.0) verify_log(msg_id = MsgIds.MSG_ID_DG_CONDUCTIVITY_DATA.value, msg = "Conductivity", param = [1.0, 2.0, 3.0, 4.0,5.0]) #0x3700 dg_simulator.cmd_send_dg_general_response(message_id=55, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_HEAT_DISINFECT_DATA.value, msg = "~DG_Heat_Disinfect_Data") #0x4200 dg_simulator.cmd_send_dg_general_response(message_id=66, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_CONCENTRATE_PUMP_DATA.value, msg = "~DG_Concentrate_Pump_Data") #0x4400 dg_simulator.cmd_send_dg_general_response(message_id=68, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_UV_REACTORS_DATA.value, msg = "~DG_UV_Reactors_Data") #0x4500 dg_simulator.cmd_send_dg_general_response(message_id=69, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_THERMISTORS_DATA.value, msg = "~DG_Thermistors_Data") #0x4800 dg_simulator.cmd_send_dg_general_response(message_id=72, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_FANS_DATA.value, msg = "~DG_Fans_Data") #0x3400 dg_simulator.cmd_send_accelerometer_dg_data(x=1.0, y=2.0, z=3.0, x_max=2.0, y_max=2.0, z_max=3.0, x_tilt=2.0, y_tilt=3.0, z_tilt=4.0) verify_log(msg_id = MsgIds.MSG_ID_DG_ACCELEROMETER_DATA.value, msg = "Accel", param = [1.0, 2.0, 3.0, 2.0, 2.0, 3.0, 2.0, 3.0, 4.0]) #0x6B00 dg_simulator.cmd_send_dg_general_response(message_id=107, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_FLUID_LEAK_STATE.value, msg = "~DG_Fluid_Leak_Data") #0x7A00 dg_simulator.cmd_send_dg_general_response(message_id=122, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_FLUSH_DATA.value, msg = "~DG_Flush_Data") #0x8600 dg_simulator.cmd_send_dg_general_response(message_id=134, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_VOLTAGES_DATA.value, msg = "~DG_Voltages_Data") #0x8700 dg_simulator.cmd_send_dg_general_response(message_id=135, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_CHEM_DISINFECT_DATA.value, msg = "~DG_Chemical_Disinfect_Data") #0xA100 dg_simulator.cmd_send_dg_general_response(message_id=161, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_SWITCHES_DATA.value, msg = "~DG_Switches_Data") #0xA700 dg_simulator.cmd_send_dg_general_response(message_id=167, accepted=1, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_ALARM_INFO.value, msg = None) #0xAA00 dg_simulator.cmd_send_dg_general_response(message_id=170, accepted=1, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_CONCENTRATE_MIXING_RATIOS_DATA.value, msg = None) #0xA600 dg_simulator.cmd_send_dg_general_response(message_id=166, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_DIALYSATE_FLOW_METER_DATA.value, msg = "~DG_Dialysate_Flow_Data") #0xAB00 dg_simulator.cmd_send_dg_general_response(message_id=171, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_SCHEDULED_RUNS_DATA.value, msg = "DG scheduled runs data") #0xAC00 dg_simulator.cmd_send_dg_general_response(message_id=172, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_SCHEDULED_RUNS_INFO.value, msg = "DG scheduled runs info") #TODO: Msg_Ids need to be update as per patch file #0xAE00 dg_simulator.cmd_send_dg_general_response(message_id=174, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_FILL_MODE_DATA.value, msg = None) #TODO: Msg_Ids need to be update as per patch file #0xAF00 dg_simulator.cmd_send_dg_general_response(message_id=175, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_IDLE_MODE_BAD_FILL_SUB_STATES.value, msg = None) #Alarm #0x0200 hd_alarm.cmd_send_clear_alarms() verify_log(msg_id = MsgIds.MSG_ID_ALARM_STATUS.value, msg = "AlarmStatus") #0x0300 #parameter data type mismatch hd_alarm.cmd_set_alarm_triggered(alarm_id = 1, field_descriptor_1 = 1, data_field_1 = '2', field_descriptor_2 = 3, data_field_2 = '4', priority = 5, rank = 6, clear_top = 7) verify_log(msg_id = MsgIds.MSG_ID_ALARM_TRIGGERED.value, msg = "AlarmTriggered", param = [1, 1, '2', 3, '4', 5, 6, 7]) #0x0400 hd_alarm.cmd_set_alarm_cleared(alarm_id = 4) verify_log(msg_id = MsgIds.MSG_ID_ALARM_CLEARED.value, msg = "AlarmCleared", param = [4]) #0x7C00 hd_simulator.cmd_send_hd_general_response(message_id=124, accepted=1, reason=1) verify_log(msg_id = MsgIds.MSG_ID_HD_ALARM_AUDIO_VOLUME_SET_RESPONSE.value, msg = "AdjustHDAlarmVolume") #0x3F00 hd_simulator.cmd_send_hd_general_response(message_id=63, accepted=1, reason=1) verify_log(msg_id = MsgIds.MSG_ID_ALARM_CONDITION_CLEARED.value, msg = "AlarmCondition") #0x3200 hd_simulator.cmd_send_hd_general_response(message_id=50, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_USER_REQUEST_ALARM_SILENCE.value, msg = "AlarmSilence") #0x9800 hd_alarm.cmd_send_active_list_response(accept = True, reason = 0, a0 = 0, a1 = 0, a2 = 0, a3 = 0, a4 = 0, a5 = 0, a6 = 0, a7 = 0, a8 = 0, a9 = 0) verify_log(msg_id = MsgIds.MSG_ID_HD_ACTIVE_ALARMS_LIST_REQUEST_RESPONSE.value, msg = "AlarmActiveList", param = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) #UF Vol. #0x4100 #parameter mismatch : expected 1 int but 3 integers are logged hd_simulator.cmd_set_treatment_adjust_ultrafiltration_accepted(state = 1) verify_log(msg_id = MsgIds.MSG_ID_USER_UF_PAUSE_RESUME_RESPONSE.value, msg = "AdjustUFState", param = [1]) #0x1300 hd_simulator.cmd_send_hd_general_response(message_id=19, accepted=1, reason=1) verify_log(msg_id = MsgIds.MSG_ID_USER_UF_SETTINGS_CHANGE_RESPONSE.value, msg = "AdjustUFEdit") #0x2E00 #parameter mismatch : expected 1 int but 3 integers are logged hd_simulator.cmd_set_treatment_adjust_ultrafiltration_confirm_rejected(reason = 1) verify_log(msg_id = MsgIds.MSG_ID_USER_UF_SETTINGS_CHANGE_CONFIRMATION_RESPONSE.value, msg = "AdjustUFConfirm", param = [1]) #Saline #0x1400 hd_simulator.cmd_set_saline_bolus_response(accepted = 0, reason = 1, target = 2) verify_log(msg_id = MsgIds.MSG_ID_USER_SALINE_BOLUS_RESPONSE.value, msg = "AdjustSaline", param = [0,1,2]) #Heparin #0x4C00 hd_simulator.cmd_set_heparin_pause_resume_response(accepted = 0, reason = 1) verify_log(msg_id = MsgIds.MSG_ID_HD_HEPARIN_PAUSE_RESUME_RESPONSE.value, msg = "AdjustHeparin", param = [0,1]) #Duration #0x1B00 hd_simulator.cmd_send_treatment_adjust_duration_response(accepted = 0, reason = 1, duration = 2, ultrafiltration = 3.0) verify_log(msg_id = MsgIds.MSG_ID_USER_TREATMENT_TIME_CHANGE_RESPONSE.value, msg = "AdjustDuration", param = [0, 1, 2, 3.0]) #Blood / Dialysate #0x1800 hd_simulator.cmd_send_treatment_adjust_blood_dialysate_response(accepted = 0, reason = 1, blood_rate = 2, dialysate_flow_rate = 3) verify_log(msg_id = MsgIds.MSG_ID_USER_BLOOD_DIAL_RATE_CHANGE_RESPONSE.value, msg = "AdjustBloodDialysate", param = [0, 1, 2, 3]) #PRS-58: In-Line Blood Pressure Limits #0x4700 hd_simulator.cmd_send_treatment_adjust_pressures_limit_response(accepted = 0, reason = 1, arterial_low = 2, arterial_high = 3, venous_low = 4, venous_high = 5) verify_log(msg_id = MsgIds.MSG_ID_HD_PRESSURE_LIMITS_CHANGE_RESPONSE.value, msg = "AdjustPressuresLimits", param = [0, 1, 2, 3, 4, 5]) #Service Information #0x8A00 # hd_simulator._handler_system_usage_response() hd_simulator.cmd_send_hd_general_response(message_id=138, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_HD_SERVICE_SCHEDULE_DATA.value, msg = "ServiceDate") #0x8C00 # dg_simulator._handler_system_usage_response() dg_simulator.cmd_send_dg_general_response(message_id=140, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_SERVICE_SCHEDULE_DATA.value, msg = "ServiceDate") #System Usage Information #0x8B00 hd_simulator.cmd_send_hd_general_response(message_id=139, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_HD_USAGE_DATA.value, msg = "~HD_Usage_Data") #0x8D00 dg_simulator.cmd_send_dg_general_response(message_id=141, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_USAGE_DATA.value, msg = "~DG_Usage_Data") #DG Command #0x2100 hd_simulator.cmd_send_hd_general_response(message_id=33, accepted=0, reason=1) verify_log(msg_id = MsgIds. MSG_ID_DG_SWITCH_RESERVOIR_CMD.value, msg = "~DG_Switch_Res_Cmd") #0x2200 hd_simulator.cmd_send_hd_general_response(message_id=34, accepted=0, reason=1) verify_log(msg_id = MsgIds. MSG_ID_DG_FILL_CMD.value, msg = "~DG_Fill_Cmd") #0x2300 hd_simulator.cmd_send_hd_general_response(message_id=35, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_DRAIN_CMD.value, msg = "~DG_Drain_Cmd") #0x1900 hd_simulator.cmd_send_hd_general_response(message_id=25, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_SET_DG_DIALYSATE_TEMP_TARGETS.value, msg = "~DG_Dialysate_Tgt_Temps") #0x2600 hd_simulator.cmd_send_hd_general_response(message_id=38, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_STARTING_STOPPING_TREATMENT_CMD.value, msg = "~DG_Cmd") #0x2900 hd_simulator.cmd_send_hd_general_response(message_id=41, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_SAMPLE_WATER_CMD.value, msg = "~DG_Sample_Water_Cmd") #0x2B00 hd_simulator.cmd_send_hd_general_response(message_id=43, accepted=0, reason=1) verify_log(msg_id = MsgIds. MSG_ID_DG_START_STOP_TRIMMER_HEATER_CMD.value, msg = "~DG_Trimmer_Htr_Cmd") #0x3000 hd_simulator.cmd_send_hd_general_response(message_id=48, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_START_STOP_HEAT_DISINFECT.value, msg = "~DG_Heat_Disinfect_Cmd") #0x5B00 hd_simulator.cmd_send_hd_general_response(message_id=91, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_CHANGE_VALVE_SETTING_CMD.value, msg = "~DG_Chg_Valves_Cmd") #0x5100 hd_simulator.cmd_send_hd_general_response(message_id=81, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_COMMAND_RESPONSE.value, msg = "~DG_Cmd_Rsp") #0x7800 hd_simulator.cmd_send_hd_general_response(message_id=120, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_START_STOP_CHEM_DISINFECT.value, msg = "~DG_Chem_Disinfect_Cmd") #0x7900 hd_simulator.cmd_send_hd_general_response(message_id=121, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_START_STOP_FLUSH.value, msg = "~DG_Flush_Cmd") #0xA900 hd_simulator.cmd_send_hd_general_response(message_id=169, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_HD_REQUEST_DG_CONCENTRATE_MIXING_RATIOS.value, msg = "~DG_Mixing_Ratio_Fill_Prep_Request") #FW Debug #0xF1FF hd_simulator.cmd_send_hd_general_response(message_id=65521, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_HD_DEBUG_EVENT.value, msg = "Debug") #0xF2FF dg_simulator.cmd_send_dg_general_response(message_id=65522, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_DEBUG_EVENT.value, msg = "Debug") #Initiate (Create/Select) a Treatment #ID:0x3900 hd_simulator.cmd_initiate_treatment_response(response = 1, reason = 0) verify_log(msg_id = MsgIds.MSG_ID_HD_INITIATE_TREATMENT_RESPONSE.value, msg= "InitTreatment", param = [1,0]) #Treatment Parameters Validation #ID:0x3600 (API is not reflecting with rejection messages) #hd_simulator.cmd_send_treatment_parameter_validation_response([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34]) hd_simulator.cmd_send_hd_general_response(message_id=54, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_HD_NEW_TREATMENT_PARAMS_RESPONSE.value, msg= "Validate New Create Treatment Response") #Pre-Treatment Water Sample (sub-mode) #ID:0x5E00 hd_simulator.cmd_send_pre_treatment_water_sample_response(accepted = 1, reason = 0) verify_log(msg_id = MsgIds.MSG_ID_HD_SAMPLE_WATER_CMD_RESPONSE.value, msg = "AdjustWaterSample", param = [1,0]) #ID:0x6000 dg_simulator.cmd_send_dg_pre_treatment_filter_flush_progress_data(total = 120, countdown = 60) verify_log(msg_id = MsgIds.MSG_ID_DG_FILTER_FLUSH_PROGRESS.value, msg = "FilterFlush", param = [120,60]) #Pre-Treatment No Cartridge Self-Test (sub-mode) #ID:0x6100 hd_simulator.cmd_send_pre_treatment_self_test_no_cartridge_progress_data(total = 120, countdown = 60) verify_log(msg_id = MsgIds.MSG_ID_HD_NO_CART_SELF_TEST_PROGRESS.value, msg = "SelfTestNoCartridge", param = [120,60]) #Pre-Treatment Disposable Installation (sub-mode) #TODO: Msg_Ids need to be update as per patch file #ID:0xAD00(API is missing, also message id is not present in msgs.py file hd_simulator.cmd_send_hd_general_response(message_id=173, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_HD_UI_DISPOSABLE_INSTALLATION_RESPONSE.value, msg = "AdjustDisposablesConfirm", param = [0,1]) #Pre-Treatment Dry Self-Test (sub-mode) #ID:0x6300 hd_simulator.cmd_send_pre_treatment_self_test_dry_progress_data(total = 120, countdown = 60) verify_log(msg_id = MsgIds.MSG_ID_HD_DRY_SELF_TEST_PROGRESS.value, msg = "SelfTestDry", param = [120,60]) #Pre-Treatment Prime (sub-mode) #ID:0x3D00 hd_simulator.cmd_send_pre_treatment_prime_start_response(accepted = 1, reason = 0) verify_log(msg_id = MsgIds.MSG_ID_HD_START_PRIME_RESPONSE.value, msg = "AdjustDisposablesPrime", param = [1,0]) #ID:0x4300 hd_simulator.cmd_send_pre_treatment_disposables_prime_progress_data(timeout = 120, countdown = 60) verify_log(msg_id = MsgIds.MSG_ID_HD_PRIMING_STATUS_DATA.value, msg = "DisposablesPrime", param = [120,60]) #Pre-Treatment Patient Connection Begin #ID:0x6500 hd_simulator.cmd_send_hd_general_response(message_id=101, accepted=1, reason=0) verify_log(msg_id = MsgIds.MSG_ID_HD_PATIENT_CONNECTION_BEGIN_RESPONSE.value, msg = "Patient Connection Begin Response") #Pre-Treatment Ultrafiltration (Init) Volume Adjustment #ID:0x5000 hd_simulator.cmd_send_hd_general_response(message_id=80, accepted=1, reason=0) verify_log(msg_id = MsgIds.MSG_ID_HD_SET_UF_VOLUME_PARAMETER_RESPONSE.value, msg = "Pre UF Volume Adjustment Response") #Pre-Treatment Patient Connection Confirm #ID:0x6700 hd_simulator.cmd_send_pre_treatment_patient_connection_confirm_response(accepted = 1, reason = 0) verify_log(msg_id = MsgIds.MSG_ID_HD_PATIENT_CONNECTION_CONFIRM_RESPONSE.value, msg = "AdjustPatientConnectionBegin", param = [1,0]) #Start Treatment #ID:0x7200 hd_simulator.cmd_send_pre_treatment_continue_to_treament_response(accepted = 1, reason = 0) verify_log(msg_id = MsgIds.MSG_ID_HD_START_TREATMENT_RESPONSE.value, msg = "AdjustPatientConnectionConfirm", param = [1,0]) #Post-Treatment #ID:0x7400 hd_simulator.cmd_send_post_treatment_disposable_removal_confirm_response(accepted = 1, reason = 0) verify_log(msg_id = MsgIds.MSG_ID_HD_DISPOSABLE_REMOVAL_CONFIRM_RESPONSE.value, msg = "AdjustDisposablesRemovalConfirm", param = [1,0]) #Treatment Log #ID:0x7600 #parameter mismatch: the last parameter (water_sample_test_result) value is always 1000 regardless of the argument passed hd_simulator.cmd_send_post_treatment_log_response(accepted = 1, reason = 1, bood_flow_rate = 1, dialysate_flow_rate = 1, treatment_duration = 1, actual_treatment_duration = 1, acid_concentrate_type = 1, bicarbonate_concentrate_type = 1, potassium_concentration = 1, calcium_concentration = 1, bicarbonate_concentration = 1, sodium_concentration = 1, dialysate_temperature = 1.0, dialyzer_type = 1, treatment_start_date_time = 1, treatment_end_date_time = 1, average_blood_flow = 1.0, average_dialysate_flow = 1.0, dialysate_volume_used = 1.0, average_dialysate_temp = 1.0, origin_uf_volume = 1.0, target_uf_volume = 1.0, actual_uf_volume = 1.0, origin_uf_rate = 1.0, target_uf_rate = 1.0, actual_uf_rate = 1.0, saline_bolus_volume = 1, heparin_bolus_volume = 1.0, heparin_dispense_rate = 1.0, heparin_pre_stop = 1, heparin_delivered_volume = 1.0, heparin_type = 1, average_arterial_pressure = 1.0, average_venous_pressure = 1.0, device_id = 1, water_sample_test_result = 10) verify_log(msg_id = MsgIds.MSG_ID_HD_TREATMENT_LOG_DATA_RESPONSE.value, msg = "AdjustTreatmentLog", param =[1,1,1,1,1,1,1,1,1,1,1,1,1.0,1,1,1,1.0,1.0,1.0, 1.0,1.0,1.0,1.0,1.0,1,1.0,1.0,1,1.0,1.0,1.0,0,1,1,1]) #ID:0x9400 hd_simulator.cmd_send_treatment_log_data(blood_flow_rate = 1, dialysate_flow_rate = 1, uf_rate = 1.0, arterial_pressure = 0.0, venous_pressure = 1.0) verify_log(msg_id = MsgIds.MSG_ID_HD_TREATMENT_LOG_PERIODIC_DATA.value, msg = "TreatmentLogAvrge", param = [1,1,1.0,0.0,1.0]) #ID:0x9500 hd_simulator.cmd_send_treatment_log_alarm(alarm_id = 1, parameter1 = 0.0, parameter2 = 1.0) verify_log(msg_id = MsgIds.MSG_ID_HD_TREATMENT_LOG_ALARM_EVENT.value, msg = "TreatmentLogAlarm", param = [1,0.0,1.0]) #ID:0x9600 hd_simulator.cmd_send_treatment_log_event(event_id = 1, old_value = 1.0, new_value = 0.0) verify_log(msg_id = MsgIds.MSG_ID_HD_TREATMENT_LOG_EVENT.value, msg = "TreatmentLogEvent", param = [1,1.0,0.0]) #Post-Treatment - Disinfect #ID:0x8000 hd_simulator.cmd_send_hd_disinfect_response(accepted = 1, reason = 0) verify_log(msg_id = MsgIds.MSG_ID_HD_DISINFECT_RESPONSE.value, msg = "AdjustDisinfect", param =[1,0]) #ID:0x8200 hd_simulator.cmd_send_hd_disinfect_chemical_confirm(accepted = 1, reason = 0) verify_log(msg_id = MsgIds.MSG_ID_HD_CHEM_DISINFECT_CONFIRM_RESPONSE.value, msg = "AdjustDisinfectChemicalConfirm" ,param = [1,0]) #ID:0x8300 dg_simulator.cmd_send_dg_disinfect_progress_time_flush(total = 120, countdown = 60) verify_log(msg_id = MsgIds.MSG_ID_DG_FLUSH_TIME_DATA.value, msg = "DisinfectDGFlushTime", param = [120,60]) #ID:0x8400 dg_simulator.cmd_send_dg_disinfect_progress_time_heat(total = 120, countdown = 60) verify_log(msg_id = MsgIds.MSG_ID_DG_HEAT_DISINFECT_TIME_DATA.value, msg = "DisinfectDGHeatTime", param = [120,60]) #ID:0x8500 dg_simulator.cmd_send_dg_disinfect_progress_time_checmical(total = 120, countdown = 60) verify_log(msg_id = MsgIds.MSG_ID_DG_CHEM_DISINFECT_TIME_DATA.value, msg = "DisinfectDGChemicalTime", param = [120,60])