Index: dialin/dg/dialysate_fill.py =================================================================== diff -u -rceb2d67297d31ac7c816f01cd4f836f071c1d39a -rdb884616e9c94ad4e94ad468b42b16abfd1b5988 --- dialin/dg/dialysate_fill.py (.../dialysate_fill.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) +++ dialin/dg/dialysate_fill.py (.../dialysate_fill.py) (revision db884616e9c94ad4e94ad468b42b16abfd1b5988) @@ -7,8 +7,8 @@ # # @file dialysate_fill.py # -# @author (last) Dara Navaei -# @date (last) 02-Jan-2023 +# @author (last) Sean Nash +# @date (last) 20-Feb-2023 # @author (original) Hung Nguyen # @date (original) 10-Mar-2022 # @@ -69,10 +69,10 @@ @return: List containing fill mode data values: [ avg_acid, avg_bicarb, first_fill, - pctDiffConduct, used_acid, used_bicarb ] + pctDiffConduct, used_acid, used_bicarb, total_volume ] """ return [self.avg_acid, self.avg_bicarb, self.first_fill, - self.pctDiffConduct, self.used_acid, self.used_bicarb] + self.pctDiffConduct, self.used_acid, self.used_bicarb, self.total_volume] @publish(["dg_fill_mode_timestamp","avg_acid", "avg_bicarb", "first_fill", "pctDiffConduct", "used_acid", "used_bicarb", "total_volume"]) def _handler_fill_mode_monitor_sync(self, message, timestamp=0.0): Index: dialin/dg/flow_sensors.py =================================================================== diff -u -rceb2d67297d31ac7c816f01cd4f836f071c1d39a -rdb884616e9c94ad4e94ad468b42b16abfd1b5988 --- dialin/dg/flow_sensors.py (.../flow_sensors.py) (revision ceb2d67297d31ac7c816f01cd4f836f071c1d39a) +++ dialin/dg/flow_sensors.py (.../flow_sensors.py) (revision db884616e9c94ad4e94ad468b42b16abfd1b5988) @@ -7,8 +7,8 @@ # # @file flow_sensors.py # -# @author (last) Dara Navaei -# @date (last) 30-Sep-2022 +# @author (last) Sean Nash +# @date (last) 07-Mar-2023 # @author (original) Dara Navaei # @date (original) 19-Sep-2022 # @@ -54,6 +54,8 @@ self.measured_ro_flow_LPM = 0.0 self.measured_dialysate_flow_LPM = 0.0 self.measured_ro_flow_with_cp_LPM = 0.0 + self.measured_raw_ro_flow_LPM = 0.0 + self.measured_raw_dialysate_flow_LPM = 0.0 self.dg_flow_sensors_timestamp = 0.0 if self.can_interface is not None: @@ -83,15 +85,38 @@ """ return self.measured_ro_flow_with_cp_LPM + def get_measured_raw_ro_flow(self): + """ + Gets the measured raw (uncalibrated) flow value from DG's ro pump (FMP) + @return: The raw RO flow rate in L/min + """ + return self.measured_raw_ro_flow_LPM + + def get_measured_raw_dialysate_flow(self): + """ + Gets the measured raw (uncalibrated) flow value from DG's dialydate flow sensor (FMD) + @return: The raw dialysate flow rate in L/min + """ + return self.measured_raw_dialysate_flow_LPM + @publish(["dg_flow_sensors_timestamp","measured_ro_flow_LPM", "measured_dialysate_flow_LPM", "measured_ro_flow_with_cp_LPM"]) + "measured_raw_ro_flow_LPM", "measured_raw_dialysate_flow_LPM"]) def _handler_flow_sensors_sync(self, message, timestamp=0.0): + """ + Handles incoming DG flow sensor broadcast messages and records latest reported flow rates. + @return: none + """ self.measured_ro_flow_LPM = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_1:MsgFieldPositions.END_POS_FIELD_1]))[0] self.measured_ro_flow_with_cp_LPM = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_2:MsgFieldPositions.END_POS_FIELD_2]))[0] self.measured_dialysate_flow_LPM = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_3:MsgFieldPositions.END_POS_FIELD_3]))[0] + self.measured_raw_ro_flow_LPM = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_4:MsgFieldPositions.END_POS_FIELD_4]))[0] + self.measured_raw_dialysate_flow_LPM = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_5:MsgFieldPositions.END_POS_FIELD_5]))[0] self.dg_flow_sensors_timestamp = timestamp def cmd_measured_flow_sensor_value_lpm_override(self, sensor_id: int, rate: float, reset: int = NO_RESET) -> int: Index: dialin/hd/blood_flow.py =================================================================== diff -u -r1a02639c3941c0afc248ef93d7e1c521317e8d00 -rdb884616e9c94ad4e94ad468b42b16abfd1b5988 --- dialin/hd/blood_flow.py (.../blood_flow.py) (revision 1a02639c3941c0afc248ef93d7e1c521317e8d00) +++ dialin/hd/blood_flow.py (.../blood_flow.py) (revision db884616e9c94ad4e94ad468b42b16abfd1b5988) @@ -8,7 +8,7 @@ # @file blood_flow.py # # @author (last) Sean Nash -# @date (last) 22-Sep-2022 +# @date (last) 19-Feb-2023 # @author (original) Peter Lucia # @date (original) 02-Apr-2020 # @@ -52,6 +52,7 @@ self.measured_blood_pump_mc_current = 0.0 self.pwm_duty_cycle_pct = 0.0 self.rotor_count = 0 + self.pres_blood_flow_rate = 0 def get_target_blood_flow_rate(self): """ @@ -117,9 +118,17 @@ """ return self.rotor_count + def get_pres_blood_flow_rate(self): + """ + Gets the prescribed blood flow rate + + @return: the prescribed blood flow rate + """ + return self.pres_blood_flow_rate + @publish(["hd_blood_flow_timestamp", "target_blood_flow_rate", "measured_blood_flow_rate", "measured_blood_pump_rotor_speed", "measured_blood_pump_speed", "measured_blood_pump_mc_speed", "measured_blood_pump_mc_current", - "pwm_duty_cycle_pct", "rotor_count"]) + "pwm_duty_cycle_pct", "rotor_count", "pres_blood_flow_rate"]) def _handler_blood_flow_sync(self, message, timestamp=0.0): """ Handles published blood flow data messages. Blood flow data are captured @@ -145,6 +154,8 @@ message['message'][MsgFieldPositions.START_POS_FIELD_7:MsgFieldPositions.END_POS_FIELD_7])) rot = struct.unpack('I', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_8:MsgFieldPositions.END_POS_FIELD_8])) + pres = struct.unpack('I', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_9:MsgFieldPositions.END_POS_FIELD_9])) self.target_blood_flow_rate = tgt[0] self.measured_blood_flow_rate = flow[0] @@ -154,6 +165,7 @@ self.measured_blood_pump_mc_current = mccurr[0] self.pwm_duty_cycle_pct = pwm[0] self.rotor_count = rot[0] + self.pres_blood_flow_rate = pres[0] self.hd_blood_flow_timestamp = timestamp def cmd_blood_flow_set_point_override(self, flow: int, mode: int = PUMP_CONTROL_MODE_CLOSED_LOOP, Index: dialin/hd/dialysate_inlet_flow.py =================================================================== diff -u -r1a02639c3941c0afc248ef93d7e1c521317e8d00 -rdb884616e9c94ad4e94ad468b42b16abfd1b5988 --- dialin/hd/dialysate_inlet_flow.py (.../dialysate_inlet_flow.py) (revision 1a02639c3941c0afc248ef93d7e1c521317e8d00) +++ dialin/hd/dialysate_inlet_flow.py (.../dialysate_inlet_flow.py) (revision db884616e9c94ad4e94ad468b42b16abfd1b5988) @@ -8,7 +8,7 @@ # @file dialysate_inlet_flow.py # # @author (last) Sean Nash -# @date (last) 27-Oct-2022 +# @date (last) 19-Feb-2023 # @author (original) Peter Lucia # @date (original) 02-Apr-2020 # @@ -54,6 +54,7 @@ self.measured_dialysate_inlet_pump_mc_current = 0.0 self.pwm_duty_cycle_pct = 0.0 self.rotor_count = 0 + self.pres_dialysate_flow_rate = 0 self.hd_dial_inlet_flow_timestamp = 0.0 def get_target_dialysate_inlet_flow_rate(self): @@ -120,6 +121,14 @@ """ return self.rotor_count + def get_pres_dialysate_flow_rate(self): + """ + Gets the prescribed dialysate flow rate + + @return: the prescribed dialysate flow rate + """ + return self.pres_dialysate_flow_rate + @publish([ "hd_dial_inlet_flow_timestamp", "target_dialysate_inlet_flow_rate", @@ -128,7 +137,7 @@ "measured_dialysate_inlet_pump_speed", "measured_dialysate_inlet_pump_mc_speed", "measured_dialysate_inlet_pump_mc_current", - "pwm_duty_cycle_pct", "rotor_count" + "pwm_duty_cycle_pct", "rotor_count", "pres_dialysate_flow_rate" ]) def _handler_dialysate_inlet_flow_sync(self, message, timestamp=0.0): """ @@ -155,6 +164,8 @@ message['message'][MsgFieldPositions.START_POS_FIELD_7:MsgFieldPositions.END_POS_FIELD_7])) rot = struct.unpack('I', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_8:MsgFieldPositions.END_POS_FIELD_8])) + pres = struct.unpack('I', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_9:MsgFieldPositions.END_POS_FIELD_9])) self.target_dialysate_inlet_flow_rate = tgt[0] self.measured_dialysate_inlet_flow_rate = flow[0] @@ -164,6 +175,7 @@ self.measured_dialysate_inlet_pump_mc_current = mccurr[0] self.pwm_duty_cycle_pct = pwm[0] self.rotor_count = rot[0] + self.pres_dialysate_flow_rate = pres[0] self.hd_dial_inlet_flow_timestamp = timestamp def cmd_dialysate_inlet_flow_set_point_override(self,