THRESH_HOLD_IDLE/HOLD_HEAT/IDLE_HEAT/IDLE_HOLD/HEAT_HOLD/HEAT_IDLE in tc_constants.py were hardcoded module-level constants shared by every controller instance, so tuning the IDLE/HOLD/HEAT hysteresis required a code change. Replace them with DEFAULT_THRESHOLDS plus an optional TempCtrl.Thresholds config section, merged at construction time in TempControllerBase.__init__ so configs that omit the section keep behaving exactly as before. Documented the new section in config.json.templ; left config.json.sim without it to exercise the default-fallback path. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
65 lines
899 B
Templ
65 lines
899 B
Templ
{
|
|
"Controller" : {
|
|
"dt": 1,
|
|
"sim_warp_factor": 10.0,
|
|
"stirrer_name": "sim",
|
|
"heater_name": "sim",
|
|
"sensor_name": "sim",
|
|
"plant_name": "sim",
|
|
"pid_type": "Smith"
|
|
},
|
|
"TempCtrl": {
|
|
"Kalman": {
|
|
"var_P" : 1.0,
|
|
"var_Q" : 0.0001,
|
|
"var_R" : 1.0
|
|
},
|
|
"Hold": {
|
|
"kp": 0.4,
|
|
"ki": 0.0,
|
|
"kd": 0.0,
|
|
"kt": 0.0
|
|
},
|
|
"Heat": {
|
|
"kp": 0.05,
|
|
"ki": 0.01,
|
|
"kd": 0.0,
|
|
"kt": 1.5
|
|
},
|
|
"Thresholds": {
|
|
"HoldIdle": 0.1,
|
|
"HoldHeat": 1.0,
|
|
"IdleHeat": 1.0,
|
|
"IdleHold": 0.1,
|
|
"HeatHold": 1.0,
|
|
"HeatIdle": 1.0
|
|
}
|
|
},
|
|
"Model": {
|
|
"theta": 20,
|
|
"C": 4190,
|
|
"M": 25,
|
|
"L": 0.05,
|
|
"Td": 15,
|
|
"kn": 0.2,
|
|
"gain" : 0.8
|
|
},
|
|
"Plant": {
|
|
"theta": 20,
|
|
"C": 4190,
|
|
"M": 25,
|
|
"L": 0.05,
|
|
"Td": 15,
|
|
"kn": 0.2,
|
|
"gain" : 0.8
|
|
},
|
|
"Heater": {
|
|
"port": "/dev/ttyUSB0",
|
|
"speed": "115200"
|
|
},
|
|
"Stirrer": {
|
|
"port": "/dev/ttyACM0",
|
|
"speed": "115200"
|
|
}
|
|
}
|