From 2d04fe8cbb0861bb73afe8829a51b6eadb4f15ae Mon Sep 17 00:00:00 2001 From: mjrand Date: Tue, 20 Aug 2024 20:38:51 +0000 Subject: [PATCH] Added ability to query my temperatures in agent acq --- socs/agents/pfeiffer_tc400/agent.py | 13 +++++++++-- socs/agents/pfeiffer_tc400/drivers.py | 33 +++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/socs/agents/pfeiffer_tc400/agent.py b/socs/agents/pfeiffer_tc400/agent.py index 2643cd311..15a9cc280 100644 --- a/socs/agents/pfeiffer_tc400/agent.py +++ b/socs/agents/pfeiffer_tc400/agent.py @@ -96,9 +96,13 @@ def acq(self, session, params): 'timestamp': 1598626144.5365012, 'block_name': 'turbo_output', 'data': { + "Turbo_PowerStage_Temp": 30.5, + "Turbo_Electronics_Temp": 29.2, + "Turbo_PumpBottom_Temp": 31.4, + "Turbo_Bearing_Temp": 39.5, "Turbo_Motor_Temp": 40.054, "Rotation_Speed": 823.655, - "Error_Code": "Err001", + "Error_Code": "1", } } @@ -120,7 +124,12 @@ def acq(self, session, params): } try: - data['data']["Turbo_Motor_Temp"] = self.turbo.get_turbo_motor_temperature() + temp_data = self.turbo.get_turbo_temperatures() + data['data']["Turbo_PowerStage_Temp"] = temp_data['pwrstg'] + data['data']["Turbo_Electronics_Temp"] = temp_data['electronic'] + data['data']["Turbo_PumpBottom_Temp"] = temp_data['pmpbot'] + data['data']["Turbo_Bearing_Temp"] = temp_data['bearing'] + data['data']["Turbo_Motor_Temp"] = temp_data['motor'] data['data']["Rotation_Speed"] = self.turbo.get_turbo_actual_rotation_speed() data['data']['Error_Code'] = self.turbo.get_turbo_error_code() except ValueError as e: diff --git a/socs/agents/pfeiffer_tc400/drivers.py b/socs/agents/pfeiffer_tc400/drivers.py index 2813a9889..78753e0d3 100644 --- a/socs/agents/pfeiffer_tc400/drivers.py +++ b/socs/agents/pfeiffer_tc400/drivers.py @@ -51,6 +51,39 @@ def __init__(self, moxa_ip_address, moxa_port, turbo_address): self.turbo_address = turbo_address + def get_turbo_temperatures(self): + """Gets the temperatures of the various turbo parts from the turbo controller. + + Returns: + -------- + dict + pwrstg: The power stage temperature in Celsius + electronic: The electronic temperature in Celsius + pmpbot: The pump bottom temperature in Celsius + bearing: The bearing temperature in Celsius + motor: The motor temperature in Celsius + """ + + temp_dict = {"pwrstg": None, + "electronic": None, + "pmpbot": None, + "bearing": None, + "motor": None} + + addr_dict = {"pwrstg": 324, + "electronic": 326, + "pmpbot": 330, + "bearing": 342, + "motor": 346} + + for stage, stage_addr in addr_dict.items(): + send_data_request(self.ser, self.turbo_address, stage_addr) + addr, rw, param_num, temp = read_gauge_response(self.ser) + + temp_dict[stage] = int(temp) + + return temp_dict + def get_turbo_motor_temperature(self): """Gets the temperatures of the turbo rotor from the turbo controller.