Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions socs/agents/pfeiffer_tc400/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,16 @@ def acq(self, session, params):
'timestamp': 1598626144.5365012,
'block_name': 'turbo_output',
'data': {
"Turbo_Motor_Temp": 40.054,
"Rotation_Speed": 823.655,
"Drive_Voltage": 46.65,
"Drive_Current": 3.02,
"Drive_Power": 139.95,
"Turbo_Power_Stage_Temp": 42,
"Turbo_Electronics_Temp": 38,
"Turbo_Pump_Bottom_Temp": 26,
"Turbo_Bearing_Temp": 28,
"Turbo_Motor_Temp": 32,
"Rotation_Speed": 819,
"Acceleration": 60,
"Error_Code": "Err001",
}
}
Expand All @@ -120,9 +128,18 @@ def acq(self, session, params):
}

try:
data['data']["Drive_Voltage"] = self.turbo.get_turbo_drive_voltage()
data['data']["Drive_Current"] = self.turbo.get_turbo_drive_current()
data['data']["Drive_Power"] = self.turbo.get_turbo_drive_power()
data['data']["Turbo_Power_Stage_Temp"] = self.turbo.get_turbo_power_stage_temperature()
data['data']["Turbo_Electronics_Temp"] = self.turbo.get_turbo_electronic_temperature()
data['data']["Turbo_Pump_Bottom_Temp"] = self.turbo.get_turbo_pump_bottom_temperature()
data['data']["Turbo_Bearing_Temp"] = self.turbo.get_turbo_bearing_temperature()
data['data']["Turbo_Motor_Temp"] = self.turbo.get_turbo_motor_temperature()
data['data']["Rotation_Speed"] = self.turbo.get_turbo_actual_rotation_speed()
data['data']["Acceleration"] = self.turbo.get_turbo_acceleration()
data['data']['Error_Code'] = self.turbo.get_turbo_error_code()

except ValueError as e:
self.log.error(f"Error in collecting data: {e}")
continue
Expand Down
116 changes: 115 additions & 1 deletion socs/agents/pfeiffer_tc400/drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,106 @@ def __init__(self, moxa_ip_address, moxa_port, turbo_address):

self.turbo_address = turbo_address

def get_turbo_drive_voltage(self):
"""Gets the drive voltage supplied to the turbo controller.

Returns
-------
int
The drive voltage supplied to the turbo controller in Volts.
"""

send_data_request(self.ser, self.turbo_address, 313)
addr, rw, param_num, drive_voltage = read_gauge_response(self.ser)

# The turbo response should be interpreted as having two decimal points
return float(drive_voltage) * 0.01

def get_turbo_drive_current(self):
"""Gets the drive current supplied to the turbo controller.

Returns
-------
int
The drive current supplied to the turbo controller in Amps.
"""

send_data_request(self.ser, self.turbo_address, 310)
addr, rw, param_num, drive_current = read_gauge_response(self.ser)

# The turbo response should be interpreted as having two decimal points
return float(drive_current) * 0.01

def get_turbo_drive_power(self):
"""Gets the drive power supplied to the turbo controller.

Returns
-------
int
The drive power supplied to the turbo controller in Watts.
"""

send_data_request(self.ser, self.turbo_address, 316)
addr, rw, param_num, drive_power = read_gauge_response(self.ser)

return float(drive_power)

def get_turbo_power_stage_temperature(self):
"""Gets the temperatures of the turbo power stage from the turbo controller.

Returns
-------
int
The power temperature of the turbo in Celsius.
"""

send_data_request(self.ser, self.turbo_address, 324)
addr, rw, param_num, power_stage_temp = read_gauge_response(self.ser)

return int(power_stage_temp)

def get_turbo_electronic_temperature(self):
"""Gets the temperatures of the turbo electronics from the turbo controller.

Returns
-------
int
The electronics temperature of the turbo in Celsius.
"""

send_data_request(self.ser, self.turbo_address, 326)
addr, rw, param_num, electronic_temp = read_gauge_response(self.ser)

return int(electronic_temp)

def get_turbo_pump_bottom_temperature(self):
"""Gets the temperatures of the turbo pump bottom from the turbo controller.

Returns
-------
int
The pump bottom temperature of the turbo in Celsius.
"""

send_data_request(self.ser, self.turbo_address, 330)
addr, rw, param_num, pump_bottom_temp = read_gauge_response(self.ser)

return int(pump_bottom_temp)

def get_turbo_bearing_temperature(self):
"""Gets the temperatures of the turbo bearing from the turbo controller.

Returns
-------
int
The bearing temperature of the turbo in Celsius.
"""

send_data_request(self.ser, self.turbo_address, 342)
addr, rw, param_num, bearing_temp = read_gauge_response(self.ser)

return int(bearing_temp)

def get_turbo_motor_temperature(self):
"""Gets the temperatures of the turbo rotor from the turbo controller.

Expand Down Expand Up @@ -96,6 +196,20 @@ def get_turbo_set_rotation_speed(self):

return int(set_rotation_speed)

def get_turbo_acceleration(self):
"""Gets the current acceleration of the turbo from the turbo controller.

Returns
-------
int
The current acceleration of the turbo in rpm/s.
"""

send_data_request(self.ser, self.turbo_address, 336)
addr, rw, param_num, acceleration = read_gauge_response(self.ser)

return int(acceleration)

def get_turbo_error_code(self):
"""Gets the current error code of the turbo from the turbo controller.

Expand Down Expand Up @@ -180,7 +294,7 @@ def turn_turbo_motor_off(self):
if turbo_response not in PFEIFFER_BOOL:
raise ValueError(f"Unrecognized response from turbo: {turbo_response}")
else:
return turbo_response == "111111"
return turbo_response == "000000"

def acknowledge_turbo_errors(self):
"""Acknowledges the turbo errors. This is analagous to clearing the errors.
Expand Down
12 changes: 10 additions & 2 deletions tests/integration/test_pfeiffer_tc400_agent_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,16 @@ def test_pfeiffer_tc400_acknowledge_turbo_errors(wait_for_crossbar, emulator,
def test_pfeiffer_tc400_acq(wait_for_crossbar, emulator, run_agent, client):
client.init()

responses = {'0010034602=?108': format_reply('000300'), # get_turbo_motor_temperature()
'0010030902=?107': format_reply('000800'), # get_turbo_actual_rotation_speed()
responses = {'0010031302=?102': format_reply('004796'), # get_turbo_drive_voltage()
'0010031002=?099': format_reply('000316'), # get_turbo_drive_current()
'0010031602=?105': format_reply('000152'), # get_turbo_drive_power()
'0010032402=?104': format_reply('000320'), # get_turbo_power_stage_temperature()
'0010032602=?106': format_reply('000310'), # get_turbo_electronic_temperature()
'0010033002=?101': format_reply('000310'), # get_turbo_pump_bottom_temperature()
'0010034202=?104': format_reply('000310'), # get_turbo_bearing_temperature()
'0010034602=?108': format_reply('000310'), # get_turbo_motor_temperature()
'0010030902=?107': format_reply('000860'), # get_turbo_actual_rotation_speed()
'0010033602=?107': format_reply('001000'), # get_turbo_acceleration()
'0010030302=?101': format_reply('Err001'), # get_turbo_error_code()
}
emulator.define_responses(responses)
Expand Down