Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ability to query more temperatures in agent acq #730

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
13 changes: 11 additions & 2 deletions socs/agents/pfeiffer_tc400/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Comment on lines -101 to +105
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really what's coming back? It looks like a string is being stored in InfluxDB. I see "000000" for turbos running on satp1, so maybe let's format this as "000001"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. What happened I think is that I tested casting the error code to make it readable on grafana and it worked so I wrongly assumed it was a simple int. I tried to separate that error code testing from this PR so we could tackle it differently but I accidentally forgot to revert this change, my b!

}
}

Expand All @@ -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:
Expand Down
33 changes: 33 additions & 0 deletions socs/agents/pfeiffer_tc400/drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
Loading