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.
This commit is contained in:
atse 2023-07-18 17:16:35 +08:00
parent abf5d5f2bd
commit 4961b2adb2
1 changed files with 12 additions and 12 deletions

View File

@ -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"])