Index: dialin/common/dg_defs.py =================================================================== diff -u -r711796fb6fca04391d4a2db30655394646bce543 -r889854fedb9ee0711460f6addd9b79e0a5ece718 --- dialin/common/dg_defs.py (.../dg_defs.py) (revision 711796fb6fca04391d4a2db30655394646bce543) +++ dialin/common/dg_defs.py (.../dg_defs.py) (revision 889854fedb9ee0711460f6addd9b79e0a5ece718) @@ -7,8 +7,8 @@ # # @file dg_defs.py # -# @author (last) Dara Navaei -# @date (last) 15-Jul-2022 +# @author (last) Micahel Garthwaite +# @date (last) 12-Oct-2022 # @author (original) Peter Lucia # @date (original) 22-Jun-2021 # @@ -64,10 +64,11 @@ @unique class DGFaultStates(DialinEnum): - DG_FAULT_STATE_START = 0 - NUM_OF_DG_FAULT_STATES = 1 + DG_FAULT_STATE_START = 0 # DG fault start state + DG_FAULT_STATE_RUN_NV_POSTS = 1 # DG fault run RTC and NV data management post + DG_FAULT_STATE_COMPLETE = 2 # DG fault complete + NUM_OF_DG_FAULT_STATES = 3 # Number of fault mode states - @unique class DGSoloStates(DialinEnum): DG_SOLO_STANDBY_STATE_START = 0, @@ -145,6 +146,18 @@ @unique +class DGFlushUIStates(DialinEnum): + FLUSH_UI_STATE_NOT_RUNNING = 0 + FLUSH_UI_STATE_NOT_DRAIN_DEVICE = 1 + FLUSH_UI_STATE_NOT_FLUSH_RESERVOIRS = 2 + FLUSH_UI_STATE_NOT_DRAIN_RESERVOIRS = 3 + FLUSH_UI_STATE_NOT_FLUSH_RECIRCULATION_PATH = 4 + FLUSH_UI_STATE_NOT_CANCEL_FLUSH = 5 + FLUSH_UI_STATE_NOT_COMPLETE = 6 + NUM_OF_FLUSH_UI_STATES = 7 + + +@unique class DGHeatDisinfectStates(DialinEnum): DG_HEAT_DISINFECT_STATE_START = 0 # Heat disinfect, start mode state DG_HEAT_DISINFECT_STATE_DRAIN_R1 = 1 # Heat disinfect, drain R1 state @@ -248,3 +261,7 @@ NUM_OF_EVENT_DATA_TYPES = 5 +@unique +class DGServiceModesStates(DialinEnum): + DG_SERVICE_STATE_START = 0 # Start service mode state + NUM_OF_DG_SERVICE_STATES = 1 # Number of service mode states \ No newline at end of file Index: dialin/common/msg_ids.py =================================================================== diff -u -r6bde876d2212e609b4044f810767136e5243645c -r889854fedb9ee0711460f6addd9b79e0a5ece718 --- dialin/common/msg_ids.py (.../msg_ids.py) (revision 6bde876d2212e609b4044f810767136e5243645c) +++ dialin/common/msg_ids.py (.../msg_ids.py) (revision 889854fedb9ee0711460f6addd9b79e0a5ece718) @@ -7,8 +7,8 @@ # # @file msg_ids.py # -# @author (last) Dara Navaei -# @date (last) 04-Sep-2022 +# @author (last) Micahel Garthwaite +# @date (last) 06-Oct-2022 # @author (original) Peter Lucia # @date (original) 06-Apr-2021 # @@ -339,6 +339,9 @@ MSG_ID_HD_SET_BLOOD_LEAK_EMB_MODE_COMMAND = 0x8082 MSG_ID_HD_SEND_BLOOD_LEAK_EMB_MODE_RESPONSE = 0x8083 MSG_ID_HD_SEND_ALARMS_COMMAND = 0x8084 + MSG_ID_HD_BLOOD_PUMP_SET_PWM = 0x8085 + MSG_ID_HD_DIAL_IN_SET_PWM = 0x8086 + MSG_ID_HD_DIAL_OUT_SET_PWM = 0x8087 MSG_ID_DG_TESTER_LOGIN_REQUEST = 0xA000 MSG_ID_DG_ALARM_STATE_OVERRIDE = 0xA001 Index: dialin/dg/dialysate_generator.py =================================================================== diff -u -r1c5dbffa6b205c14f92e05badc563f2a84980bfa -r889854fedb9ee0711460f6addd9b79e0a5ece718 --- dialin/dg/dialysate_generator.py (.../dialysate_generator.py) (revision 1c5dbffa6b205c14f92e05badc563f2a84980bfa) +++ dialin/dg/dialysate_generator.py (.../dialysate_generator.py) (revision 889854fedb9ee0711460f6addd9b79e0a5ece718) @@ -7,8 +7,8 @@ # # @file dialysate_generator.py # -# @author (last) Sean Nash -# @date (last) 08-Jul-2022 +# @author (last) Micahel Garthwaite +# @date (last) 08-Aug-2022 # @author (original) Peter Lucia # @date (original) 02-Apr-2020 # @@ -338,9 +338,18 @@ """ - message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, - message_id=MsgIds.MSG_ID_REQUEST_FW_VERSIONS.value) + major = unsigned_byte_to_bytearray(0) + minor = unsigned_byte_to_bytearray(0) + micro = unsigned_byte_to_bytearray(0) + build = short_to_bytearray(0) + compatibility = integer_to_bytearray(0) + payload = major + minor + micro + build + compatibility + + message = DenaliMessage.build_message(channel_id=DenaliChannels.ui_sync_broadcast_ch_id, + message_id=MsgIds.MSG_ID_REQUEST_FW_VERSIONS.value, + payload=payload) + self.logger.debug("Sending Dialin request for version to DG") self.can_interface.send(message, 0) Index: dialin/dg/temperatures.py =================================================================== diff -u -r8d2404cf92c1169f1119fb87110396634dcf7e3b -r889854fedb9ee0711460f6addd9b79e0a5ece718 --- dialin/dg/temperatures.py (.../temperatures.py) (revision 8d2404cf92c1169f1119fb87110396634dcf7e3b) +++ dialin/dg/temperatures.py (.../temperatures.py) (revision 889854fedb9ee0711460f6addd9b79e0a5ece718) @@ -7,8 +7,8 @@ # # @file temperatures.py # -# @author (last) Dara Navaei -# @date (last) 02-Mar-2022 +# @author (last) Micahel Garthwaite +# @date (last) 30-Aug-2022 # @author (original) Dara Navaei # @date (original) 01-Dec-2021 # @@ -156,7 +156,7 @@ self.temperatures[DGTemperaturesNames.INTERNAL_TDI_RTD.name] = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_18:MsgFieldPositions.END_POS_FIELD_18]))[0] - self.temperatures[DGTemperaturesNames.INTERNAL_COND_TEMP_SENSOR.name] = struct.unpack('f', bytearray( + self.temperatures[DGTemperaturesNames.INTERNAL_THD_RTD.name] = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_19:MsgFieldPositions.END_POS_FIELD_19]))[0] self.temperatures[DGTemperaturesNames.BARO_TEMP_SENSOR.name] = struct.unpack('f', bytearray( @@ -215,8 +215,8 @@ 2 = Primary Heater Outlet 3 = Conductivity Sensor 1 4 = Conductivity Sensor 2 - 5 = Dialysate (Redundant) - 6 = Dialysate + 5 = Outlet Dialysate (Redundant) + 6 = Inlet Dialysate 7 = Primary Heater Thermocouple 8 = Trimmer Heater Thermocouple 9 = Primary Heater Cold Junction Index: dialin/dg/voltages.py =================================================================== diff -u -rfe051f80c87d4d43ff6c8c1a598eacd62f61c5f8 -r889854fedb9ee0711460f6addd9b79e0a5ece718 --- dialin/dg/voltages.py (.../voltages.py) (revision fe051f80c87d4d43ff6c8c1a598eacd62f61c5f8) +++ dialin/dg/voltages.py (.../voltages.py) (revision 889854fedb9ee0711460f6addd9b79e0a5ece718) @@ -29,24 +29,31 @@ # Monitored voltages @unique class DGMonitoredVoltages(DialinEnum): - MONITORED_LINE_24V_MAIN = 0 # Main voltage (24V) - MONITORED_LINE_1_8V_FPGA = 1 # FPGA logic voltage (1.8V) - MONITORED_LINE_1V_FPGA = 2 # FPGA reference voltage (1V) - MONITORED_LINE_3_3V_SENSORS = 3 # Sensors voltage (3.3V) - MONITORED_LINE_1_8V_PROC = 4 # Processor voltage (1.8V) - MONITORED_LINE_5V_SENSORS = 5 # Sensors voltage (5V) - MONITORED_LINE_5V_LOGIC = 6 # Logic voltage (5V) - MONITORED_LINE_3_3V = 7 # Logic voltage (3.3V) - MONITORED_LINE_1_2V_PROC = 8 # Processor voltage (1.2V) - MONITORED_LINE_V_REF = 9 # Reference voltage (3V) - MONITORED_LINE_EXT_ADC_1_REF_V = 10 # External ADC 1 reference voltage (3V) - MONITORED_LINE_EXT_ADC_2_REF_V = 11 # External ADC 2 reference voltage (3V) - MONITORED_LINE_PS_GATE_DRIVER_V = 12 # P/S gate driver (5V) - MONITORED_LINE_24V_PRIM_HTR_V = 13 # Primary heater (0..24V) - MONITORED_LINE_24V_PRIM_HTR_GND_V = 14 # Primary heater ground (0..24V) - MONITORED_LINE_24V_SEC_HTR_V = 15 # Secondary element voltage (0..24V) - MONITORED_LINE_24V_TRIM_HTR_V = 16 # Trimmer heater voltage (0..24V) - NUM_OF_MONITORED_LINES = 17 # Number of monitored voltages + MONITORED_LINE_24V_MAIN = 0 # Main voltage (24V) + MONITORED_LINE_1_8V_FPGA = 1 # FPGA logic voltage (1.8V) + MONITORED_LINE_1V_FPGA = 2 # FPGA reference voltage (1V) + MONITORED_LINE_3_3V_SENSORS = 3 # Sensors voltage (3.3V) + MONITORED_LINE_1_8V_PROC = 4 # Processor voltage (1.8V) + MONITORED_LINE_5V_SENSORS = 5 # Sensors voltage (5V) + MONITORED_LINE_5V_LOGIC = 6 # Logic voltage (5V) + MONITORED_LINE_3_3V = 7 # Logic voltage (3.3V) + MONITORED_LINE_1_2V_PROC = 8 # Processor voltage (1.2V) + MONITORED_LINE_V_REF = 9 # Reference voltage (3V) + MONITORED_LINE_EXT_ADC_1_REF_V = 10 # External ADC 1 reference voltage (3V) + MONITORED_LINE_EXT_ADC_2_REF_V = 11 # External ADC 2 reference voltage (3V) + MONITORED_LINE_FPGA_VCC_V = 12 # FPGA VCC voltage (3V) + MONITORED_LINE_FPGA_AUX_VCC_V = 13 # FPGA auxiliary voltage (3V) + MONITORED_LINE_FPGA_VPVN_V = 14 # FPGA VPVN voltage (1V) + MONITORED_LINE_PS_GATE_DRIVER_V = 15 # P/S gate driver (5V) + # NOTE: This enum has been commented out because two enums cannot have the same value but the firmware has + # MONITORED_LINE_PS_GATE_DRIVER_V and MONITORED_LINE_LAST_RANGE_CHECKED_LINE with the same number so for clarity it + # is kept here + # MONITORED_LINE_LAST_RANGE_CHECKED_LINE = MONITORED_LINE_PS_GATE_DRIVER_V # Monitored last range + MONITORED_LINE_24V_POWER_PRIM_HTR_V = 16 # Power primary heater voltage (24V) + MONITORED_LINE_24V_GND_MAIN_PRIM_HTR_V = 17 # Main primary heater ground voltage + MONITORED_LINE_24V_GND_SMALL_PRIM_HTR_V = 18 # Small primary heater voltage (24V) + MONITORED_LINE_24V_GND_TRIM_HTR_V = 19 # Trimmer heater voltage (24V) + NUM_OF_MONITORED_LINES = 20 # Number of monitored voltages class DGVoltages(AbstractSubSystem): @@ -114,16 +121,22 @@ message['message'][MsgFieldPositions.START_POS_FIELD_11:MsgFieldPositions.END_POS_FIELD_11])) v5g = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_12:MsgFieldPositions.END_POS_FIELD_12])) - v24 = struct.unpack('f', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_13:MsgFieldPositions.END_POS_FIELD_13])) v24p = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_13:MsgFieldPositions.END_POS_FIELD_13])) + v24pp = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_14:MsgFieldPositions.END_POS_FIELD_14])) v24pg = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_15:MsgFieldPositions.END_POS_FIELD_15])) - v24s = struct.unpack('f', bytearray( + v24sg = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_16:MsgFieldPositions.END_POS_FIELD_16])) v24t = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_17:MsgFieldPositions.END_POS_FIELD_17])) + int_vcc = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_18:MsgFieldPositions.END_POS_FIELD_18])) + aux_vcc = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_19:MsgFieldPositions.END_POS_FIELD_19])) + vpvn = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_20:MsgFieldPositions.END_POS_FIELD_20])) self.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_1V_FPGA.value] = v1[0] self.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_1_2V_PROC.value] = v12[0] @@ -137,11 +150,14 @@ self.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_5V_LOGIC.value] = v5l[0] self.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_5V_SENSORS.value] = v5s[0] self.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_PS_GATE_DRIVER_V.value] = v5g[0] - self.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_24V_MAIN.value] = v24[0] - self.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_24V_PRIM_HTR_V.value] = v24p[0] - self.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_24V_PRIM_HTR_GND_V.value] = v24pg[0] - self.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_24V_SEC_HTR_V.value] = v24s[0] - self.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_24V_TRIM_HTR_V.value] = v24t[0] + self.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_24V_MAIN.value] = v24p[0] + self.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_24V_POWER_PRIM_HTR_V.value] = v24pp[0] + self.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_24V_GND_MAIN_PRIM_HTR_V.value] = v24pg[0] + self.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_24V_GND_SMALL_PRIM_HTR_V.value] = v24sg[0] + self.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_24V_GND_TRIM_HTR_V.value] = v24t[0] + self.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_FPGA_VCC_V.value] = int_vcc[0] + self.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_FPGA_AUX_VCC_V.value] = aux_vcc[0] + self.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_FPGA_VPVN_V.value] = vpvn[0] def cmd_monitored_voltage_override(self, signal: int = 0, volts: float = 0.0, reset: int = NO_RESET) -> int: """ Index: dialin/hd/sw_configs.py =================================================================== diff -u -r6bde876d2212e609b4044f810767136e5243645c -r889854fedb9ee0711460f6addd9b79e0a5ece718 --- dialin/hd/sw_configs.py (.../sw_configs.py) (revision 6bde876d2212e609b4044f810767136e5243645c) +++ dialin/hd/sw_configs.py (.../sw_configs.py) (revision 889854fedb9ee0711460f6addd9b79e0a5ece718) @@ -7,8 +7,8 @@ # # @file sw_configs.py # -# @author (last) Dara Navaei -# @date (last) 05-Aug-2022 +# @author (last) Micahel Garthwaite +# @date (last) 12-Oct-2022 # @author (original) Dara Navaei # @date (original) 01-Mar-2022 # Index: tests/dg_tests.py =================================================================== diff -u -rcd913c56192aee8e251d0486d044442411902def -r889854fedb9ee0711460f6addd9b79e0a5ece718 --- tests/dg_tests.py (.../dg_tests.py) (revision cd913c56192aee8e251d0486d044442411902def) +++ tests/dg_tests.py (.../dg_tests.py) (revision 889854fedb9ee0711460f6addd9b79e0a5ece718) @@ -44,6 +44,7 @@ from dialin.hd.valves import HDValves from dialin.hd.voltages import HDMonitoredVoltages from dialin.hd.pretreatment import PreTreatmentRsrvrState +from dialin.common.dg_defs import DGFlushStates from time import sleep from datetime import datetime import sys @@ -68,7 +69,7 @@ def get_heat_disinfect_mode_info(): info = ('State, {}, Overall_elapsed_time, {}, State_elapsed_time, {}, Disinfect_elapsed_time, {}, ' - 'R1_level, {:5.3f}, R2_level, {:5.3f}, Top_alarm, {}, UI_state, {} ' + 'R1_level, {:5.3f}, R2_level, {:5.3f}, Top_alarm, {}, UI_state, {}, ' .format(DGHeatDisinfectStates(dg.heat_disinfect.heat_disinfect_state).name, dg.heat_disinfect.overall_elapsed_time, dg.heat_disinfect.state_elapsed_time, dg.heat_disinfect.heat_disinfect_count_down_time, dg.heat_disinfect.r1_level, @@ -77,6 +78,14 @@ return info +def get_flush_mode_info(): + info = ('State, {}, Overall_elapsed_time, {}, State_elapsed_time, {}, Drain_vol, {:5.3f}, Top_alarm, {}, ' + .format(DGFlushStates(dg.flush.flush_state).name, dg.flush.overall_elapsed_time, dg.flush.state_elapsed_time, + dg.flush.flush_drain_line_volume_l, hd.alarms.alarm_top)) + + return info + + 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, {}, ' @@ -155,11 +164,12 @@ def get_drain_states_info(): - info = ('Drain, {}, DAC, {}, Tgt_RPM, {}, Curr_RPM, {}, PRd, {:5.3f}, PDr, {:5.3f}, '. - format(DrainPumpStates(dg.drain_pump.drain_pump_state).name, dg.drain_pump.dac_value, - dg.drain_pump.target_drain_pump_rpm, dg.drain_pump.current_drain_pump_rpm, - dg.pressures.drain_pump_inlet_pressure, - dg.pressures.drain_pump_outlet_pressure)) + info = ('Drain, {}, DAC, {}, Tgt_RPM, {}, Curr_RPM, {}, PRd, {:5.3f}, PDr, {:5.3f}, Drain_curr_A, {:5.3f}, ' + 'Drain_dir, {}, ' + .format(DrainPumpStates(dg.drain_pump.drain_pump_state).name, dg.drain_pump.dac_value, + dg.drain_pump.target_drain_pump_rpm, dg.drain_pump.current_drain_pump_rpm, + dg.pressures.drain_pump_inlet_pressure, dg.pressures.drain_pump_outlet_pressure, + dg.drain_pump.drain_pump_current_A, dg.drain_pump.drain_pump_direction)) return info @@ -171,23 +181,16 @@ def get_ro_info(): - info = ('RO, {}, PPi, {:5.3f}, PPo, {:5.3f}, PWM, {:5.3f}, Flow, {:5.3f}, Tgt_flow, {:5.3f}, Dia_flow, {:5.3f}, ' + info = ('RO, {}, PPi, {:5.3f}, PPo, {:5.3f}, PWM, {:5.3f}, Flow, {:5.3f}, Tgt_flow, {:5.3f}, ' 'Feedback_PWM, {:5.3f}, Flow_with_conc_pumps, {:5.3f}, Dialysate_flow, {:5.3f}, ' .format(dg.ro_pump.ro_pump_state, dg.pressures.ro_pump_inlet_pressure, dg.pressures.ro_pump_outlet_pressure, dg.ro_pump.pwm_duty_cycle_pct, - dg.ro_pump.measured_flow_rate_lpm, dg.ro_pump.target_flow_lpm, dg.dialysate_flow_sensor.flow_rate, - dg.ro_pump.feedback_duty_cycle_pct, dg.ro_pump.measured_raw_flow_rate_with_conc_pumps_mlp, - dg.dialysate_flow_sensor.flow_rate)) + dg.flow_sensors.measured_ro_flow_LPM, dg.ro_pump.target_flow_lpm, + dg.ro_pump.feedback_duty_cycle_pct, + dg.flow_sensors.measured_ro_flow_with_cp_LPM, dg.flow_sensors.measured_dialysate_flow_LPM)) return info -def get_new_ro_info(): - info = ('New_flow, {:5.3f}, Tgt_flow, {:5.3f}, New_flow_with_conc_pumps, {:5.3f}, New_dialysate_flow, {:5.3f}, ' - .format(dg.dialysate_flow_sensor.new_ro_flow, dg.dialysate_flow_sensor.new_dialysate_flow, - dg.dialysate_flow_sensor.new_ro_flow_with_conc, dg.dialysate_flow_sensor.new_dialysate_flow)) - return info - - def get_heaters_with_no_temp_info(): info = ('Pri_main_DC, {:5.3f}, Pri_state, {}, Trimmer_DC, {:5.3f}, Trim_state, {}, ' 'Primary_target_temp, {:5.3f}, Trimmer_target_temp, {:5.3f}, '. @@ -200,16 +203,18 @@ 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}, ' - 'Primary_calc_temp, {:5.3f}, Trimmer_calc_temp, {:5.3f}, Primary_volt, {:5.3f}, Primary_sec_volt, {:5.3f},' + 'Primary_calc_temp, {:5.3f}, Trimmer_calc_temp, {:5.3f}, Primary_power, {:5.3f}, ' + 'Primary_volt, {:5.3f}, Primary_sec_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.primary_calc_target_temperature, dg.heaters.trimmer_calc_target_temperature, - dg.voltages.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_24V_PRIM_HTR_V.value], - dg.voltages.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_24V_PRIM_HTR_GND_V.value], - dg.voltages.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_24V_TRIM_HTR_V.value])) + dg.voltages.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_24V_POWER_PRIM_HTR_V.value], + dg.voltages.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_24V_GND_MAIN_PRIM_HTR_V.value], + dg.voltages.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_24V_GND_SMALL_PRIM_HTR_V.value], + dg.voltages.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_24V_GND_TRIM_HTR_V.value])) return info @@ -284,13 +289,11 @@ 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_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.blood_leak_state)) + info = ('Blood_leak_state, {}, Blood_leak_status, {}, Blood_leak_detect_set_point, {}, Blood_leak_detect_level, {},' + ' Blood_leak_led_intensity, {}, ' + .format(hd.blood_leak.get_blood_leak_state(), hd.blood_leak.get_blood_leak_status(), + hd.blood_leak.get_blood_leak_detect_set_point(), hd.blood_leak.get_blood_leak_detect_level(), + hd.blood_leak.get_blood_leak_led_intensity())) return info @@ -312,6 +315,10 @@ return info +def get_hd_valves_info(): + info = ('Air_trap' ) + + def get_dg_idle_bad_fill_info(): info = ('Bad_fill_state, {}, ' .format(DGGenIdleModeBadFillSubStates(dg.gen_idle.sub_state).name)) @@ -324,6 +331,7 @@ hd.voltages.monitored_voltages[HDMonitoredVoltages.MONITORED_LINE_24V_REGEN.value])) return info + def run_dg(): counter = 1 timer = 0.1 @@ -397,14 +405,19 @@ counter = 1 start = False - sleep_time = 0.05 + sleep_time = 1 - dg.heaters.cmd_heaters_broadcast_interval_override(50) - sleep(1) - dg.voltages.cmd_monitored_voltages_broadcast_interval_override(50) + #dg.heaters.cmd_heaters_broadcast_interval_override(50) + #sleep(1) + #dg.voltages.cmd_monitored_voltages_broadcast_interval_override(50) #dg.concentrate_pumps.cmd_concentrate_pump_broadcast_interval_override(50) - #sleep(0.5) + #sleep(1) + #dg.hd_proxy.cmd_start_stop_dg() + #sleep(1) + + #dg.hd_proxy.cmd_fill() + try: while True: hd_run = get_hd_run_info() @@ -414,8 +427,7 @@ drain = get_drain_states_info() load_cell = get_load_cells_info() valves = get_dg_valves_states() - ro = str(0)#get_ro_info() - new_ro = str(0)#get_new_ro_info() + ro = get_ro_info() temp = get_temperature_sensors_info() heaters = get_heaters_info() dg_fans = get_dg_fans_info() @@ -424,9 +436,10 @@ hd_pumps = get_hd_pumps_info() fill_info = get_dg_fill_info() idle_bad_fill = get_dg_idle_bad_fill_info() + uv = get_uv_reactors_info() var = str(datetime.now()) + ', ' + hd_run + dg_run + hd_rsrvrs + dg_rsrvrs + load_cell + drain + ro + \ - new_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 + uv + '\r' if hd.alarms.get_alarm_state(97) and start is False: dg.conductivity_sensors.cmd_conductivity_sensor_override(ConductivitySensorsEnum.CD2.value, 13700.00) @@ -484,7 +497,9 @@ def run_heat_disinfect(): complete_counter = 1 f = open("/home/fw/projects/dialin/tests/Heat_disinfect.log", "w") - #dg.hd_proxy.cmd_start_stop_dg_heat_disinfect() + #dg.heaters.cmd_heaters_broadcast_interval_override(50) + #sleep(1) + dg.hd_proxy.cmd_start_stop_dg_heat_disinfect() try: while True: @@ -496,29 +511,30 @@ ro = get_ro_info() temp = get_temperature_sensors_info() heaters = get_heaters_info() + uv = get_uv_reactors_info() dg_fans = get_dg_fans_info() hd_fans = get_hd_fans_info() conc = get_concentrate_pumps_info() - var = disinfect + load_cell + drain + ro + temp + heaters + dg_fans + hd_fans + valves + conc + '\r' + var = disinfect + load_cell + drain + ro + temp + heaters + uv + dg_fans + hd_fans + valves + conc + '\r' print(var) f.write(var) sleep(1) # If the mode came back to standby or standby solo - if dg.dg_operation_mode == 3 or dg.dg_operation_mode == 4: + #if dg.dg_operation_mode == 3 or dg.dg_operation_mode == 4: # If it is the first call, stop heat disinfect - if complete_counter == 1: - dg.hd_proxy.cmd_start_stop_dg_heat_disinfect(start=False) + # if complete_counter == 1: + # dg.hd_proxy.cmd_start_stop_dg_heat_disinfect(start=False) # Write a few more complete states to make sure the complete state items are recorded - elif complete_counter == 3: + # elif complete_counter == 3: # pass - f.close() - break + # f.close() + # break - complete_counter += 1 + # complete_counter += 1 except KeyboardInterrupt: dg.hd_proxy.cmd_start_stop_dg_heat_disinfect(start=False) @@ -575,51 +591,52 @@ sleep(1) -def test_dg_fans_alarms(): - f = open("/home/fw/projects/dialin/tests/dg_fans_issues.log", "w") +def run_flush_mode(): + complete_counter = 1 + f = open("/home/fw/projects/dialin/tests/flush_mode.log", "w") + dg.hd_proxy.cmd_start_stop_dg_flush() + #dg.cmd_dg_software_reset_request() - for fan in DGFansNames.__members__: + try: + while True: + flush = get_flush_mode_info() + load_cell = get_load_cells_info() + drain = get_drain_states_info() + ro = get_ro_info() + conc = get_concentrate_pumps_info() + uv_reactors = get_uv_reactors_info() + valves = get_dg_valves_states() - dg.cmd_dg_software_reset_request() - sleep(1) - dg.alarms.clear_dialin_alarms() - i = 0 - ack = False - counter = 0 + var = flush + uv_reactors + load_cell + drain + ro + conc + valves + '\r' - while True: - if dg.dg_operation_mode == DGOperationModes.DG_OP_MODE_STANDBY.value: - dg.cmd_log_in_to_dg() - sleep(1) - dg.fans.cmd_fans_data_broadcast_interval_override(50, reset=0) - sleep(1) - dg.fans.cmd_fans_rpm_override(DGFansNames[fan].value, 1000.0, reset=0) - start_time = datetime.now() - while True: - alarm_state = dg.alarms.get_alarm_state(AlarmList.ALARM_ID_DG_FAN_RPM_OUT_OF_RANGE.value) - info = str(fan) + ', ' + str(alarm_state) + ', ' + str(datetime.now() - start_time) + ', ' + \ - get_dg_fans_info() + '\r' - print(info) - f.write(info) + print(var) + f.write(var) + sleep(1) - if alarm_state: - if ack is False and counter == 0: - hd.ui.cmd_ui_user_alarm_response(3) - ack = True - if ack: - if i == 0 and counter == 50: - dg.fans.cmd_fans_rpm_alarm_start_time_offset(86390) - i += 1 - elif alarm_state and i > 0: - break - counter += 1 + # If the mode came back to standby or standby solo + if dg.dg_operation_mode == 3 or dg.dg_operation_mode == 4: - sleep(0.05) - break + if complete_counter == 1: + dg.hd_proxy.cmd_start_stop_dg_flush() + # Write a few more complete states to make sure the complete state items are recorded + if complete_counter == 3: + f.close() + #events = dg.events.get_dg_events(2, 60) + #for event in events: + # print(event) + break + complete_counter += 1 -def test_dvt_drain_pump(): + except KeyboardInterrupt: + dg.hd_proxy.cmd_start_stop_dg_flush(start=False) + f.close() + #events = dg.events.get_dg_events(2, 50) + #for event in events: + # print(event) + +def test_dvt_drain_pump(): dg.drain_pump.cmd_drain_pump_set_rpm(2000) try: while True: @@ -630,7 +647,6 @@ def test_conc_pumps(): - dg.concentrate_pumps.cmd_concentrate_pump_state_change_request(0, True) sleep(1) #dg.concentrate_pumps.cmd_concentrate_pump_state_change_request(1, True) @@ -673,15 +689,17 @@ hd.cmd_log_in_to_hd() sleep(1) - #run_heat_disinfect() + run_heat_disinfect() + #run_flush_mode() + #run_chemical_disinfect() #run_dg() # cmd_set_disinfect_ui_screen() - collect_treatment_data() + #collect_treatment_data() #collect_hd_treatment() @@ -690,10 +708,6 @@ # sleep(1) #while True: - # print(get_new_ro_info(), get_ro_info()) - # sleep(1) - - #while True: # print(dg.rtc.get_rtc_epoch(), hd.rtc.get_rtc_epoch()) # sleep(1) @@ -714,3 +728,10 @@ #dg.ro_pump.cmd_set_ro_flow_rate(0.6) + #dg.flow_sensors.cmd_measured_flow_sensor_value_lpm_override(1, 0.8, reset=1) + + #while True: + + # print(get_ro_info()) + # sleep(1) +