Index: dialin/dg/alarms.py =================================================================== diff -u -rc3b33cf5796df77eb213523c1e06ba4adbb9501d -r936963d19e46e75b0e666d60c0ff74014956f69d --- dialin/dg/alarms.py (.../alarms.py) (revision c3b33cf5796df77eb213523c1e06ba4adbb9501d) +++ dialin/dg/alarms.py (.../alarms.py) (revision 936963d19e46e75b0e666d60c0ff74014956f69d) @@ -28,7 +28,7 @@ """ DG interface containing alarm related commands. """ - + _ALARM_ID_MAX_ALARMS = 500 START_POS_ALARM_ID = DenaliMessage.PAYLOAD_START_INDEX END_POS_ALARM_ID = START_POS_ALARM_ID + 2 @@ -55,9 +55,9 @@ self.can_interface.register_receiving_publication_function(channel_id, msg_id, self._handler_alarm_information_sync) # alarm states based on received DG alarm activation and alarm clear messages - self.alarm_states = [False] * 500 + self.alarm_states = [False] * self._ALARM_ID_MAX_ALARMS # alarm condition states based on received DG alarm activation and clear condition messages - self.alarm_conditions = [False] * 500 + self.alarm_conditions = [False] * self._ALARM_ID_MAX_ALARMS self.safety_shutdown_active = False def get_alarm_states(self): @@ -98,7 +98,7 @@ @return: none """ - for x in range(500): + for x in range(self._ALARM_ID_MAX_ALARMS): self.alarm_states[x] = False @publish(["alarm_states"]) Index: dialin/dg/calibration_record.py =================================================================== diff -u -rc3b33cf5796df77eb213523c1e06ba4adbb9501d -r936963d19e46e75b0e666d60c0ff74014956f69d --- dialin/dg/calibration_record.py (.../calibration_record.py) (revision c3b33cf5796df77eb213523c1e06ba4adbb9501d) +++ dialin/dg/calibration_record.py (.../calibration_record.py) (revision 936963d19e46e75b0e666d60c0ff74014956f69d) @@ -22,7 +22,7 @@ from ..common.msg_defs import MsgIds, MsgFieldPositions from ..protocols.CAN import DenaliMessage, DenaliChannels from ..utils.base import AbstractSubSystem, publish -from ..utils.nv_ops_utils import NVOpsUtils, Observer +from ..utils.nv_ops_utils import NVOpsUtils, NVUtilsObserver class DGCalibrationNVRecord(AbstractSubSystem): @@ -106,12 +106,15 @@ # Prepare the excel report self._utilities.prepare_excel_report(self._FIRMWARE_STACK_NAME, self._utilities.CAL_RECORD_TAB_NAME, report_destination, protect_sheet=True) + + observer = NVUtilsObserver("dg_calibration_record") + # Attach the observer to the list + self.attach(observer) + # Request the DG calibration record and set and observer class to callback when the calibration record is read # back self.cmd_request_dg_calibration_record() - observer = Observer("dg_calibration_record") - # Attach the observer to the list - self.attach(observer) + while not observer.received: sleep(0.1) # Pass the DG calibration record to the function to write the excel @@ -206,7 +209,7 @@ # Request the DG calibration record and set and observer class to callback when the calibration record is read # back self.cmd_request_dg_calibration_record() - observer = Observer("dg_calibration_record") + observer = NVUtilsObserver("dg_calibration_record") # Attach the observer to the list self.attach(observer) while not observer.received: Index: dialin/dg/ro_pump.py =================================================================== diff -u -r3cae4fa51a114fb5ed5f430234a01c2374f3865b -r936963d19e46e75b0e666d60c0ff74014956f69d --- dialin/dg/ro_pump.py (.../ro_pump.py) (revision 3cae4fa51a114fb5ed5f430234a01c2374f3865b) +++ dialin/dg/ro_pump.py (.../ro_pump.py) (revision 936963d19e46e75b0e666d60c0ff74014956f69d) @@ -105,7 +105,7 @@ return self.measured_raw_flow_rate_mlp @publish(["target_pressure_psi", "measured_flow_rate_lpm", "pwm_duty_cycle_pct", "ro_pump_state", - "feedback_duty_cycle_pct", "raw_measured_flow_rate_lpm"]) + "feedback_duty_cycle_pct", "measured_raw_flow_rate_mlp"]) def _handler_ro_pump_sync(self, message): """ Handles published ro pump data messages. RO pump data are captured Index: dialin/dg/sw_config.py =================================================================== diff -u -r6286da1bcfac5f1d43659196fb1baf27af50d746 -r936963d19e46e75b0e666d60c0ff74014956f69d --- dialin/dg/sw_config.py (.../sw_config.py) (revision 6286da1bcfac5f1d43659196fb1baf27af50d746) +++ dialin/dg/sw_config.py (.../sw_config.py) (revision 936963d19e46e75b0e666d60c0ff74014956f69d) @@ -10,7 +10,7 @@ from ..common.msg_defs import MsgIds, MsgFieldPositions from ..protocols.CAN import DenaliMessage, DenaliChannels from ..utils.base import AbstractSubSystem, DialinEnum, publish -from ..utils.nv_ops_utils import NVOpsUtils, Observer +from ..utils.nv_ops_utils import NVOpsUtils, NVUtilsObserver @unique @@ -274,12 +274,14 @@ # Create the excel report self._utilities.prepare_excel_report(self._FIRMWARE_STACK_NAME, self._NON_VOLATILE_RECORD_NAME, report_address) - # Request the latest software configuration record from firmware - self._cmd_request_dg_sw_config_record() + # Create ab object of the observer class to observe the dictionary - observer = Observer("dg_sw_config_record") + observer = NVUtilsObserver("dg_sw_config_record") # Attach the observer to the list self.attach(observer) + + # Request the latest software configuration record from firmware + self._cmd_request_dg_sw_config_record() # Wait until data has been received from firmware while not observer.received: sleep(0.1) Index: dialin/dg/temperatures.py =================================================================== diff -u -rc3b33cf5796df77eb213523c1e06ba4adbb9501d -r936963d19e46e75b0e666d60c0ff74014956f69d --- dialin/dg/temperatures.py (.../temperatures.py) (revision c3b33cf5796df77eb213523c1e06ba4adbb9501d) +++ dialin/dg/temperatures.py (.../temperatures.py) (revision 936963d19e46e75b0e666d60c0ff74014956f69d) @@ -57,25 +57,25 @@ self.can_interface = can_interface self.logger = logger # Dictionary of the temperature sensors - self.temperatures = {DGTemperaturesNames.INLET_PRIMARY_HEATER.name: {}, - DGTemperaturesNames.HEAT_DISINFECT.name: {}, - DGTemperaturesNames.OUTLET_PRIMARY_HEATER.name: {}, - DGTemperaturesNames.CONDUCTIVITY_SENSOR_1.name: {}, - DGTemperaturesNames.CONDUCTIVITY_SENSOR_2.name: {}, - DGTemperaturesNames.OUTLET_DIALYSATE_REDUNDANT.name: {}, - DGTemperaturesNames.INLET_DIALYSATE.name: {}, - DGTemperaturesNames.PRIMARY_HEATER_THERMOCOUPLE.name: {}, - DGTemperaturesNames.TRIMMER_HEATER_THERMOCOUPLE.name: {}, - DGTemperaturesNames.PRIMARY_HEATER_COLD_JUNCTION.name: {}, - DGTemperaturesNames.TRIMMER_HEATER_COLD_JUNCTION.name: {}, - DGTemperaturesNames.PRIMARY_HEATER_INTERNAL.name: {}, - DGTemperaturesNames.TRIMMER_HEATER_INTERNAL.name: {}, - DGTemperaturesNames.FPGA_BOARD_SENSOR.name: {}, - DGTemperaturesNames.LOAD_CELL_A1_B1.name: {}, - DGTemperaturesNames.LOAD_CELL_A2_B2.name: {}, - DGTemperaturesNames.INTERNAL_THDO_RTD.name: {}, - DGTemperaturesNames.INTERNAL_TDI_RTD.name: {}, - DGTemperaturesNames.INTERNAL_COND_TEMP_SENSOR.name: {}} + self.temperatures = {DGTemperaturesNames.INLET_PRIMARY_HEATER.name: 0.0, + DGTemperaturesNames.HEAT_DISINFECT.name: 0.0, + DGTemperaturesNames.OUTLET_PRIMARY_HEATER.name: 0.0, + DGTemperaturesNames.CONDUCTIVITY_SENSOR_1.name: 0.0, + DGTemperaturesNames.CONDUCTIVITY_SENSOR_2.name: 0.0, + DGTemperaturesNames.OUTLET_DIALYSATE_REDUNDANT.name: 0.0, + DGTemperaturesNames.INLET_DIALYSATE.name: 0.0, + DGTemperaturesNames.PRIMARY_HEATER_THERMOCOUPLE.name: 0.0, + DGTemperaturesNames.TRIMMER_HEATER_THERMOCOUPLE.name: 0.0, + DGTemperaturesNames.PRIMARY_HEATER_COLD_JUNCTION.name: 0.0, + DGTemperaturesNames.TRIMMER_HEATER_COLD_JUNCTION.name: 0.0, + DGTemperaturesNames.PRIMARY_HEATER_INTERNAL.name: 0.0, + DGTemperaturesNames.TRIMMER_HEATER_INTERNAL.name: 0.0, + DGTemperaturesNames.FPGA_BOARD_SENSOR.name: 0.0, + DGTemperaturesNames.LOAD_CELL_A1_B1.name: 0.0, + DGTemperaturesNames.LOAD_CELL_A2_B2.name: 0.0, + DGTemperaturesNames.INTERNAL_THDO_RTD.name: 0.0, + DGTemperaturesNames.INTERNAL_TDI_RTD.name: 0.0, + DGTemperaturesNames.INTERNAL_COND_TEMP_SENSOR.name: 0.0} self.primary_raw_thermo_couple = 0 self.primary_raw_cold_junc = 0 Index: dialin/hd/calibration_record.py =================================================================== diff -u -rc3b33cf5796df77eb213523c1e06ba4adbb9501d -r936963d19e46e75b0e666d60c0ff74014956f69d --- dialin/hd/calibration_record.py (.../calibration_record.py) (revision c3b33cf5796df77eb213523c1e06ba4adbb9501d) +++ dialin/hd/calibration_record.py (.../calibration_record.py) (revision 936963d19e46e75b0e666d60c0ff74014956f69d) @@ -22,7 +22,7 @@ from ..common.msg_defs import MsgIds, MsgFieldPositions from ..protocols.CAN import DenaliMessage, DenaliChannels from ..utils.base import AbstractSubSystem, publish -from ..utils.nv_ops_utils import NVOpsUtils, Observer +from ..utils.nv_ops_utils import NVOpsUtils, NVUtilsObserver class HDCalibrationNVRecord(AbstractSubSystem): @@ -102,12 +102,14 @@ # Prepare the excel report self._utilities.prepare_excel_report(self._FIRMWARE_STACK_NAME, self._utilities.CAL_RECORD_TAB_NAME, report_destination, protect_sheet=True) + + observer = NVUtilsObserver("hd_calibration_record") + # Attach the observer to the list + self.attach(observer) # Request the HD calibration record and set and observer class to callback when the calibration record is read # back self.cmd_request_hd_calibration_record() - observer = Observer("hd_calibration_record") - # Attach the observer to the list - self.attach(observer) + while not observer.received: sleep(0.1) # Pass the HD calibration record to the function to write the excel @@ -199,12 +201,13 @@ @return: none """ + observer = NVUtilsObserver("hd_calibration_record") + # Attach the observer to the list + self.attach(observer) # Request the HD calibration record and set and observer class to callback when the calibration record is read # back self.cmd_request_hd_calibration_record() - observer = Observer("hd_calibration_record") - # Attach the observer to the list - self.attach(observer) + while not observer.received: sleep(0.1) self._utilities.write_excel_record_to_fw_record(self.hd_calibration_record, report_address, Index: dialin/hd/sw_config.py =================================================================== diff -u -r6d6c2318a81c130b7875bfad31424e56fd8f59f2 -r936963d19e46e75b0e666d60c0ff74014956f69d --- dialin/hd/sw_config.py (.../sw_config.py) (revision 6d6c2318a81c130b7875bfad31424e56fd8f59f2) +++ dialin/hd/sw_config.py (.../sw_config.py) (revision 936963d19e46e75b0e666d60c0ff74014956f69d) @@ -10,7 +10,7 @@ from ..common.msg_defs import MsgIds, MsgFieldPositions from ..protocols.CAN import DenaliMessage, DenaliChannels from ..utils.base import AbstractSubSystem, DialinEnum, publish -from ..utils.nv_ops_utils import NVOpsUtils, Observer +from ..utils.nv_ops_utils import NVOpsUtils, NVUtilsObserver @unique @@ -305,12 +305,14 @@ # Create the excel report self._utilities.prepare_excel_report(self._FIRMWARE_STACK_NAME, self._utilities.NON_VOLATILE_RECORD_NAME, report_address, protect_sheet=True) - # Request the latest software configuration record from firmware - self._cmd_request_hd_sw_config_record() + # Create ab object of the observer class to observe the dictionary - observer = Observer("hd_sw_config_record") + observer = NVUtilsObserver("hd_sw_config_record") # Attach the observer to the list self.attach(observer) + # Request the latest software configuration record from firmware + self._cmd_request_hd_sw_config_record() + # Wait until data has been received from firmware while not observer.received: sleep(0.1) Index: dialin/utils/nv_ops_utils.py =================================================================== diff -u -rc3b33cf5796df77eb213523c1e06ba4adbb9501d -r936963d19e46e75b0e666d60c0ff74014956f69d --- dialin/utils/nv_ops_utils.py (.../nv_ops_utils.py) (revision c3b33cf5796df77eb213523c1e06ba4adbb9501d) +++ dialin/utils/nv_ops_utils.py (.../nv_ops_utils.py) (revision 936963d19e46e75b0e666d60c0ff74014956f69d) @@ -23,7 +23,7 @@ from dialin.utils.base import AbstractObserver -class Observer(AbstractObserver): +class NVUtilsObserver(AbstractObserver): """ Observation class Index: tests/hd_blood_leak_data.py =================================================================== diff -u -rc3b33cf5796df77eb213523c1e06ba4adbb9501d -r936963d19e46e75b0e666d60c0ff74014956f69d --- tests/hd_blood_leak_data.py (.../hd_blood_leak_data.py) (revision c3b33cf5796df77eb213523c1e06ba4adbb9501d) +++ tests/hd_blood_leak_data.py (.../hd_blood_leak_data.py) (revision 936963d19e46e75b0e666d60c0ff74014956f69d) @@ -42,10 +42,6 @@ hd.cmd_log_in_to_hd() sleep(1) - - #hd.blood_leak.cmd_blood_leak_zero_request() - #sleep(2) - hd.blood_leak.cmd_blood_leak_data_broadcast_interval_override(50) f = open("/home/fw/projects/dialin/tests/blood_leak.log", "w") @@ -62,38 +58,3 @@ except KeyboardInterrupt: f.close() - """ - f = open("/home/fw/projects/dialin/tests/blood_leak.log", "w") - counter = 0 - - while counter < 6: - - hd.cmd_hd_software_reset_request() - sleep(1) - hd.alarms.clear_dialin_alarms() - - timer = 0 - - while True: - if hd.hd_operation_mode == HDOpModes.MODE_STAN.value and timer == 0: - hd.cmd_log_in_to_hd() - sleep(1) - hd.blood_leak.cmd_blood_leak_zero_request() - - hd_blood_leak = get_blood_leak_info() - - var = str(counter) + str(datetime.now()) + ', ' + hd_blood_leak + '\r' - - if timer > 4: - break - - timer += 1 - - print(var) - f.write(var) - sleep(1) - - counter += 1 - """ - - Index: tests/test_hd_dg_fans.py =================================================================== diff -u -rc3b33cf5796df77eb213523c1e06ba4adbb9501d -r936963d19e46e75b0e666d60c0ff74014956f69d --- tests/test_hd_dg_fans.py (.../test_hd_dg_fans.py) (revision c3b33cf5796df77eb213523c1e06ba4adbb9501d) +++ tests/test_hd_dg_fans.py (.../test_hd_dg_fans.py) (revision 936963d19e46e75b0e666d60c0ff74014956f69d) @@ -44,33 +44,10 @@ # Create an instance of the DG Class hd = HD(log_level='DEBUG') - #dg = DG(log_level="DEBUG") - if hd.cmd_log_in_to_hd() == 0: #or dg.cmd_log_in_to_dg() == 0: + if hd.cmd_log_in_to_hd() == 0: exit(1) - """ - #hd.fans.cmd_dg_fan_rpm_override(FansNames.FAN_INLET_1.value, 4000.0) - #sleep(1) - #hd.fans.cmd_dg_fan_rpm_override(FansNames.FAN_INLET_1.value, 4000, reset=1) - test = 'THERMISTOR_ONBOARD_NTC' - test2 = HDTemperaturesNames.test - print(type(HDTemperaturesNames.THERMISTOR_ONBOARD_NTC.name), type(test2)) - hd.temperatures.cmd_hd_temperatures_value_override(HDTemperaturesNames.test2.value, 60.0, 1) - #sleep(1) - #hd.temperatures.cmd_hd_temperatures_value_override(HDTemperaturesNames.THERMISTOR_ONBOARD_NTC.value, 90.00, reset=1) - while True: - #fans = get_fans_info() - #switches = get_hd_switches_info() - - #print(fans + switches) - sleep(1) - - test = hd.fans.get_fans_target_duty_cycle() - - print(test) - """ - while True: print(get_fans_info()) sleep(1)