Index: leahi_dialin/dd/dialysate_delivery.py =================================================================== diff -u -rfd7a25d8f068bcba594c01410a02a03f6afbcd59 -re4ea016b22780f3c5924479812ab07394c05ae29 --- leahi_dialin/dd/dialysate_delivery.py (.../dialysate_delivery.py) (revision fd7a25d8f068bcba594c01410a02a03f6afbcd59) +++ leahi_dialin/dd/dialysate_delivery.py (.../dialysate_delivery.py) (revision e4ea016b22780f3c5924479812ab07394c05ae29) @@ -175,7 +175,7 @@ """ message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dd_ch_id, - message_id=MsgIds.MSG_ID_TESTER_LOGIN_REQUEST.value, + message_id=MsgIds.MSG_ID_DD_TESTER_LOGIN_REQUEST.value, payload=list(map(int, map(ord, self.DD_LOGIN_PASSWORD)))) self.logger.debug("Logging in...") Index: tests/test_dd.py =================================================================== diff -u --- tests/test_dd.py (revision 0) +++ tests/test_dd.py (revision e4ea016b22780f3c5924479812ab07394c05ae29) @@ -0,0 +1,105 @@ +########################################################################### +# +# Copyright (c) 2024-2024 Diality Inc. - All Rights Reserved. +# +# 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 test_dd.py +# +# @author (last) Vinayakam Mani +# @date (last) 26-Nov-2024 +# @author (original) Vinayakam Mani +# @date (original) 26-Nov-2024 +# +############################################################################ + +import sys +sys.path.append("..") +from leahi_dialin.td.treatment_delivery import TD +from leahi_dialin.dd.dialysate_delivery import DD +#from leahi_dialin.td.valves import ValvesEnum +#from leahi_dialin.dd.temperatures import DGTemperaturesNames +from time import sleep + +if __name__ == "__main__": + # create an TD object called td + td = TD(log_level="DEBUG") + # create a DD object called dd + dd = DD(log_level="DEBUG") + sleep(2) + +# td.ui.cmd_ui_start_treatment_request() +# exit(0) + + # log in to TD and DD as tester +# if td.cmd_log_in_to_td() == 0: +# exit(1) + #while True: + # sleep(1) + if dd.cmd_log_in_to_dd() == 0: + #sleep(1) + exit(1) + sleep(1) + + +# td.bloodflow.cmd_blood_flow_set_point_override(0) +# exit(1) + + # create log file + with open("DD_test.log", "w") as f: + + # collect sensors log from DD + while True: + sleep(1) + dialPump = ", DP.fr, " + '{:7.1f}'.format(dd.dialysate_pumps.dial_pump_target_rpm_fresh) + \ + ", DP.sr, " + '{:7.1f}'.format(dd.dialysate_pumps.dial_pump_target_rpm_spent) + \ + ", DP.fs, " + '{:6.1f}'.format(dd.dialysate_pumps.dial_pump_measured_spd_fresh) + \ + ", DP.ss, " + '{:7.1f}'.format(dd.dialysate_pumps.dial_pump_measured_spd_spent) + \ + ", DP.fc, " + '{:7.1f}'.format(dd.dialysate_pumps.dial_pump_current_spd_fresh) + \ + ", DP.sc, " + '{:6.1f}'.format(dd.dialysate_pumps.dial_pump_current_spd_spent) + \ + ", DP.s1, " + '{:2d}'.format(dd.dialysate_pumps.dial_pump_state_fresh) + \ + ", DP.s2, " + '{:2d}'.format(dd.dialysate_pumps.dial_pump_state_spent) + \ + ", DP.ft, " + '{:6.1f}'.format(dd.dialysate_pumps.dial_pump_tgt_pressure_fresh) + \ + ", DP.fp, " + '{:7.1f}'.format(dd.dialysate_pumps.dial_pump_measured_pressure_fresh) + \ + ", DP.sp, " + '{:7.1f}'.format(dd.dialysate_pumps.dial_pump_measured_pressure_spent) + \ + ", DP.fm, " + '{:6.1f}'.format(dd.dialysate_pumps.dial_pump_measured_current_fresh) + \ + ", DP.sm, " + '{:7.1f}'.format(dd.dialysate_pumps.dial_pump_measured_current_spent) + \ + ", DP.c1, " + '{:2d}'.format(dd.dialysate_pumps.dial_pump_control_fresh) + \ + ", DP.c2, " + '{:2d}'.format(dd.dialysate_pumps.dial_pump_control_spent) + \ + ", DP.fd, " + '{:2d}'.format(dd.dialysate_pumps.dial_pump_dir_err_cnt_fresh) + \ + ", DP.sd, " + '{:2d}'.format(dd.dialysate_pumps.dial_pump_dir_err_cnt_spent) + \ + ", DP.d1, " + '{:2d}'.format(dd.dialysate_pumps.dial_pump_measured_dir_fresh) + \ + ", DP.d2, " + '{:2d}'.format(dd.dialysate_pumps.dial_pump_measured_dir_spent) + Levels = "L.f1, " + '{:2d}'.format(dd.levels.floater1) + \ + ", L.f2, " + '{:2d}'.format(dd.levels.floater1) + \ + ", L.b, " + '{:2d}'.format(dd.levels.bicarb_level) + \ + ", L.s, " + '{:2d}'.format(dd.levels.spent_dialysate_level) + pressure = ", Pwi, " + '{:8.1f}'.format(dd.pressure_sensors.filtered_water_inlet_input_pressure) + \ + ", Pwo, " + '{:8.1f}'.format(dd.pressure_sensors.filtered_water_inlet_output_pressure) + \ + ", Pho, " + '{:8.1f}'.format(dd.pressure_sensors.filtered_hydraulics_output_pressure) + \ + ", PBi, " + '{:8.1f}'.format(dd.pressure_sensors.filtered_bibag_presssure) + \ + ", Psd, " + '{:8.1f}'.format(dd.pressure_sensors.filtered_spent_dialysate_pressure) + \ + ", Pfd, " + '{:8.1f}'.format(dd.pressure_sensors.filtered_fresh_dialysate_pressure) + \ + ", Ptm, " + '{:8.1f}'.format(dd.pressure_sensors.filtered_transmembrane_pressure) + \ + ", Twi, " + '{:8.1f}'.format(dd.pressure_sensors.filtered_water_inlet_input_temp) + \ + ", Two, " + '{:8.1f}'.format(dd.pressure_sensors.filtered_water_inlet_output_temp) + \ + ", Tho, " + '{:8.1f}'.format(dd.pressure_sensors.filtered_hydraulics_output_temp) + \ + ", Tbi, " + '{:8.1f}'.format(dd.pressure_sensors.filtered_bibag_temp) + \ + ", Tsd, " + '{:8.1f}'.format(dd.pressure_sensors.filtered_spent_dialysate_temp) + \ + ", Tfd, " + '{:8.1f}'.format(dd.pressure_sensors.filtered_fresh_dialysate_temp) + \ + ", Ttm, " + '{:8.1f}'.format(dd.pressure_sensors.transmembrane_temp) + valves = ", DDVlvs, " + '{:4X}'.format(dd.valves.valve_states_all) + + # log data + f.write(dialPump) + f.write(Levels) + f.write(pressure) + f.write(valves) + f.write("\n") + + # print to console + print("Dialysate Pumps: "+dialPump) + print(" Levels: "+Levels) + print(" Pressure: "+pressure) + print(" DD Valves: "+valves) Index: tests/test_uf.py =================================================================== diff -u -rb9ba64273bb19c12ab9dcd4dd5dc65d7f0b59e47 -re4ea016b22780f3c5924479812ab07394c05ae29 --- tests/test_uf.py (.../test_uf.py) (revision b9ba64273bb19c12ab9dcd4dd5dc65d7f0b59e47) +++ tests/test_uf.py (.../test_uf.py) (revision e4ea016b22780f3c5924479812ab07394c05ae29) @@ -58,7 +58,7 @@ # ro = RO(log_level="DEBUG") sleep(2) - # log in to TD, DD and RO as tester + # log in to TD, DD and RO as tester if td.cmd_log_in_to_td() == 0: exit(1) # if dd.cmd_log_in_to_dd() == 0: @@ -67,8 +67,8 @@ # exit(1) # sleep(1) - # create log file - with open("UF_test.log", "w") as f: + # create log file + with open("UF_test.log", "w") as f: # collect data and display/log it while True: