forked from M-Labs/thermostat
Compare commits
21 Commits
c9aa0eaab8
...
5574559ac6
Author | SHA1 | Date | |
---|---|---|---|
5574559ac6 | |||
e160a6f514 | |||
ae9bd1a859 | |||
0f768f30e8 | |||
07095d77c8 | |||
4a7d7abf3a | |||
b9cf60f2df | |||
3ffa939970 | |||
87ba107ce5 | |||
319fb9cf9e | |||
f7c266539b | |||
df9715b3ef | |||
82279f15da | |||
fff42bfa4c | |||
d3b93b1263 | |||
4309f9044c | |||
81418d0a55 | |||
7fb933faa2 | |||
437c9cec34 | |||
7829ce6adf | |||
0f14212622 |
@ -42,10 +42,14 @@
|
|||||||
"Constant Current": "constant_current",
|
"Constant Current": "constant_current",
|
||||||
"Temperature PID": "temperature_pid"
|
"Temperature PID": "temperature_pid"
|
||||||
},
|
},
|
||||||
"thermostat:set_param": {
|
"activaters": [
|
||||||
"topic": "pwm",
|
null,
|
||||||
"field": "pid"
|
[
|
||||||
},
|
"pwm",
|
||||||
|
"ch",
|
||||||
|
"pid"
|
||||||
|
]
|
||||||
|
],
|
||||||
"tip": "Select control method of output",
|
"tip": "Select control method of output",
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
@ -64,10 +68,11 @@
|
|||||||
"siPrefix": true,
|
"siPrefix": true,
|
||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"thermostat:set_param": {
|
"param": [
|
||||||
"topic": "pwm",
|
"pwm",
|
||||||
"field": "i_set"
|
"ch",
|
||||||
},
|
"i_set"
|
||||||
|
],
|
||||||
"tip": "The set current through TEC",
|
"tip": "The set current through TEC",
|
||||||
"lock": false
|
"lock": false
|
||||||
},
|
},
|
||||||
@ -85,10 +90,11 @@
|
|||||||
"suffix": "°C",
|
"suffix": "°C",
|
||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"thermostat:set_param": {
|
"param": [
|
||||||
"topic": "pid",
|
"pid",
|
||||||
"field": "target"
|
"ch",
|
||||||
},
|
"target"
|
||||||
|
],
|
||||||
"tip": "The temperature setpoint of the TEC",
|
"tip": "The temperature setpoint of the TEC",
|
||||||
"lock": false
|
"lock": false
|
||||||
}
|
}
|
||||||
@ -117,10 +123,11 @@
|
|||||||
"suffix": "A",
|
"suffix": "A",
|
||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"thermostat:set_param": {
|
"param": [
|
||||||
"topic": "pwm",
|
"pwm",
|
||||||
"field": "max_i_pos"
|
"ch",
|
||||||
},
|
"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
|
||||||
},
|
},
|
||||||
@ -140,10 +147,11 @@
|
|||||||
2
|
2
|
||||||
],
|
],
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"thermostat:set_param": {
|
"param": [
|
||||||
"topic": "pwm",
|
"pwm",
|
||||||
"field": "max_i_neg"
|
"ch",
|
||||||
},
|
"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
|
||||||
},
|
},
|
||||||
@ -161,10 +169,11 @@
|
|||||||
"suffix": "V",
|
"suffix": "V",
|
||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"thermostat:set_param": {
|
"param": [
|
||||||
"topic": "pwm",
|
"pwm",
|
||||||
"field": "max_v"
|
"ch",
|
||||||
},
|
"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
|
||||||
}
|
}
|
||||||
@ -193,10 +202,11 @@
|
|||||||
"suffix": "°C",
|
"suffix": "°C",
|
||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"thermostat:set_param": {
|
"param": [
|
||||||
"topic": "s-h",
|
"s-h",
|
||||||
"field": "t0"
|
"ch",
|
||||||
},
|
"t0"
|
||||||
|
],
|
||||||
"tip": "The base temperature",
|
"tip": "The base temperature",
|
||||||
"lock": false
|
"lock": false
|
||||||
},
|
},
|
||||||
@ -212,10 +222,11 @@
|
|||||||
"suffix": "Ω",
|
"suffix": "Ω",
|
||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"thermostat:set_param": {
|
"param": [
|
||||||
"topic": "s-h",
|
"s-h",
|
||||||
"field": "r0"
|
"ch",
|
||||||
},
|
"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
|
||||||
},
|
},
|
||||||
@ -229,10 +240,11 @@
|
|||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"decimals": 4,
|
"decimals": 4,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"thermostat:set_param": {
|
"param": [
|
||||||
"topic": "s-h",
|
"s-h",
|
||||||
"field": "b"
|
"ch",
|
||||||
},
|
"b"
|
||||||
|
],
|
||||||
"tip": "The Beta Parameter",
|
"tip": "The Beta Parameter",
|
||||||
"lock": false
|
"lock": false
|
||||||
}
|
}
|
||||||
@ -249,10 +261,11 @@
|
|||||||
"title": "50/60 Hz Rejection Filter",
|
"title": "50/60 Hz Rejection Filter",
|
||||||
"type": "list",
|
"type": "list",
|
||||||
"value": 16.67,
|
"value": 16.67,
|
||||||
"thermostat:set_param": {
|
"param": [
|
||||||
"topic": "postfilter",
|
"postfilter",
|
||||||
"field": "rate"
|
"ch",
|
||||||
},
|
"rate"
|
||||||
|
],
|
||||||
"limits": {
|
"limits": {
|
||||||
"16.67 SPS": 16.67,
|
"16.67 SPS": 16.67,
|
||||||
"20 SPS": 20.0,
|
"20 SPS": 20.0,
|
||||||
@ -278,10 +291,11 @@
|
|||||||
"type": "float",
|
"type": "float",
|
||||||
"step": 0.1,
|
"step": 0.1,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"thermostat:set_param": {
|
"param": [
|
||||||
"topic": "pid",
|
"pid",
|
||||||
"field": "kp"
|
"ch",
|
||||||
},
|
"kp"
|
||||||
|
],
|
||||||
"tip": "Proportional gain",
|
"tip": "Proportional gain",
|
||||||
"lock": false
|
"lock": false
|
||||||
},
|
},
|
||||||
@ -293,10 +307,11 @@
|
|||||||
"suffix": "Hz",
|
"suffix": "Hz",
|
||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"thermostat:set_param": {
|
"param": [
|
||||||
"topic": "pid",
|
"pid",
|
||||||
"field": "ki"
|
"ch",
|
||||||
},
|
"ki"
|
||||||
|
],
|
||||||
"tip": "Integral gain",
|
"tip": "Integral gain",
|
||||||
"lock": false
|
"lock": false
|
||||||
},
|
},
|
||||||
@ -308,10 +323,11 @@
|
|||||||
"suffix": "s",
|
"suffix": "s",
|
||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"thermostat:set_param": {
|
"param": [
|
||||||
"topic": "pid",
|
"pid",
|
||||||
"field": "kd"
|
"ch",
|
||||||
},
|
"kd"
|
||||||
|
],
|
||||||
"tip": "Differential gain",
|
"tip": "Differential gain",
|
||||||
"lock": false
|
"lock": false
|
||||||
},
|
},
|
||||||
@ -337,10 +353,11 @@
|
|||||||
"suffix": "A",
|
"suffix": "A",
|
||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"thermostat:set_param": {
|
"param": [
|
||||||
"topic": "pid",
|
"pid",
|
||||||
"field": "output_min"
|
"ch",
|
||||||
},
|
"output_min"
|
||||||
|
],
|
||||||
"tip": "Minimum PID output",
|
"tip": "Minimum PID output",
|
||||||
"lock": false
|
"lock": false
|
||||||
},
|
},
|
||||||
@ -359,10 +376,11 @@
|
|||||||
"suffix": "A",
|
"suffix": "A",
|
||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"thermostat:set_param": {
|
"param": [
|
||||||
"topic": "pid",
|
"pid",
|
||||||
"field": "output_max"
|
"ch",
|
||||||
},
|
"output_max"
|
||||||
|
],
|
||||||
"tip": "Maximum PID output",
|
"tip": "Maximum PID output",
|
||||||
"lock": false
|
"lock": false
|
||||||
}
|
}
|
||||||
@ -385,7 +403,10 @@
|
|||||||
"suffix": "°C",
|
"suffix": "°C",
|
||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"pid_autotune": "target_temp",
|
"pid_autotune": [
|
||||||
|
"target_temp",
|
||||||
|
"ch"
|
||||||
|
],
|
||||||
"tip": "The target temperature to autotune for"
|
"tip": "The target temperature to autotune for"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -404,7 +425,10 @@
|
|||||||
"suffix": "A",
|
"suffix": "A",
|
||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"pid_autotune": "test_current",
|
"pid_autotune": [
|
||||||
|
"test_current",
|
||||||
|
"ch"
|
||||||
|
],
|
||||||
"tip": "The testing current when autotuning"
|
"tip": "The testing current when autotuning"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -417,7 +441,10 @@
|
|||||||
"suffix": "K",
|
"suffix": "K",
|
||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"pid_autotune": "temp_swing",
|
"pid_autotune": [
|
||||||
|
"temp_swing",
|
||||||
|
"ch"
|
||||||
|
],
|
||||||
"tip": "The temperature swing around the target"
|
"tip": "The temperature swing around the target"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -430,7 +457,10 @@
|
|||||||
"noUnitEditing": true,
|
"noUnitEditing": true,
|
||||||
"suffix": "s",
|
"suffix": "s",
|
||||||
"compactHeight": false,
|
"compactHeight": false,
|
||||||
"pid_autotune": "lookback",
|
"pid_autotune": [
|
||||||
|
"lookback",
|
||||||
|
"ch"
|
||||||
|
],
|
||||||
"tip": "Amount of time referenced for tuning"
|
"tip": "Amount of time referenced for tuning"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -266,32 +266,37 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
|
|
||||||
for inner_param, change, data in changes:
|
for inner_param, change, data in changes:
|
||||||
if change == "value":
|
if change == "value":
|
||||||
new_value = data
|
if inner_param.opts.get("param", None) is not None:
|
||||||
if "thermostat:set_param" in inner_param.opts:
|
thermostat_param = inner_param.opts["param"]
|
||||||
thermostat_param = inner_param.opts["thermostat:set_param"]
|
if thermostat_param[1] == "ch":
|
||||||
|
thermostat_param[1] = ch
|
||||||
|
|
||||||
# Handle thermostat command irregularities
|
if inner_param.name() == "rate" and data is None:
|
||||||
match inner_param.name(), new_value:
|
set_param_args = (*thermostat_param[:2], "off")
|
||||||
case "rate", None:
|
else:
|
||||||
thermostat_param = thermostat_param.copy()
|
set_param_args = (*thermostat_param, data)
|
||||||
thermostat_param["field"] = "off"
|
param.child(*param.childPath(inner_param)).setOpts(lock=True)
|
||||||
new_value = ""
|
await self.client.set_param(*set_param_args)
|
||||||
case "control_method", "constant_current":
|
param.child(*param.childPath(inner_param)).setOpts(lock=False)
|
||||||
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 = ""
|
|
||||||
|
|
||||||
inner_param.setOpts(lock=True)
|
if inner_param.opts.get("pid_autotune", None) is not None:
|
||||||
|
autotuner_param = inner_param.opts["pid_autotune"][0]
|
||||||
|
if inner_param.opts["pid_autotune"][1] != "ch":
|
||||||
|
ch = inner_param.opts["pid_autotune"][1]
|
||||||
|
self.autotuners.set_params(autotuner_param, ch, data)
|
||||||
|
|
||||||
|
if inner_param.opts.get("activaters", None) is not None:
|
||||||
|
activater = inner_param.opts["activaters"][
|
||||||
|
inner_param.reverse[0].index(data) # ListParameter.reverse = list of codename values
|
||||||
|
]
|
||||||
|
if activater is not None:
|
||||||
|
if activater[1] == "ch":
|
||||||
|
activater[1] = ch
|
||||||
|
await self.client.set_param(*activater)
|
||||||
|
else:
|
||||||
await self.client.set_param(
|
await self.client.set_param(
|
||||||
channel=ch, value=new_value, **thermostat_param
|
"pwm", ch, "i_set", inner_param.child("i_set").value()
|
||||||
)
|
)
|
||||||
inner_param.setOpts(lock=False)
|
|
||||||
|
|
||||||
if "pid_autotune" in inner_param.opts:
|
|
||||||
auto_tuner_param = inner_param.opts["pid_autotune"]
|
|
||||||
self.autotuners.set_params(auto_tuner_param, ch, new_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