Index: dialin/dg/dialysate_generator.py =================================================================== diff -u -re8afa8d6323ede293e1fb094a461555fcf7ce0d9 -r2a9294e72f995e2800d7303f6cc2a67d1839654b --- dialin/dg/dialysate_generator.py (.../dialysate_generator.py) (revision e8afa8d6323ede293e1fb094a461555fcf7ce0d9) +++ dialin/dg/dialysate_generator.py (.../dialysate_generator.py) (revision 2a9294e72f995e2800d7303f6cc2a67d1839654b) @@ -39,6 +39,7 @@ from .service_record import DGServiceNVRecord from .scheduled_runs_record import DGScheduledRunsNVRecord from .valves import DGValves +from .voltages import import DGVoltages from ..utils.conversions import integer_to_bytearray from ..protocols.CAN import (DenaliCanMessenger, DenaliMessage, DenaliChannels) from ..utils.base import _AbstractSubSystem, _publish, _LogManager @@ -164,6 +165,7 @@ self.service_record = DGServiceNVRecord(self.can_interface, self.logger) self.scheduled_runs_record = DGScheduledRunsNVRecord(self.can_interface, self.logger) self.valves = DGValves(self.can_interface, self.logger) + self.voltages = DGVoltages(self.can_interface, self.logger) def get_version(self): """ Index: tests/test_voltages.py =================================================================== diff -u -re75b8c0ebfdb35c2fc1fb2a66edf30ed1d23ada9 -r2a9294e72f995e2800d7303f6cc2a67d1839654b --- tests/test_voltages.py (.../test_voltages.py) (revision e75b8c0ebfdb35c2fc1fb2a66edf30ed1d23ada9) +++ tests/test_voltages.py (.../test_voltages.py) (revision 2a9294e72f995e2800d7303f6cc2a67d1839654b) @@ -17,54 +17,74 @@ import sys sys.path.append("..") from dialin.hd.hemodialysis_device import HD +from dialin.dg.dialysate_generator import DG from time import sleep from dialin.hd.voltages import HDMonitoredVoltages +from dialin.dg.voltages import DGMonitoredVoltages from dialin.hd.constants import RESET, NO_RESET if __name__ == "__main__": # create an HD object called hd hd = HD() + dg = DG() sleep(2) # log in to HD and DG as tester if hd.cmd_log_in_to_hd() == 0: print("Failed to log into HD.") exit(1) + if dg.cmd_log_in_to_dg() == 0: + print("Failed to log into DG.") + exit(1) sleep(1) # override alarms/voltages broadcast interval to 100 ms - hd.voltages.cmd_monitored_voltages_broadcast_interval_override(100,NO_RESET) - hd.alarms.cmd_alarm_info_broadcast_interval_override(100,NO_RESET) + #hd.voltages.cmd_monitored_voltages_broadcast_interval_override(100,NO_RESET) + #hd.alarms.cmd_alarm_info_broadcast_interval_override(100,NO_RESET) # create log file with open("/home/fw/projects/dialin/tests/v_test.log", "w") as f: # write column header labels to log file - header = "1.2V, 3.3V, 5V Logic, 5V Sensors, 24V, 24V Regen, FPGA RefV, PBA RefV, AlmCurrHg, AlmCurrLg, AlmBckpCurr\n" + header = "HD1.2V, HD3.3V, HD5V Logic, HD5V Sensors, HD24V, HD24V Regen, HDFPGA RefV, HDPBA RefV, HDAlmCurrHg, HDAlmCurrLg, HDAlmBckpCurr," + \ + "DG1V FPGA, DG1.2V, DG1.8V Proc, DG1.8V FPGA, DGVRef, DGRef1, DGRef2, DG3.3V, DG3.3V Sensors, DG5V Logic, DG5V Sensors, DG24V, DG24V Htr, DG24V Trim\n" f.write(header) # write monitored voltages related data from HD to log file while True: sleep(0.1) - v = hd.voltages.get_monitored_voltages() - a1 = hd.alarms.alarm_audio_curr_hg - a2 = hd.alarms.alarm_audio_curr_lg - a3 = hd.alarms.alarm_backup_audio_curr - voltageData = '{:11.6f}'.format(v[HDMonitoredVoltages.MONITORED_LINE_1_2V.value]) + \ - ", " + '{:11.6f}'.format(v[HDMonitoredVoltages.MONITORED_LINE_3_3V.value]) + \ - ", " + '{:11.6f}'.format(v[HDMonitoredVoltages.MONITORED_LINE_5V_LOGIC.value]) + \ - ", " + '{:11.6f}'.format(v[HDMonitoredVoltages.MONITORED_LINE_5V_SENSORS.value]) + \ - ", " + '{:11.6f}'.format(v[HDMonitoredVoltages.MONITORED_LINE_24V.value]) + \ - ", " + '{:11.6f}'.format(v[HDMonitoredVoltages.MONITORED_LINE_24V_REGEN.value]) + \ - ", " + '{:11.6f}'.format(v[HDMonitoredVoltages.MONITORED_LINE_FPGA_REF_V.value]) + \ - ", " + '{:11.6f}'.format(v[HDMonitoredVoltages.MONITORED_LINE_PBA_REF_V.value]) + \ + vHd = hd.voltages.get_monitored_voltages() + vDg = dg.voltages.get_monitored_voltages() + hdVoltageData = '{:11.6f}'.format(vHd[HDMonitoredVoltages.MONITORED_LINE_1_2V.value]) + \ + ", " + '{:11.6f}'.format(vHd[HDMonitoredVoltages.MONITORED_LINE_3_3V.value]) + \ + ", " + '{:11.6f}'.format(vHd[HDMonitoredVoltages.MONITORED_LINE_5V_LOGIC.value]) + \ + ", " + '{:11.6f}'.format(vHd[HDMonitoredVoltages.MONITORED_LINE_5V_SENSORS.value]) + \ + ", " + '{:11.6f}'.format(vHd[HDMonitoredVoltages.MONITORED_LINE_24V.value]) + \ + ", " + '{:11.6f}'.format(vHd[HDMonitoredVoltages.MONITORED_LINE_24V_REGEN.value]) + \ + ", " + '{:11.6f}'.format(vHd[HDMonitoredVoltages.MONITORED_LINE_FPGA_REF_V.value]) + \ + ", " + '{:11.6f}'.format(vHd[HDMonitoredVoltages.MONITORED_LINE_PBA_REF_V.value]) + \ ", " + '{:11.6f}'.format(hd.alarms.alarm_audio_curr_hg) + \ ", " + '{:11.6f}'.format(hd.alarms.alarm_audio_curr_lg) + \ ", " + '{:11.6f}'.format(hd.alarms.alarm_backup_audio_curr) + "DG1V FPGA, DG1.2V, DG1.8V Proc, DG1.8V FPGA, DGVRef, DGRef1, DGRef2, DG3.3V, DG3.3V Sensors, DG5V Logic, DG5V Sensors, DG24V, DG24V Htr, DG24V Trim\n" + dgVoltageData = ", " + '{:11.6f}'.format(vDg[DGMonitoredVoltages.MONITORED_LINE_1V_FPGA.value]) + \ + ", " + '{:11.6f}'.format(vDg[DGMonitoredVoltages.MONITORED_LINE_1_2V_PROC.value]) + \ + ", " + '{:11.6f}'.format(vDg[DGMonitoredVoltages.MONITORED_LINE_1_8V_PROC.value]) + \ + ", " + '{:11.6f}'.format(vDg[DGMonitoredVoltages.MONITORED_LINE_1_8V_FPGA.value]) + \ + ", " + '{:11.6f}'.format(vDg[DGMonitoredVoltages.MONITORED_LINE_V_REF.value]) + \ + ", " + '{:11.6f}'.format(vDg[DGMonitoredVoltages.MONITORED_LINE_EXT_ADC_1_REF_V.value]) + \ + ", " + '{:11.6f}'.format(vDg[DGMonitoredVoltages.MONITORED_LINE_EXT_ADC_2_REF_V].value) + \ + ", " + '{:11.6f}'.format(vDg[DGMonitoredVoltages.MONITORED_LINE_3_3V.value]) + \ + ", " + '{:11.6f}'.format(vDg[DGMonitoredVoltages.MONITORED_LINE_3_3V_SENSORS.value]) + \ + ", " + '{:11.6f}'.format(vDg[DGMonitoredVoltages.MONITORED_LINE_5V_LOGIC.value]) + \ + ", " + '{:11.6f}'.format(vDg[DGMonitoredVoltages.MONITORED_LINE_5V_SENSORS.value]) + \ + ", " + '{:11.6f}'.format(vDg[DGMonitoredVoltages.MONITORED_LINE_24V_MAIN.value]) + \ + ", " + '{:11.6f}'.format(vDg[DGMonitoredVoltages.MONITORED_LINE_24V_PRIM_HTR_V.value]) + \ + ", " + '{:11.6f}'.format(vDg[DGMonitoredVoltages.MONITORED_LINE_24V_TRIM_HTR_V.value]) # log data - f.write(voltageData+"\n") + f.write(hdVoltageData+dgVoltageData+"\n") # print to console - print(voltageData) + print(hdVoltageData) + print(dgVoltageData) -