From 4961b2adb225f8eabc6dab4a43af649be6508907 Mon Sep 17 00:00:00 2001 From: atse Date: Tue, 18 Jul 2023 17:16:35 +0800 Subject: [PATCH] Use proper symbols in units, and add units PID parameters are not actually dimensionless, and their units can be deduced from the input unit and the output (actuator) unit. --- pytec/tec_qt.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index 866e8ba..54e9ed8 100644 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -35,20 +35,20 @@ THERMOSTAT_PARAMETERS = [[ 'suffix': 'V', 'commands': [f'pwm {ch} max_v {{value}}']}, ]}, {'name': 'Thermistor Config', 'expanded': False, 'type': 'group', 'children': [ - {'name': 'T0', 'type': 'float', 'value': 25, 'step': 0.1, 'limits': (-100, 100), 'siPrefix': True, - 'suffix': 'C', 'commands': [f's-h {ch} t0 {{value}}']}, - {'name': 'R0', 'type': 'float', 'value': 10000, 'step': 1, 'siPrefix': True, 'suffix': 'Ohm', + {'name': 'T₀', 'type': 'float', 'value': 25, 'step': 0.1, 'limits': (-100, 100), 'siPrefix': True, + 'suffix': '°C', 'commands': [f's-h {ch} t0 {{value}}']}, + {'name': 'R₀', 'type': 'float', 'value': 10000, 'step': 1, 'siPrefix': True, 'suffix': 'Ω', 'commands': [f's-h {ch} r0 {{value}}']}, - {'name': 'Beta', 'type': 'float', 'value': 3950, 'step': 1, 'commands': [f's-h {ch} b {{value}}']}, + {'name': 'β', 'type': 'float', 'value': 3950, 'step': 1, 'suffix': 'K', 'commands': [f's-h {ch} b {{value}}']}, ]}, {'name': 'PID Config', 'expanded': False, 'type': 'group', 'children': [ - {'name': 'kP', 'type': 'float', 'value': 0, 'step': 0.1, 'commands': [f'pid {ch} kp {{value}}']}, - {'name': 'kI', 'type': 'float', 'value': 0, 'step': 0.1, 'commands': [f'pid {ch} ki {{value}}']}, - {'name': 'kD', 'type': 'float', 'value': 0, 'step': 0.1, 'commands': [f'pid {ch} kd {{value}}']}, + {'name': 'Kp', 'type': 'float', 'value': 0, 'step': 0.1, 'suffix': '°C/A', 'commands': [f'pid {ch} kp {{value}}']}, + {'name': 'Ki', 'type': 'float', 'value': 0, 'step': 0.1, 'suffix': '°C/C', 'commands': [f'pid {ch} ki {{value}}']}, + {'name': 'Kd', 'type': 'float', 'value': 0, 'step': 0.1, 'suffix': '°Cs²/C', 'commands': [f'pid {ch} kd {{value}}']}, {'name': 'PID Auto Tune', 'expanded': False, 'type': 'group', 'children': [ - {'name': 'Target Temperature', 'type': 'float', 'value': 20, 'step': 0.1, 'siPrefix': True, 'suffix': 'C'}, + {'name': 'Target Temperature', 'type': 'float', 'value': 20, 'step': 0.1, 'siPrefix': True, 'suffix': '°C'}, {'name': 'Test Current', 'type': 'float', 'value': 1, 'step': 0.1, 'siPrefix': True, 'suffix': 'A'}, - {'name': 'Temperature Swing', 'type': 'float', 'value': 1.5, 'step': 0.1, 'siPrefix': True, 'suffix': 'C'}, + {'name': 'Temperature Swing', 'type': 'float', 'value': 1.5, 'step': 0.1, 'siPrefix': True, 'suffix': '°C'}, {'name': 'Run', 'type': 'action', 'tip': 'Run'}, ]}, ]} @@ -275,9 +275,9 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): for settings in pid_settings: channel = settings["channel"] with QSignalBlocker(params[channel]): - params[channel].child("PID Config", "kP").setValue(settings["parameters"]["kp"]) - params[channel].child("PID Config", "kI").setValue(settings["parameters"]["ki"]) - params[channel].child("PID Config", "kD").setValue(settings["parameters"]["kd"]) + params[channel].child("PID Config", "Kp").setValue(settings["parameters"]["kp"]) + params[channel].child("PID Config", "Ki").setValue(settings["parameters"]["ki"]) + params[channel].child("PID Config", "Kd").setValue(settings["parameters"]["kd"]) if params[channel].child("Temperature PID").value(): params[channel].child("Temperature PID", "Set Temperature").setValue(settings["target"])