forked from M-Labs/thermostat
Compare commits
28 Commits
5574559ac6
...
c9aa0eaab8
Author | SHA1 | Date | |
---|---|---|---|
c9aa0eaab8 | |||
ed6cee4394 | |||
e1bd960900 | |||
aed0c484dd | |||
3fe343435d | |||
eddfc40e07 | |||
3ae89760ab | |||
2f9b95f04b | |||
9926c00494 | |||
fde1e6b3e4 | |||
873f16a675 | |||
85c8c23f2c | |||
ac10859f70 | |||
4bda62ab41 | |||
6df37e31aa | |||
2df4c03c2d | |||
2b9bc020ce | |||
dafde57e23 | |||
6a38f9b5a6 | |||
9af4ffd125 | |||
55a7583867 | |||
19c3c7a8f2 | |||
41abad7aa3 | |||
5c8d9c7cce | |||
278898fad2 | |||
dd83daa5d9 | |||
d57cc9ef2a | |||
be77a6f205 |
@ -42,14 +42,10 @@
|
|||||||
"Constant Current": "constant_current",
|
"Constant Current": "constant_current",
|
||||||
"Temperature PID": "temperature_pid"
|
"Temperature PID": "temperature_pid"
|
||||||
},
|
},
|
||||||
"activaters": [
|
"thermostat:set_param": {
|
||||||
null,
|
"topic": "pwm",
|
||||||
[
|
"field": "pid"
|
||||||
"pwm",
|
},
|
||||||
"ch",
|
|
||||||
"pid"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"tip": "Select control method of output",
|
"tip": "Select control method of output",
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
@ -68,11 +64,10 @@
|
|||||||
"siPrefix": true,
|
"siPrefix": true,
|
||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"param": [
|
"thermostat:set_param": {
|
||||||
"pwm",
|
"topic": "pwm",
|
||||||
"ch",
|
"field": "i_set"
|
||||||
"i_set"
|
},
|
||||||
],
|
|
||||||
"tip": "The set current through TEC",
|
"tip": "The set current through TEC",
|
||||||
"lock": false
|
"lock": false
|
||||||
},
|
},
|
||||||
@ -90,11 +85,10 @@
|
|||||||
"suffix": "°C",
|
"suffix": "°C",
|
||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"param": [
|
"thermostat:set_param": {
|
||||||
"pid",
|
"topic": "pid",
|
||||||
"ch",
|
"field": "target"
|
||||||
"target"
|
},
|
||||||
],
|
|
||||||
"tip": "The temperature setpoint of the TEC",
|
"tip": "The temperature setpoint of the TEC",
|
||||||
"lock": false
|
"lock": false
|
||||||
}
|
}
|
||||||
@ -123,11 +117,10 @@
|
|||||||
"suffix": "A",
|
"suffix": "A",
|
||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"param": [
|
"thermostat:set_param": {
|
||||||
"pwm",
|
"topic": "pwm",
|
||||||
"ch",
|
"field": "max_i_pos"
|
||||||
"max_i_pos"
|
},
|
||||||
],
|
|
||||||
"tip": "The maximum cooling (+ve) current through the output pins",
|
"tip": "The maximum cooling (+ve) current through the output pins",
|
||||||
"lock": false
|
"lock": false
|
||||||
},
|
},
|
||||||
@ -147,11 +140,10 @@
|
|||||||
2
|
2
|
||||||
],
|
],
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"param": [
|
"thermostat:set_param": {
|
||||||
"pwm",
|
"topic": "pwm",
|
||||||
"ch",
|
"field": "max_i_neg"
|
||||||
"max_i_neg"
|
},
|
||||||
],
|
|
||||||
"tip": "The maximum heating (-ve) current through the output pins",
|
"tip": "The maximum heating (-ve) current through the output pins",
|
||||||
"lock": false
|
"lock": false
|
||||||
},
|
},
|
||||||
@ -169,11 +161,10 @@
|
|||||||
"suffix": "V",
|
"suffix": "V",
|
||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"param": [
|
"thermostat:set_param": {
|
||||||
"pwm",
|
"topic": "pwm",
|
||||||
"ch",
|
"field": "max_v"
|
||||||
"max_v"
|
},
|
||||||
],
|
|
||||||
"tip": "The maximum voltage (in both directions) across the output pins",
|
"tip": "The maximum voltage (in both directions) across the output pins",
|
||||||
"lock": false
|
"lock": false
|
||||||
}
|
}
|
||||||
@ -202,11 +193,10 @@
|
|||||||
"suffix": "°C",
|
"suffix": "°C",
|
||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"param": [
|
"thermostat:set_param": {
|
||||||
"s-h",
|
"topic": "s-h",
|
||||||
"ch",
|
"field": "t0"
|
||||||
"t0"
|
},
|
||||||
],
|
|
||||||
"tip": "The base temperature",
|
"tip": "The base temperature",
|
||||||
"lock": false
|
"lock": false
|
||||||
},
|
},
|
||||||
@ -222,11 +212,10 @@
|
|||||||
"suffix": "Ω",
|
"suffix": "Ω",
|
||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"param": [
|
"thermostat:set_param": {
|
||||||
"s-h",
|
"topic": "s-h",
|
||||||
"ch",
|
"field": "r0"
|
||||||
"r0"
|
},
|
||||||
],
|
|
||||||
"tip": "The resistance of the thermistor at base temperature T₀",
|
"tip": "The resistance of the thermistor at base temperature T₀",
|
||||||
"lock": false
|
"lock": false
|
||||||
},
|
},
|
||||||
@ -240,11 +229,10 @@
|
|||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"decimals": 4,
|
"decimals": 4,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"param": [
|
"thermostat:set_param": {
|
||||||
"s-h",
|
"topic": "s-h",
|
||||||
"ch",
|
"field": "b"
|
||||||
"b"
|
},
|
||||||
],
|
|
||||||
"tip": "The Beta Parameter",
|
"tip": "The Beta Parameter",
|
||||||
"lock": false
|
"lock": false
|
||||||
}
|
}
|
||||||
@ -261,11 +249,10 @@
|
|||||||
"title": "50/60 Hz Rejection Filter",
|
"title": "50/60 Hz Rejection Filter",
|
||||||
"type": "list",
|
"type": "list",
|
||||||
"value": 16.67,
|
"value": 16.67,
|
||||||
"param": [
|
"thermostat:set_param": {
|
||||||
"postfilter",
|
"topic": "postfilter",
|
||||||
"ch",
|
"field": "rate"
|
||||||
"rate"
|
},
|
||||||
],
|
|
||||||
"limits": {
|
"limits": {
|
||||||
"16.67 SPS": 16.67,
|
"16.67 SPS": 16.67,
|
||||||
"20 SPS": 20.0,
|
"20 SPS": 20.0,
|
||||||
@ -291,11 +278,10 @@
|
|||||||
"type": "float",
|
"type": "float",
|
||||||
"step": 0.1,
|
"step": 0.1,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"param": [
|
"thermostat:set_param": {
|
||||||
"pid",
|
"topic": "pid",
|
||||||
"ch",
|
"field": "kp"
|
||||||
"kp"
|
},
|
||||||
],
|
|
||||||
"tip": "Proportional gain",
|
"tip": "Proportional gain",
|
||||||
"lock": false
|
"lock": false
|
||||||
},
|
},
|
||||||
@ -307,11 +293,10 @@
|
|||||||
"suffix": "Hz",
|
"suffix": "Hz",
|
||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"param": [
|
"thermostat:set_param": {
|
||||||
"pid",
|
"topic": "pid",
|
||||||
"ch",
|
"field": "ki"
|
||||||
"ki"
|
},
|
||||||
],
|
|
||||||
"tip": "Integral gain",
|
"tip": "Integral gain",
|
||||||
"lock": false
|
"lock": false
|
||||||
},
|
},
|
||||||
@ -323,11 +308,10 @@
|
|||||||
"suffix": "s",
|
"suffix": "s",
|
||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"param": [
|
"thermostat:set_param": {
|
||||||
"pid",
|
"topic": "pid",
|
||||||
"ch",
|
"field": "kd"
|
||||||
"kd"
|
},
|
||||||
],
|
|
||||||
"tip": "Differential gain",
|
"tip": "Differential gain",
|
||||||
"lock": false
|
"lock": false
|
||||||
},
|
},
|
||||||
@ -353,11 +337,10 @@
|
|||||||
"suffix": "A",
|
"suffix": "A",
|
||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"param": [
|
"thermostat:set_param": {
|
||||||
"pid",
|
"topic": "pid",
|
||||||
"ch",
|
"field": "output_min"
|
||||||
"output_min"
|
},
|
||||||
],
|
|
||||||
"tip": "Minimum PID output",
|
"tip": "Minimum PID output",
|
||||||
"lock": false
|
"lock": false
|
||||||
},
|
},
|
||||||
@ -376,11 +359,10 @@
|
|||||||
"suffix": "A",
|
"suffix": "A",
|
||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"param": [
|
"thermostat:set_param": {
|
||||||
"pid",
|
"topic": "pid",
|
||||||
"ch",
|
"field": "output_max"
|
||||||
"output_max"
|
},
|
||||||
],
|
|
||||||
"tip": "Maximum PID output",
|
"tip": "Maximum PID output",
|
||||||
"lock": false
|
"lock": false
|
||||||
}
|
}
|
||||||
@ -403,10 +385,7 @@
|
|||||||
"suffix": "°C",
|
"suffix": "°C",
|
||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"pid_autotune": [
|
"pid_autotune": "target_temp",
|
||||||
"target_temp",
|
|
||||||
"ch"
|
|
||||||
],
|
|
||||||
"tip": "The target temperature to autotune for"
|
"tip": "The target temperature to autotune for"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -425,10 +404,7 @@
|
|||||||
"suffix": "A",
|
"suffix": "A",
|
||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"pid_autotune": [
|
"pid_autotune": "test_current",
|
||||||
"test_current",
|
|
||||||
"ch"
|
|
||||||
],
|
|
||||||
"tip": "The testing current when autotuning"
|
"tip": "The testing current when autotuning"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -441,10 +417,7 @@
|
|||||||
"suffix": "K",
|
"suffix": "K",
|
||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"pid_autotune": [
|
"pid_autotune": "temp_swing",
|
||||||
"temp_swing",
|
|
||||||
"ch"
|
|
||||||
],
|
|
||||||
"tip": "The temperature swing around the target"
|
"tip": "The temperature swing around the target"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -457,10 +430,7 @@
|
|||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"suffix": "s",
|
"suffix": "s",
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"pid_autotune": [
|
"pid_autotune": "lookback",
|
||||||
"lookback",
|
|
||||||
"ch"
|
|
||||||
],
|
|
||||||
"tip": "Amount of time referenced for tuning"
|
"tip": "Amount of time referenced for tuning"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -266,37 +266,32 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
|
|
||||||
for inner_param, change, data in changes:
|
for inner_param, change, data in changes:
|
||||||
if change == "value":
|
if change == "value":
|
||||||
if inner_param.opts.get("param", None) is not None:
|
new_value = data
|
||||||
thermostat_param = inner_param.opts["param"]
|
if "thermostat:set_param" in inner_param.opts:
|
||||||
if thermostat_param[1] == "ch":
|
thermostat_param = inner_param.opts["thermostat:set_param"]
|
||||||
thermostat_param[1] = ch
|
|
||||||
|
|
||||||
if inner_param.name() == "rate" and data is None:
|
# Handle thermostat command irregularities
|
||||||
set_param_args = (*thermostat_param[:2], "off")
|
match inner_param.name(), new_value:
|
||||||
else:
|
case "rate", None:
|
||||||
set_param_args = (*thermostat_param, data)
|
thermostat_param = thermostat_param.copy()
|
||||||
param.child(*param.childPath(inner_param)).setOpts(lock=True)
|
thermostat_param["field"] = "off"
|
||||||
await self.client.set_param(*set_param_args)
|
new_value = ""
|
||||||
param.child(*param.childPath(inner_param)).setOpts(lock=False)
|
case "control_method", "constant_current":
|
||||||
|
thermostat_param = thermostat_param.copy()
|
||||||
|
thermostat_param["field"] = "i_set"
|
||||||
|
new_value = inner_param.child("i_set").value()
|
||||||
|
case "control_method", "temperature_pid":
|
||||||
|
new_value = ""
|
||||||
|
|
||||||
if inner_param.opts.get("pid_autotune", None) is not None:
|
inner_param.setOpts(lock=True)
|
||||||
autotuner_param = inner_param.opts["pid_autotune"][0]
|
await self.client.set_param(
|
||||||
if inner_param.opts["pid_autotune"][1] != "ch":
|
channel=ch, value=new_value, **thermostat_param
|
||||||
ch = inner_param.opts["pid_autotune"][1]
|
)
|
||||||
self.autotuners.set_params(autotuner_param, ch, data)
|
inner_param.setOpts(lock=False)
|
||||||
|
|
||||||
if inner_param.opts.get("activaters", None) is not None:
|
if "pid_autotune" in inner_param.opts:
|
||||||
activater = inner_param.opts["activaters"][
|
auto_tuner_param = inner_param.opts["pid_autotune"]
|
||||||
inner_param.reverse[0].index(data) # ListParameter.reverse = list of codename values
|
self.autotuners.set_params(auto_tuner_param, ch, new_value)
|
||||||
]
|
|
||||||
if activater is not None:
|
|
||||||
if activater[1] == "ch":
|
|
||||||
activater[1] = ch
|
|
||||||
await self.client.set_param(*activater)
|
|
||||||
else:
|
|
||||||
await self.client.set_param(
|
|
||||||
"pwm", ch, "i_set", inner_param.child("i_set").value()
|
|
||||||
)
|
|
||||||
|
|
||||||
@asyncSlot()
|
@asyncSlot()
|
||||||
async def pid_autotune_request(self, ch=0):
|
async def pid_autotune_request(self, ch=0):
|
||||||
|
Loading…
Reference in New Issue
Block a user