Index: dialin/common/msg_ids.py =================================================================== diff -u -r1c5dbffa6b205c14f92e05badc563f2a84980bfa -r8d2404cf92c1169f1119fb87110396634dcf7e3b --- dialin/common/msg_ids.py (.../msg_ids.py) (revision 1c5dbffa6b205c14f92e05badc563f2a84980bfa) +++ dialin/common/msg_ids.py (.../msg_ids.py) (revision 8d2404cf92c1169f1119fb87110396634dcf7e3b) @@ -386,7 +386,7 @@ MSG_ID_DG_THERMISTORS_DATA_PUBLISH_INTERVAL_OVERRIDE = 0xA02D MSG_ID_DG_THERMISTORS_VALUE_OVERRIDE = 0xA02E MSG_ID_DG_RO_PUMP_DUTY_CYCLE_OVERRIDE = 0xA02F - MSG_ID_DG_RO_FLOW_RATE_OVERRIDE = 0xA030 + MSG_ID____AVAILABLE_5 = 0xA030 MSG_ID_DG_SET_RO_PUMP_TARGET_FLOW = 0xA031 MSG_ID_DG_RO_PUMP_TARGET_PRESSURE_OVERRIDE = 0xA032 MSG_ID_DG_SET_CALIBRATION_RECORD = 0xA033 Index: dialin/dg/pressures.py =================================================================== diff -u -r7ea4b936cef531b2cde9053ae58b7119a3bf0e6c -r8d2404cf92c1169f1119fb87110396634dcf7e3b --- dialin/dg/pressures.py (.../pressures.py) (revision 7ea4b936cef531b2cde9053ae58b7119a3bf0e6c) +++ dialin/dg/pressures.py (.../pressures.py) (revision 8d2404cf92c1169f1119fb87110396634dcf7e3b) @@ -35,6 +35,7 @@ PRESSURE_SENSOR_RO_PUMP_OUTLET = 1 PRESSURE_SENSOR_DRAIN_PUMP_INLET = 2 PRESSURE_SENSOR_DRAIN_PUMP_OUTLET = 3 + PRESSURE_SENSOR_BAROMETRIC = 4 def __init__(self, can_interface, logger: Logger): """ @@ -56,6 +57,7 @@ self.ro_pump_outlet_pressure = 0.0 self.drain_pump_inlet_pressure = 0.0 self.drain_pump_outlet_pressure = 0.0 + self.barometric_pressure = 0.0 def get_pressures(self): """ @@ -72,7 +74,8 @@ "ro_pump_inlet_pressure", "ro_pump_outlet_pressure", "drain_pump_inlet_pressure", - "drain_pump_outlet_pressure" + "drain_pump_outlet_pressure", + "barometric_pressure" ]) def _handler_pressures_sync(self, message): """ @@ -91,11 +94,14 @@ message['message'][MsgFieldPositions.START_POS_FIELD_3:MsgFieldPositions.END_POS_FIELD_3])) dro = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_4:MsgFieldPositions.END_POS_FIELD_4])) + baro = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_5:MsgFieldPositions.END_POS_FIELD_5])) self.ro_pump_inlet_pressure = roi[0] self.ro_pump_outlet_pressure = roo[0] self.drain_pump_inlet_pressure = dri[0] self.drain_pump_outlet_pressure = dro[0] + self.barometric_pressure = baro[0] def cmd_pressure_override(self, sensor: int, pressure: int, reset: int = NO_RESET) -> int: """ @@ -109,6 +115,7 @@ 1 = RO Pump Outlet \n 2 = Drain Pump Inlet \n 3 = Drain Pump Outlet \n + 4 = Barometric pressure \n @param sensor: unsigned int - sensor ID @param pressure: unsigned int - pressure (in PSI) Index: dialin/dg/ro_pump.py =================================================================== diff -u -r2c3670be196a05ad6c34d798af26bdb798e607d4 -r8d2404cf92c1169f1119fb87110396634dcf7e3b --- dialin/dg/ro_pump.py (.../ro_pump.py) (revision 2c3670be196a05ad6c34d798af26bdb798e607d4) +++ dialin/dg/ro_pump.py (.../ro_pump.py) (revision 8d2404cf92c1169f1119fb87110396634dcf7e3b) @@ -57,12 +57,10 @@ self.can_interface.register_receiving_publication_function(channel_id, msg_id, self._handler_ro_pump_sync) self.target_pressure_psi = 0.0 - self.measured_flow_rate_lpm = 0.0 self.pwm_duty_cycle_pct = 0.0 self.ro_pump_state = 0 self.target_flow_lpm = 0.0 self.feedback_duty_cycle_pct = 0.0 - self.measured_raw_flow_rate_with_conc_pumps_mlp = 0.0 def get_target_pressure(self): """ @@ -80,14 +78,6 @@ """ return self.target_flow_lpm - def get_measured_flow_rate(self): - """ - Gets the measured flow rate (lpm) - - @return: The measured flow rate (float) - """ - return self.measured_flow_rate_lpm - def get_pwm_duty_cycle_pct(self): """ Gets the PWM duty cycle pct @@ -104,16 +94,8 @@ """ return self.ro_pump_state - def get_ro_pump_measured_raw_flow_rate_mlp(self): - """ - Gets the RO pump measured raw flow rate - - @return: The RO pump measured raw flow rate in mL/min - """ - return self.measured_raw_flow_rate_with_conc_pumps_mlp - - @publish(["target_pressure_psi", "measured_flow_rate_lpm", "pwm_duty_cycle_pct", "ro_pump_state", - "target_flow_lpm", "feedback_duty_cycle_pct", "measured_raw_flow_rate_with_conc_pumps_mlp"]) + @publish(["target_pressure_psi", "pwm_duty_cycle_pct", "ro_pump_state", "target_flow_lpm", + "feedback_duty_cycle_pct"]) def _handler_ro_pump_sync(self, message): """ Handles published ro pump data messages. RO pump data are captured @@ -125,18 +107,14 @@ """ self.target_pressure_psi = struct.unpack(' int: - """ - Constructs and sends the RO flow rate override command. - Constraints: - Must be logged into DG. - - @param flow: float - flow rate (in L/min) to override with - @param reset: integer - 1 to reset a previous override, 0 to override - @return: 1 if successful, zero otherwise - """ - - rst = integer_to_bytearray(reset) - flo = float_to_bytearray(flow) - payload = rst + flo - - message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, - message_id=MsgIds.MSG_ID_DG_RO_FLOW_RATE_OVERRIDE.value, - payload=payload) - - self.logger.debug("Override RO pump measured flow rate") - - # Send message - received_message = self.can_interface.send(message) - - # If there is content... - if received_message is not None: - # self.logger.debug(received_message) - if reset == RESET: - str_res = "Reset back to normal" - else: - str_res = str(flo) - self.logger.debug( - "Measured RO flow rate overridden to " + str_res + " L/min: " + - str(received_message['message'][DenaliMessage.PAYLOAD_START_INDEX])) - # response payload is OK or not OK - return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] - else: - self.logger.debug("Timeout!!!!") - return False - def cmd_set_ro_flow_rate(self, flow: float) -> int: """ Constructs and sends the RO rate set command. Index: dialin/dg/temperatures.py =================================================================== diff -u -r88b4967ce6b9ac816ac21b26326450de4b540887 -r8d2404cf92c1169f1119fb87110396634dcf7e3b --- dialin/dg/temperatures.py (.../temperatures.py) (revision 88b4967ce6b9ac816ac21b26326450de4b540887) +++ dialin/dg/temperatures.py (.../temperatures.py) (revision 8d2404cf92c1169f1119fb87110396634dcf7e3b) @@ -46,6 +46,7 @@ INTERNAL_THDO_RTD = 16 INTERNAL_TDI_RTD = 17 INTERNAL_COND_TEMP_SENSOR = 18 + BARO_TEMP_SENSOR = 19 class TemperatureSensors(AbstractSubSystem): @@ -75,15 +76,9 @@ 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} + DGTemperaturesNames.INTERNAL_COND_TEMP_SENSOR.name: 0.0, + DGTemperaturesNames.BARO_TEMP_SENSOR.name: 0.0} - self.primary_raw_thermo_couple = 0 - self.primary_raw_cold_junc = 0 - self.trimmer_raw_thermo_couple = 0 - self.trimmer_raw_cold_junc = 0 - self.conductivity_1_raw = 0 - self.conductivity_2_raw = 0 - if self.can_interface is not None: channel_id = DenaliChannels.dg_sync_broadcast_ch_id msg_id = MsgIds.MSG_ID_DG_TEMPERATURE_DATA.value @@ -99,8 +94,7 @@ """ return self.temperatures[DGTemperaturesNames(sensor).name] - @publish(["temperatures", "primary_raw_thermo_couple", "primary_raw_cold_junc", "trimmer_raw_thermo_couple", - "trimmer_raw_cold_junc", "conductivity_1_raw", "conductivity_2_raw"]) + @publish(["temperatures"]) def _handler_temperature_sensors_sync(self, message): """ Handles published temperature sensors message @@ -165,24 +159,9 @@ self.temperatures[DGTemperaturesNames.INTERNAL_COND_TEMP_SENSOR.name] = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_19:MsgFieldPositions.END_POS_FIELD_19]))[0] - self.primary_raw_thermo_couple = struct.unpack('i', bytearray( + self.temperatures[DGTemperaturesNames.BARO_TEMP_SENSOR.name] = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_20:MsgFieldPositions.END_POS_FIELD_20]))[0] - self.primary_raw_cold_junc = struct.unpack('i', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_21:MsgFieldPositions.END_POS_FIELD_21]))[0] - - self.trimmer_raw_thermo_couple = struct.unpack('i', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_22:MsgFieldPositions.END_POS_FIELD_22]))[0] - - self.trimmer_raw_cold_junc = struct.unpack('i', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_23:MsgFieldPositions.END_POS_FIELD_23]))[0] - - self.conductivity_1_raw = struct.unpack('i', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_24:MsgFieldPositions.END_POS_FIELD_24]))[0] - - self.conductivity_2_raw = struct.unpack('i', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_25:MsgFieldPositions.END_POS_FIELD_25]))[0] - def cmd_temperatures_data_broadcast_interval_override(self, ms: int, reset: int = NO_RESET) -> int: """ Constructs and sends broadcast time interval. @@ -250,6 +229,7 @@ 16 = Internal THDO RTD 17 = Internal TDI RTD 18 = Internal conductivity temp sensor + 19 = Barometric temperature sensor """ rst = integer_to_bytearray(reset) value = float_to_bytearray(sensor_value) Index: tests/hd_nvm_scripts.py =================================================================== diff -u -r9d477b8958653efb24fc7b1f5fc55f622922d6d8 -r8d2404cf92c1169f1119fb87110396634dcf7e3b --- tests/hd_nvm_scripts.py (.../hd_nvm_scripts.py) (revision 9d477b8958653efb24fc7b1f5fc55f622922d6d8) +++ tests/hd_nvm_scripts.py (.../hd_nvm_scripts.py) (revision 8d2404cf92c1169f1119fb87110396634dcf7e3b) @@ -69,9 +69,9 @@ # It creates a folder called DG_NV_Records in the destination that is called # If no address is provided, the default location is one folder above the dialin folder wherever it is installed # in you computer. - #hd.system_record.cmd_get_hd_system_record_report() + hd.system_record.cmd_get_hd_system_record_report() - hd.system_record.cmd_set_hd_system_record_excel_to_fw('/home/fw/projects/HD_NV_Records/2022-09-26-HD-Record.xlsx') + #hd.system_record.cmd_set_hd_system_record_excel_to_fw('/home/fw/projects/HD_NV_Records/2022-09-26-HD-Record.xlsx') # For resetting the system record to benign values, use the function below #hd.system_record.cmd_reset_hd_system_record() @@ -84,10 +84,10 @@ if hd.cmd_log_in_to_hd(): # Comment this function if not needed - run_sw_configs_commands() + #run_sw_configs_commands() # Comment this function if not needed #run_calibration_commands() - #run_system_commands() + run_system_commands()