########################################################################### # # Copyright (c) 2019-2021 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_voltages.py # # @author (last) Sean Nash # @date (last) 16-Apr-2021 # @author (original) Sean Nash # @date (original) 16-Apr-2021 # ############################################################################ import sys sys.path.append("..") from dialin.hd.hemodialysis_device import HD from time import sleep from dialin.hd.voltages import HDMonitoredVoltages if __name__ == "__main__": # create an HD object called hd hd = HD() 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) # sleep(1) # create log file with open("voltages_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" f.write(header) # write monitored voltages related data from HD to log file while True: sleep(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 = '{:15.6f}'.format(v[HDMonitoredVoltages.MONITORED_LINE_1_2V.value]) + \ ", " + '{:15.6f}'.format(v[HDMonitoredVoltages.MONITORED_LINE_3_3V.value]) + \ ", " + '{:15.6f}'.format(v[HDMonitoredVoltages.MONITORED_LINE_5V_LOGIC.value]) + \ ", " + '{:15.6f}'.format(v[HDMonitoredVoltages.MONITORED_LINE_5V_SENSORS.value]) + \ ", " + '{:15.6f}'.format(v[HDMonitoredVoltages.MONITORED_LINE_24V.value]) + \ ", " + '{:15.6f}'.format(v[HDMonitoredVoltages.MONITORED_LINE_24V_REGEN.value]) + \ ", " + '{:15.6f}'.format(v[HDMonitoredVoltages.MONITORED_LINE_FPGA_REF_V.value]) + \ ", " + '{:15.6f}'.format(v[HDMonitoredVoltages.MONITORED_LINE_PBA_REF_V.value]) + \ ", " + '{:15.6f}'.format(hd.alarms.alarm_audio_curr_hg) + \ ", " + '{:15.6f}'.format(hd.alarms.alarm_audio_curr_lg) + \ ", " + '{:15.6f}'.format(hd.alarms.alarm_backup_audio_curr) # log data f.write(voltageData+"\n") # print to console print(voltageData)